Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How does "Find Straight Edge" find the edge if a rotated rectangle is presented?

I have an image with a rotated rectangle. I am wondering how "Find Straight Edge" works since if I set different ROIs, it gave me different results. Thank you very much for your help.
0 Kudos
Message 1 of 5
(3,453 Views)
Find Straight Edge uses a rake to locate the edge points. The number and location of points found depends on the rake parameters. Essentially, a rake is a series of parallel lines and the "Find Edge" routine is used for each line.

The final straight edge is found by doing a best fit through all the points found. Extreme outliers are eliminated to improve the fit.

Rotating, moving or resizing your ROI will change the location of the rake lines, which will potentially change the final result. You need to be careful when you select your ROI.

Bruce
Bruce Ammons
Ammons Engineering
Message 2 of 5
(3,453 Views)
Thank you very much for the prompt response, Bruce.

The image I used is a rectangle which is rotated 30 degrees anti-clockwise. I just used the 'Rectangle Tool' to set the ROI without rotating it. I choose the search direction as "Left to Right". Then sometimes I got the upper edge as the final result, sometimes I got the left edge as the result. I think sometimes the number of edge points found in the upper edge is similiar to that in the left edge. So I am wondering what rule the best fit is following to filter out the outliers which there is quite a few.

Thanks,
Iris
0 Kudos
Message 3 of 5
(3,453 Views)
It is helpful to know the approximate location and rotation of the edge you are looking for. In this case, I would use a rectangle ROI rotated 30 degrees to match the orientation of your object.

If you don't know the orientation of your object, another trick is to locate the long side first, which will show up with the most points if you try both horizontal and vertical search directions. Once you know the orientation of the long side, you can define an ROI 90 degrees from that angle to locate the short side.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 5
(3,453 Views)
Thanks a lot, Bruce. I will have a try.

Best regards,
Iris
0 Kudos
Message 5 of 5
(3,453 Views)