Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python OpenCV&;3D重建:为什么来自InitUnderTortyMap()的map1有维度(x,y,2)?_Python_Opencv_Stereo 3d_3d Reconstruction - Fatal编程技术网

Python OpenCV&;3D重建:为什么来自InitUnderTortyMap()的map1有维度(x,y,2)?

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,

上下文

根据OpenCV文档,我正在玩立体视觉。我已经完成了
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)