vardanagarwal / Proctoring-AI

Creating a software for automatic monitoring in online proctoring
MIT License
540 stars 329 forks source link

cv2.solvepnp undistort error #60

Closed joelpou closed 4 months ago

joelpou commented 3 years ago

Hello,

I'm getting the following error whenever I try to run head_pose_estimation.py code:

line 167, in <module>
    (success, rotation_vector, translation_vector) = cv2.solvePnP(model_points, image_points, camera_matrix, dist_coeffs, flags=cv2.SOLVEPNP_UPNP)
cv2.error: OpenCV(4.0.1) C:\ci\opencv-suite_1573470242804\work\modules\calib3d\src\undistort.cpp:387: error: (-215:Assertion failed) CV_IS_MAT(_src) && CV_IS_MAT(_dst) && (_src->rows == 1 || _src->cols == 1) && (_dst->rows == 1 || _dst->cols == 1) && _src->cols + _src->rows - 1 == _dst->rows + _dst->cols - 1 && (CV_MAT_TYPE(_src->type) == CV_32FC2 || CV_MAT_TYPE(_src->type) == CV_64FC2) && (CV_MAT_TYPE(_dst->type) == CV_32FC2 || CV_MAT_TYPE(_dst->type) == CV_64FC2) in function 'cvUndistortPointsInternal'

There is still an issue opened here regarding updating opencv doc with this numpy array slice requirement which it seems is the culprit. Is there another way to avoid getting this error? Any help is appreciated.