fitting an ellipse to my binary iris image ?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
1 개 추천
I want to fit an ellipse to the boundary of the iris in my edge map eye image in order to segment the iris from the background.i really appretiate your help. the image is :
thanks inadvance.
na
채택된 답변
Matt J
2012년 11월 12일
function report=ellipsefit(XY)
%ELLIPSEFIT - form 2D ellipse fit to given x,y data
%
% report=ellipsefit(XY)
%
%in:
%
% XY: Input matrix of 2D coordinates to be fit. Each column XY(:,i) is [xi;yi]
%
%out: Finds the ellipse fitting the input data parametrized both as
% A*x^2+B*x*y C*y^2+D*x+E*y=1 and [x-x0,y-y0]*Q*[x-x0;y-y0]=1
%
% report: a structure output with the following fields
%
% report.Q: the matrix Q
% report.d: the vector [x0,y0]
% report.ABCDE: the vector [A,B,C,D,E]
% report.AxesDiams: The minor and major ellipse diameters
% report.theta: The counter-clockwise rotation of the ellipse.
%
%NOTE: The code will give errors if the data fit traces out a non-elliptic or
% degenerate conic section.
%
%See also ellipsoidfit
X=XY(1,:).';
Y=XY(2,:).';
M= [X.^2, X.*Y, Y.^2, X, Y, -ones(size(X,1),1)];
[U,S,V]=svd(M,0);
ABCDEF=V(:,end);
if size(ABCDEF,2)>1
error 'Data cannot be fit with unique ellipse'
else
ABCDEF=num2cell(ABCDEF);
end
[A,B,C,D,E,F]=deal(ABCDEF{:});
Q=[A, B/2;B/2 C];
x0=-Q\[D;E]/2;
dd=F+x0'*Q*x0;
Q=Q/dd;
[R,eigen]=eig(Q);
eigen=eigen([1,4]);
if ~all(eigen>=0), error 'Fit produced a non-elliptic conic section'; end
idx=eigen>0;
eigen(idx)=1./eigen(idx);
AxesDiams = 2*sqrt(eigen);
theta=atand(tand(-atan2(R(1),R(2))*180/pi));
report.Q=Q;
report.d=x0(:).';
report.ABCDE=[A, B, C, D, E]/F;
report.AxesDiams=sort(AxesDiams(:)).';
report.theta=theta;
댓글 수: 13
nedaa
2012년 11월 12일
thank you for your answer, but please what is the input parameters (XY)??
Matt J
2012년 11월 12일
The sample x,y coordinates to which you are trying to fit the ellipse.
leon
2013년 2월 27일
Matt J,
I need your help your program can fitting an ellipse to mango image?
Thank you.
Matt J
2013년 2월 27일
Sure. Once you obtain the boundary xy coordinates.
leon
2013년 2월 28일
Matt J,
Can you use the mango picture, do a example to me to see because i am begginer, i no understand how to obtain the boundary xy coordinates.
That appears to be very challenging! In any case, it's not relevant to this thread or my code, which is about ellipse fitting. It's more of a segmentation problem.
leon
2013년 3월 20일
Matt J,
How to fitting ellipse on the object in image? Thank you.
First get rid of the clutter by extracting just the largest object. Then call bwboundaries() to get the perimeter coordinates. Then use the ellipsefit() code.
leon
2013년 3월 26일
Image Analyst ,
Well I can't tell from that image if you called bwboundaries() or not, but what I can tell is that you didn't extract the largest blob into it's own image. That is probably a separate topic, more general purpose than this, and probably should be a separate, new question because lots of people might benefit from it. So, ask a new question like "How can I extract the largest blob in a binary image?"
leon
2013년 3월 28일
Matt J,
how to read the image i want using your code or other code because i try to run but cannot read the image. Like below
imread("abc.jpg") a= imread("abc.jpg") imshow(a)
already run like the top code but cannot read the image. i want ask got other code to read the image?
Matt J
2013년 3월 28일
Matt J, how to read the image i want using your code
You were probably really talking to ImageAnalyst.
Image Analyst
2016년 10월 31일
Except that I didn't post any code.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Object Analysis에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
