Python OpenCV&;3D重建:为什么来自InitUnderTortyMap()的map1有维度(x,y,2)?
上下文 根据OpenCV文档,我正在玩立体视觉。我已经完成了Python OpenCV&;3D重建:为什么来自InitUnderTortyMap()的map1有维度(x,y,2)?,python,opencv,stereo-3d,3d-reconstruction,Python,Opencv,Stereo 3d,3d Reconstruction,上下文 根据OpenCV文档,我正在玩立体视觉。我已经完成了stereorective()之前的所有工作。我找到了信息,下一步是从initunorticrectitymap()获取贴图,然后用我将要处理的图像重新映射它们 问题 retL, mtxL, distL, rvecsL, tvecsL = cv2.calibrateCamera(objpoints, imgpointsL, grayL.shape[::-1], None, None) retR, mtxR, distR, rvecsR,
stereorective()
之前的所有工作。我找到了信息,下一步是从initunorticrectitymap()
获取贴图,然后用我将要处理的图像重新映射它们
问题
retL, mtxL, distL, rvecsL, tvecsL = cv2.calibrateCamera(objpoints, imgpointsL, grayL.shape[::-1], None, None)
retR, mtxR, distR, rvecsR, tvecsR = cv2.calibrateCamera(objpoints, imgpointsR, grayR.shape[::-1], None, None)
retval, camMat1, dCoeffs1, camMat2, dCoeffs2, R, T, E, F = cv2.stereoCalibrate(objpoints, imgpointsL, imgpointsR,
mtxL, distL, mtxR, distR,
grayL.shape[::-1], flags=cv2.CALIB_FIX_INTRINSIC)
R1, R2, P1, P2, Q, roi1, roi2 = cv2.stereoRectify(camMat1, dCoeffs1, camMat2, dCoeffs2, grayL.shape[::-1], R, T)
map1, map2 = cv2.initUndistortRectifyMap(camMat1, dCoeffs1, R, P1, (360, 640), cv2.CV_16SC2)
我不知道为什么initunorticrectitymap()
会返回大小类似(y,x,2)的map1,在我的例子中,x和y是img维度(x=360,y=640)。map2是(y,x),看起来很好
代码
retL, mtxL, distL, rvecsL, tvecsL = cv2.calibrateCamera(objpoints, imgpointsL, grayL.shape[::-1], None, None)
retR, mtxR, distR, rvecsR, tvecsR = cv2.calibrateCamera(objpoints, imgpointsR, grayR.shape[::-1], None, None)
retval, camMat1, dCoeffs1, camMat2, dCoeffs2, R, T, E, F = cv2.stereoCalibrate(objpoints, imgpointsL, imgpointsR,
mtxL, distL, mtxR, distR,
grayL.shape[::-1], flags=cv2.CALIB_FIX_INTRINSIC)
R1, R2, P1, P2, Q, roi1, roi2 = cv2.stereoRectify(camMat1, dCoeffs1, camMat2, dCoeffs2, grayL.shape[::-1], R, T)
map1, map2 = cv2.initUndistortRectifyMap(camMat1, dCoeffs1, R, P1, (360, 640), cv2.CV_16SC2)