Search code examples
c++opencvmeasurement

Measuring size of object with OpenCV


I have calibrated camera and undistorted image, object on image is binarized and only contours are shown. Then I use rectangle to get the dimension of the object -> I have distance in pixels. The camera has fixed position and after calibration the distance from object is fixed too.

highlither

Size of the red rectangle ~ 81×630 pixels.

Is there any way to transform pixels to millimeters using only OpenCV calibration or should I measure pixel size of object with known dimension?


Solution

  • You can take a capture of a caliper with the same camera options. Then, you might match the distance with the pixel count. Then, you could compute the corresponding distance of your object pixels in your image using your matching.

    Sample caliper image:

    enter image description here