What quality can I expect to reach with shape measurement?

asked 2018-11-05 17:11:10 -0500

stenci gravatar image

updated 2018-11-06 10:00:02 -0500

I am thinking of using OpenCV to find the position and size of a rectangular sheet placed on the table of a CNC router.

It would be something similar to what's described here, but with a larger table (3m x 3m), with two or three reference targets (instead of one dime) and with one rectangular shape (instead of a few pills or other objects).

If you tell me that sub-millimeter precision in the position of a 1m x 2m rectangle is impossible to reach, then I won't even try.

But if you tell me that there is a chance, please let me know what are the most critical part of such a system and I will give it a try.

EDIT (following the comment of David_86)

Assuming that I can move the camera, would it help more zooming in and panning so I can stitch together more images, so I have one larger/higher resolution image, or taking more photos from slightly different positions and orientations and then average the result?

My intuition says that the stitching process could introduce some error, while averaging several measurement should improve the quality, (but I don't trust my intuition, that's why I'm here.)

edit retag flag offensive close merge delete


it depends on the resolution of your camera, the distance to the object, and the quality of your calibration.

so, impossible to say, without any specifics.

berak gravatar imageberak ( 2018-11-06 02:03:46 -0500 )edit

The most critical part is clearly your camera resolution. Assuming you're fine with a 0.5 mm precision (what do you mean by "sub-millimeter"?) a rough calculation gives you a camera resolution of at least 4000 pixel along the horizontal axis with that field of view. But it's going to be hard to rely just on a couple of pixels to indentify your object shape, since the transition between edges is usually smoother than that, so you're probably going to need even more pixels. That said your application to me doesn't look feasible with a fixed-camera setup. If you can manage to move the camera and take multiple overlapping shots along the table than you can really increase your resolution without going for super-expensive cameras and lenses, but just stitching images together.

David_86 gravatar imageDavid_86 ( 2018-11-06 06:07:43 -0500 )edit

@David_86 I added a few details based on your comment

stenci gravatar imagestenci ( 2018-11-06 10:50:52 -0500 )edit

As far as I know you can calibrate a camera for a fixed focal length, so once done you can't zoom (zooming means changing the focal length, that's one camera intrinsic parameter which affects calibration). Apart from that it is not clear to me how your application is expected to work, since you've started talking about 1x2 m field of view and now you're considering zooming. I don't think I can help you more than this without going deeper into your application specs (for the zooming/panning part you mentioned) but I'm quite sure your ideas are a little bit more clear now ;-)

David_86 gravatar imageDavid_86 ( 2018-11-12 16:20:42 -0500 )edit

@David_86 I'm sorry I used the wrong word. When I said "zoom in" I didn't mean using the zoom of the camera, I meant I will set up the camera support and the optics so that the field of view will be smaller, as if I were zooming in. For example, I could install the camera on a rail that moves above the table while taking photos, or I could install the camera higher (or at the same height with wider angle lens) and rotate it while taking the photos of the same area. In the first case I would get a number of photos to stitch = higher resolution, but with stitching error, in the second case I would get a number of photos with fewer pixels per inch, but I would repeat the measurement and get the average measurement. Which one would be best? What type of ...(more)

stenci gravatar imagestenci ( 2018-11-12 16:39:28 -0500 )edit

Why are you thinking about a stitching error? Stitching images can be very precise (near to pixel accuracy) if you manage to set proper reference markers that you'll only need once if your acquisition setup is constant. On the other side I would be more worried about the perspective occlusions on the object introduced by panning the camera (depending on the object height, but if you're going for sub-millimeter accuracy I think it is very likely to happen). It's impossible to say which strategy will be the best without any test and specific details about the target objects, but I would definitely go for the stitching process rather than having to face object occlusions.

David_86 gravatar imageDavid_86 ( 2018-11-13 17:09:09 -0500 )edit