Clear Filters
Clear Filters

Object orientation calculation in image

2 views (last 30 days)
itai
itai on 19 Mar 2017
Commented: itai on 20 Mar 2017
Hi,
I have an image which include a rectangular (I have attached the image)
and I would like to calculate the orientation angle of this rectangular relative to the x and y axes. I tried to use in 'Orientation' in "regionprops" command, but the result wasn't the correct angle relative to the x and y axes.
1. How can I recognize automatically only the rectangular ?
2. How can I calculate the angle between the rectangular and the axes?
Thanks, Itai

Answers (1)

Image Analyst
Image Analyst on 19 Mar 2017
First of all, can you get a better image, like with no clutter outside the rectangle and a contrasting background, not one that gets about as dark as the rectangle itself?
I'd start out by trying an edge detector like imgradient() or a texture filter like stdfilt(). Then use hough() or houghlines().
Since the camera axes were setup somewhat arbitrarily, why is it so important to get the angle of the rectangular block with respect to the edges of the image?
  1 Comment
itai
itai on 20 Mar 2017
Hi, first, thanks for your response. My goal is to match between the cross section image of a crystal (the rectangular I attached) and the cross section image of a fiber optic, therefor I should find out the angle of each of them relative to the axes. These components are very small and I can't get any better pictures now. What you recommend using to detect the object and the angle to the axes, when I prefer to use as few morphological operations as possible in order to not change the real angle.
Please advice, Itai

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!