calibrateCamera和stereoCalibrate的正确“目标点”应该是什么?

2024-06-16 13:07:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个立体相机,我需要做内部和外部校准。尽管重投影错误看起来很正常(<;0.1像素),外部变量为奇数。左右摄像头之间的平移太小

我遵循这个tutorial对两个相机的内在特性进行分析,然后对外在特性进行立体校准

# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(8,6,0)
objp = np.zeros((9*7,3), np.float32)
objp[:,:2] = np.mgrid[0:9,0:7].T.reshape(-1,2)
objpoints2 = []
imgpoints2 = []

# Load images
images = glob.glob('*.tiff')
for fname in images:
    img = cv2.imread(fname)
    # Find the chess board corners
    ret, corners = cv2.findCirclesGrid(img, (9,7), flags=cv2.CALIB_CB_SYMMETRIC_GRID, blobDetector=detector)
    # If found, add object points, image points (after refining them)
    if ret:
        objpoints2.append(objp)
        imgpoints2.append(corners)
        # Draw and display the corners
        img = cv2.drawChessboardCorners(img, (9,7), corners, ret)
        cv2.imshow('img', img)
        cv2.waitKey(50)
cv2.destroyAllWindows()
matrix2, distort2 = cv2.calibrateCamera(objpoints2, imgpoints2, (640,480), None, None)

然后我进行立体声校准:

R, T = cv2.stereoCalibrate(objpoints2, imgpoints1, imgpoints2, matrix1, distort1, matrix2, distort2, (640,480))

我的问题是objp的正确值应该是多少?我使用了教程中的值,但这是否意味着我的模式是1毫米

objp[:,:2] = np.mgrid[0:9,0:7].T.reshape(-1,2)

非常感谢


Tags: imgobjectnp特性cv2points校准images
1条回答
网友
1楼 · 发布于 2024-06-16 13:07:13

我找到了答案

对于内部校准,如果我没有提供正确的拐角之间的距离,这并不重要

但是,对于外部(立体声)校准,我必须提供正确的值,否则比例将是错误的,平移将很小

或者,我需要将实际的模式距离乘以最终的平移向量,以获得正确的比例

相关问题 更多 >