필터 지우기
필터 지우기

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

조회 수: 14 (최근 30일)
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?

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Doug Hull
Doug Hull 2011년 6월 29일

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by