MATLAB: Major axis and minor axis

Image Processing Toolboxregionprops

How can I plot the major axis and minor axis for an object in an image?

Best Answer

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.