How do I draw a line along the major axis as found with regionprops
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mahalakshmi
am 29 Jun. 2011
Kommentiert: Image Analyst
am 30 Okt. 2021
I have used the regionprops to find the MajorAxisLenth of each object in my image. How do I draw a line along the major axis?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 29 Jun. 2011
If you get the Centroid and Orientation and MajorAxisLength properties, then this becomes mostly a traditional y = m*x + b problem, where m is tan() of the Orientation and b is chosen so that the line passes through the Centroid.
Or even easier, MajorAxisLength * cosd(Orientation) to get the x axis coordinate difference, center that around the Centroid, likewise MajorAxisLength * sind(Orientation) to get the y coordinate difference, center that around the Centroid; then line() between the two endpoints.
4 Kommentare
Image Analyst
am 30 Okt. 2021
It's the width of the bounding box.
Now they have bwferet() so look into that.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Visual Exploration finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!