1 year ago

#138716

test-img

Francois

using cv2.norm based on cv2.fisheye.projectPoints causes (-215:Assertion failed) _src1.sameSize(_src2) in function 'norm'

Hi I'm working on a camera calibration code (relatively standard I'd say), now when running this code:

for i in range(num_images):
    number_of_points=len(objpoints[i][0])
    if not fisheye:
      imgpoints2, _ = cv2.projectPoints(objpoints[i], rvecs[i], tvecs[i], mtx, dist)
    else:
      imgpoints2, _=cv2.fisheye.projectPoints(objpoints[i], rvecs[i], tvecs[i], K, D)
    error = cv2.norm(imgpoints[i], imgpoints2, cv2.NORM_L2)
    err_im[i]=np.sqrt(error/number_of_points)
    total_error += np.sqrt(error/number_of_points)
    gem_fout=np.sqrt(error/number_of_points)
    print(f'RMSE for frame nr {i} is {np.sqrt(error/number_of_points)} pixels')

which runs smoothly when fisheye=False, when however using the results for the fisheye calibration I get an error in the cv2.norm:

  error = cv2.norm(imgpoints[i], imgpoints2, cv2.NORM_L2)
cv2.error: OpenCV(4.5.5) /Users/runner/work/opencv-python/opencv-python/opencv/modules/core/src/norm.cpp:1082: error: (-215:Assertion failed) _src1.sameSize(_src2) in function 'norm'

What puzzles me is that apparently the size of the result in cv2.projectPoints differs from that obtained from cv2.fisheye.projectPoints

Any idea how this can be solved (I'm new to python, so most likely I made some basic error.) (Python version 3.7, cv2 4.5.5 running on macOS Monterey version 12.1)

Thanks in advance

Francois

python

numpy

opencv

fisheye

0 Answers

Your Answer

Accepted video resources