Skip to content

Python fisheye.stereoCalibrate: Assertion failed objectPoints.type() #11085

@philipptrenz

Description

@philipptrenz
System information
  • opencv-python '3.4.0.12' (installed via pip)
  • opencv-contrib-python '3.4.0.12' (installed via pip)
  • Windows 64 Bit
  • Python 3.6.4 :: Anaconda, Inc.
Detailed description

While cv2.fisheye.calibrate() works with both versions of objp as intented, cv2.fisheye.stereoCalibrate() throws errors. Curiously different ones, in function cv::internal::projectPoints and in function cv::fisheye::stereoCalibrate.

This could be related to #5534

Steps to reproduce

Case 1

objp = np.zeros((1, CHECKERBOARD[0]*CHECKERBOARD[1], 3), np.float32)
objp[0,:,:2] = np.mgrid[0:CHECKERBOARD[0], 0:CHECKERBOARD[1]].T.reshape(-1, 2)
...

K_left = np.zeros((3, 3))
D_left = np.zeros((4, 1))

K_right = np.zeros((3, 3))
D_right = np.zeros((4, 1))

R = np.zeros((1, 1, 3), dtype=np.float64)
T = np.zeros((1, 1, 3), dtype=np.float64)

rms, _, _, _, _, _, _ = \
        cv2.fisheye.stereoCalibrate(
            [objp]*len(imgpoints_left),
            imgpoints_left,
            imgpoints_right,
            K_left,
            D_left,
            K_right,
            D_right,
            (1280,800),
            R,
            T,
            flags,
            (cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-6)
        )
OpenCV Error: Assertion failed (!objectPoints.empty() && objectPoints.type() == (((6) & ((1 << 3) - 1)) + (((3)-1) << 3))) in cv::internal::projectPoints, file C:\projects\opencv-python\opencv\modules\calib3d\src\fisheye.cpp, line 1168
Traceback (most recent call last):
  File "C:/Users/treph/pycamdriver/stereo_calibration.py", line 239, in <module>
    calibrate(reader, cam_ids, CHECKERBOARD, SQUARE_SIZE)
  File "C:/Users/treph/pycamdriver/stereo_calibration.py", line 206, in calibrate
    (cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-6)
cv2.error: C:\projects\opencv-python\opencv\modules\calib3d\src\fisheye.cpp:1168: error: (-215) !objectPoints.empty() && objectPoints.type() == (((6) & ((1 << 3) - 1)) + (((3)-1) << 3)) in function cv::internal::projectPoints

Case 2

objp = np.zeros((CHECKERBOARD[0]*CHECKERBOARD[1],3), np.float32)
objp[:,:2] = np.mgrid[0:CHECKERBOARD[0],0:CHECKERBOARD[1]].T.reshape(-1,2)
OpenCV Error: Assertion failed (objectPoints.type() == (((5) & ((1 << 3) - 1)) + (((3)-1) << 3)) || objectPoints.type() == (((6) & ((1 << 3) - 1)) + (((3)-1) << 3))) in cv::fisheye::stereoCalibrate, file C:\projects\opencv-python\opencv\modules\calib3d\src\fisheye.cpp, line 844
Traceback (most recent call last):
  File "C:/Users/treph/pycamdriver/stereo_calibration.py", line 239, in <module>
    calibrate(reader, cam_ids, CHECKERBOARD, SQUARE_SIZE)
  File "C:/Users/treph/pycamdriver/stereo_calibration.py", line 206, in calibrate
    (cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-6)
cv2.error: C:\projects\opencv-python\opencv\modules\calib3d\src\fisheye.cpp:844: error: (-215) objectPoints.type() == (((5) & ((1 << 3) - 1)) + (((3)-1) << 3)) || objectPoints.type() == (((6) & ((1 << 3) - 1)) + (((3)-1) << 3)) in function cv::fisheye::stereoCalibrate

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions