校准摄像机和stereoCalibrate的正确“objpoints”应该是什么?

问题描述 投票:0回答:1

我有一台立体相机,我需要做内在和外在的校准。虽然重投影误差似乎很好(<0.1像素),但外在因素很奇怪。左右相机之间的转换太小。

我跟着这个tutorial用于两个摄像头的内在函数,然后使用stereoCalibrate作为外​​在函数。

# 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 mm appart?

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

非常感谢。

python opencv computer-vision camera-calibration
1个回答
0
投票

我找到了答案。

对于内在校准,如果我不提供角之间的正确距离并不重要。

但是,对于extrinsics(立体声)校准,我必须提供正确的值,否则比例将是错误的,并且转换将是小的。

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

© www.soinside.com 2019 - 2024. All rights reserved.