Skip to content Skip to sidebar Skip to footer

Camera Calibration With OpenCV - How To Adjust Chessboard Square Size?

I am working on a camera calibration program using the OpenCV/Python example (from: OpenCV Tutorials) as a guidebook. Question: How do I tailor this example code to account for th

Solution 1:

Here, if you have your square size assume 30 mm then multiply this value with objp[:,:2]. Like this

objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,2)*30   # 30 mm size of square

As objp[:,:2] is a set of points of checkboard corners given as (0,0),(0,1), (0,2) ....(8,5). (0,0) point is the left upper most square corner and (8,5) is the right lowest square corner. In this case, these points have no unit but if we multiply these values with square size (for example 30 mm), then these will become (0,0),(0,30), .....(240,150) which are the real world units. Your translation vector will be in mm units in this case.


Solution 2:

From here: https://docs.opencv.org/4.5.1/dc/dbb/tutorial_py_calibration.html

What about the 3D points from real world space? Those images are taken from a static camera and chess boards are placed at different locations and orientations. So we need to know (X,Y,Z) values. But for simplicity, we can say chess board was kept stationary at XY plane, (so Z=0 always) and camera was moved accordingly. This consideration helps us to find only X,Y values. Now for X,Y values, we can simply pass the points as (0,0), (1,0), (2,0), ... which denotes the location of points. In this case, the results we get will be in the scale of size of chess board square. But if we know the square size, (say 30 mm), we can pass the values as (0,0), (30,0), (60,0), ... . Thus, we get the results in mm. (In this case, we don't know square size since we didn't take those images, so we pass in terms of square size).


Post a Comment for "Camera Calibration With OpenCV - How To Adjust Chessboard Square Size?"