我正在使用 OpenCV3.1 和 python 2.7 来校准和纠正立体相机设置。当我尝试使用 cv2.remap() 将校正和不失真矩阵应用于图像时,出现以下错误:
Traceback (most recent call last):
File "C:\University\Year3\Third Year Project - Gaze Correction\EclipseWorkspace\PythonTest\videoCap.py", line 36, in <module>
stereoCalib.rectify(frames)
File "C:\University\Year3\Third Year Project - Gaze Correction\EclipseWorkspace\PythonTest\Calibrator.py", line 137, in rectify
borderMode=cv2.BORDER_CONSTANT )
TypeError: an integer is required
我的代码是这样的:
new_frames = []
new_img=[]
for i, side in enumerate(("left", "right")):
new_img = cv2.remap(frames[i],
new_img,
self.undistortion_map[side],
self.rectification_map[side],
cv2.INTER_CUBIC,
borderMode=cv2.BORDER_CONSTANT )
new_frames.append(new_img)
我尝试将 INTER_CUBIC 和 BORDER_CONSTANT 设置为 int(1) 和 int(0) 可互换。我还在最后添加了 np.zeros(3) 标量,但在我所有的尝试中错误都保持不变。