1

ステレオカメラのセットアップを調整および修正するために、Python 2.7でOpenCV3.1を使用しています。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) スカラーも追加しましたが、すべての試行でエラーは同じままでした。

4

1 に答える 1

0

ドキュメントに記載されている使用法は間違っています。そのはず :

new_img = cv2.remap(src,
                    map1,
                    map2,
                    interpolation=cv2.INTER_<VALUE>)

Border モードは完全にオプションであり、borderValue も同様です。

于 2016-02-13T16:37:59.643 に答える