Effacer les filtres
Effacer les filtres

How do I draw a line along the major axis as found with regionprops

14 vues (au cours des 30 derniers jours)
Mahalakshmi
Mahalakshmi le 29 Juin 2011
Commenté : Image Analyst le 30 Oct 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?

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Juin 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 commentaires
Abhinav Agarwal
Abhinav Agarwal le 29 Oct 2021
What is delta x and delta y?
Image Analyst
Image Analyst le 30 Oct 2021
It's the width of the bounding box.
Now they have bwferet() so look into that.

Connectez-vous pour commenter.

Plus de réponses (1)

Doug Hull
Doug Hull le 29 Juin 2011

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by