MATLAB Answers

Find the orientation of the skeletonized image

8 views (last 30 days)
Zeynab Mousavikhamene
Zeynab Mousavikhamene on 16 Jan 2020
Edited: Matt J on 17 Jan 2020
Is there any command that can find the orientation of skeletonized image? like the attached image that average angle of lines with respect to horizontal line.
Capture.JPG

  0 Comments

Sign in to comment.

Answers (2)

Matt J
Matt J on 16 Jan 2020
You can use houghlines to get the endpoints of all the line segments in the image. From that, you can easily calculate their slopes.

  2 Comments

Matt J
Matt J on 17 Jan 2020
Can you explain bit more?
Once you have the end points (x1,y1) and (x2,y2) of a line, you can calculate its angle according to,
angle = atan2d(y2-y1,x2-x1)

Sign in to comment.


darova
darova on 16 Jan 2020
You can write your own function:
  • use imline to create a line
  • draw a line aligned with horizontal/vertical one
  • calculate the angle
  • rotate image

  1 Comment

Zeynab Mousavikhamene
Zeynab Mousavikhamene on 16 Jan 2020
@darova
What you mean by creating the line? I already have the line and want to find the angle of all lines in the above image.

Sign in to comment.

Sign in to answer this question.