How to visualize MajorAxisLength and MinorAxisLength on images?
27 ビュー (過去 30 日間)
I would like to replicate something similar to that shown in the explanation of "Orientation" property of the "regionprops" function, as viewable here:
I would plot the red ellipse and the blue lines representing the axes, over my images (both binary and grayscale). I found this example:
but I can't understand how complete the code to plot the blue lines. Could anyone help me, please?
Thanks for your answers.
Image Analyst 2016 年 7 月 12 日
Get the two endpoints of the line, then call plot. For example x1 = xCentroid + (majorAxisLength/2) * cosd(orientation). Same for y1, x2,and y2. It's just simple trigonometry. Then call plot([x1,x2], [y1,y2], 'r-').