Reputation: 549
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.
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?
Upvotes: 0
Views: 7623
Reputation: 1
You can get the actual size of the object you are looking at with the ruler, then multiply the number of pixels of the object you are picturing in a number that is the same as the actual size And because the camera is calibrated, the odds you find are right for everyone.
Upvotes: 0
Reputation: 431
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:
Upvotes: 3