Getting positions of two rectangles and calculate distance between them

Hi, i want to use the OpenMV cam to take one picture of a housing. In the housing itself is one rectangular opening (exact dimensions of this rectangular opening known). Next to this opening i want to print a rectangular shape with a laser (also known dimensions).
The idea is to get the positions of these two rectangulars and then to calculate the distance from printed rectangular to the rectangular opening. With this i could calibrate the laser to get “exact” positions for the next laser markings.

I already saw the “image.find_rects()” function and think this could work.

Would you say that i can use the OpenMV cam for this or should i watch out for other solutions ?

Best regards


Uh, well, this is just generally hard no matter what solution you use.

You’re going to have to solve camera calibration, robotics control, and a whole host of other things to do what you want.

I can’t say if the OpenMV Cam will be the right tool or not as what we offer is just a small part of the overall thing you need to build.

1 Like

Hi, thanks for your reply :smiley:

all the other stuff around is not the main problem for me, should be done easy if i can get the positions of the rectangles.

What i saw it should be possible so i will give it a try

Best regards :slight_smile:

Yes, our find_rects() method is very good if you have good enough contrast in the image.