Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtain Line Profiles for Rotated Rectangle ROI

Folks -

 

On a related note to prior posts, I am looking for a way to extract the individual line profiles of a rotated rectangular region.  I cannot rotate the rectangle back to zero because image interpolation causes a degradation in the image.   So I need to work with the image as is.  I can measure the angle with Vision functionality.

 

The image below shows an extracted rotated rectangular region (angle of rotation of rotated rectangle is as shown in the gray region) with an example of the line I need to extract shown in red.  I need all of the line profiles inside the region, without first rotating the image back to 0 deg. Let me know if you have any creative ideas. Thank you.

 

rotated_rectangle_extraction.png

 

Don 

0 Kudos
Message 1 of 4
(4,528 Views)

The IMAQ Rake function should give you the line profiles you need.  Otherwise you could just step through the end coordinates and use Line Profile.

 

No matter what, you are going to end up with interpolation issues.  Even though you aren't rotating the image, you are interpolating to get the pixel values on a diagonal line.  You end up either going with nearest neighbor on the pixel coordinates, or you interpolate the values of adjacent pixels for each point on the line.  If you need a lot of lines, you are probably better off rotating the image, then extracting the lines.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 2 of 4
(4,520 Views)

Bruce -

 

Thanks for your reply.  My current strategy has been to do the rotation and am hoping to change it because I know the answer is not accurate.  You are giving me some good ideas.  I have used the rake function before and will investigate it for this application.  I think it might allow sub-pixel resolution since the results are returned as floats.  This might help in terms of the interpolation issue.

 

In terms of getting the end coordinates on the rotated rectangle, I am assuming this can be done using IMAQROIProfile - I don't think you can get the information from the global rectangle coordinates or points of the ROI.

 

Don

0 Kudos
Message 3 of 4
(4,496 Views)

Bruce -

 

The rake function works well in this capacity.  I am able to use the start and end points that are sub-outputs in the search lines output to obtain slope and intercept for each search line.  This allows me to determine Y at every X location, and then from that X,Y index out the gray scale information from the image along each line (i.e obtain the line profile for the line).

 

Thanks for that suggestion.

 

Sincerely,

 

Don

0 Kudos
Message 4 of 4
(4,472 Views)