이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
How can I plot the major axis and minor axis for an object in an image?
댓글 수: 2
Pamela
2012년 9월 1일
I need your held please !!
Image Analyst
2012년 11월 10일
I've just added a section on "How do I create an ellipse" to the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_ellipse.3F so that might help you.
채택된 답변
Walter Roberson
2012년 8월 27일
0 개 추천
regionprops() to get the centroid and orientation (angle). After that it becomes straight trig. The axes length is R, compute R*cos(theta), R*sin(theta), and center those displacements on the centroid.
댓글 수: 17
i tried this. Can you help me to complete it please??
img_seg=segmentation(image);
a = regionprops(img_seg, 'Orientation', 'MajorAxisLength', 'MinorAxisLength', 'Centroid');
theta = pi*a.Orientation/180;
x=a.MajorAxisLength*cos(theta);
y=a.MinorAxisLength*sin(theta);
Pamela
2012년 8월 29일
How can i excute this with an image (black background and a color region of interest)
Image Analyst
2012년 9월 1일
I think Steve's blog that Teja referred you to spells it out pretty explicitly. Can't you follow that? Do you want something different than that, like lines instead of ellipses?
I tried it but i had this error
??? Error using ==> iptcheckinput Function REGIONPROPS expected its first input, L, to be integer-valued.
You must have a very old version of MATLAB. Try labeling your binary image before passing it in, instead of passing in just the binary image:
labeledImage = bwlabel(img_seg);
measurements = regionprops(labeledImage, 'Orientation', 'MajorAxisLength', 'MinorAxisLength', 'Centroid');
Pamela
2012년 9월 1일
thx it works but if i want to draw the major axes and the minor axes and to hide the ellipse, what should i do??
Image Analyst
2012년 9월 1일
편집: Image Analyst
2012년 9월 1일
Use the centroid, orientation, and the two lengths and some simple 10th grade trigonometry (see Walter's response) to find the endpoints of the lines and then use line() to draw the major and minor axes. The angle for the minor axes will be the major axis angle + 90 degrees. There are degree versions of sin and cos called sind() and cosd() if you prefer to work in degrees instead of radians. IMPORTANT NOTE: the axes are determined by an elliptical fit so don't expect the endpoints of the axes to exactly hit the boundary of the object.
I tried this code. Can you correct it for me and how can i use this axes and PCA to study the asymmetry of the object.
xfact = s.MajorAxisLength./2*cos(s.Orientation*pi/180);
yfact = s.MajorAxisLength./2*sin(s.Orientation*pi/180);
Major = line(xfact+s.Centroid(1),yfact+s.Centroid(2));
Image Analyst
2012년 9월 2일
Pamela, I can't run your code because I don't have your image or your segmentation function. But common reasons for things being reversed are getting (row, column) confused with (x,y) when it should correspond to (y, x), and/or plotting points on a different axes than the image, where the YDir property is going the opposite way. Recall that the standard for images is for the top line to be 1 and higher line numbers are below that. This is opposite to the convention that you have is you just use plot() to plot some numbers in a brand new axes. However, plot will be correct if you used "hold on" and plotted in the same axes right over the top of your image.
Thank you, It works now. I managed to draw the two axes but now I need to study the asymmetry of the region. Can you tell me how can I use these axes and the PCA to study the asymmetry of the ROI.
Can you do something along these lines:
positivePC1Elements = PC1_image >= 0;
negativePC1Elements = PC1_image < 0;
meanPositivePC1 = mean(PC1_image(positivePC1Elements));
meanNegativePC1 = mean(PC1_image(negativePC1Elements));
if abs(meanPositivePC1 - meanNegativePC1) < someTolerance
% They're close
else
% They're different
end
Pamela
2012년 9월 3일
Thank you Image Analyst, Can you explain to me more because I have no idea about PCA. What represents the variables used??
Pamela
2012년 9월 7일
Bonjour Et comment faire pour ajouter 2 axes de plus et pour pouvoir diviser la région en 8 parties en utilisant 4 axes en total??? Je compte sur votre aide pour pouvoir avancer
Image Analyst
2012년 9월 7일
I can't really give you a course in PCA here. Basically they are the major directions of your independent variables, which can be combinations of your actual variables.
Hi! To study the similarity between 2 images we should use these steps???
-Calculate the mean of the input images
-Subtract the mean from the input images to obtain the mean-shifted images
-Calculate the eigenvectors and eigenvalues of the mean-shifted images
-Order the eigenvectors by their corresponding eigenvalues, in decreasing order
-Retain only the eigenvectors with the largest eigenvalues (the principal components)
-Project the mean-shifted images into the eigenspace using the retained eigenvectors
-Calculate the Euclidean distance
It's the same solution to study the asymmetry of the region?? Can this help me??
Thanks
Image Analyst
2012년 9월 9일
Pamela, I haven't heard of that method to determine similarity. Much more common is SSIM ( http://en.wikipedia.org/wiki/SSIM) and friends, or even PSNR. Or you can use image moments: http://en.wikipedia.org/wiki/Image_moment
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
태그
참고 항목
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)
