Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cv2.findEssentialMat() Error with 2 cameraMatrix #960

Open
MikeBrownse opened this issue Mar 5, 2024 · 2 comments
Open

cv2.findEssentialMat() Error with 2 cameraMatrix #960

MikeBrownse opened this issue Mar 5, 2024 · 2 comments

Comments

@MikeBrownse
Copy link

Hello, there shows an error when I use function 'cv2.findEssentialMat()'.

I want to calculate the essential matrix between images taken by two cameras with different camera matrix , so I wrote my code as follows:

e, mask = cv2.findEssentialMat(points1=pts1, points2=pts2, cameraMatrix1=k1, distCoeffs1=dist1, cameraMatrix2=k2, distCoeffs2=dist2, method=cv2.RANSAC, prob=0.999, threshold=1.0)

but I got an '-215:Assertion failed' error:

cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\calib3d\src\undistort.dispatch.cpp:592: error: (-215:Assertion failed) npoints >= 0 && src.isContinuous() && (depth == CV_32F || depth == CV_64F) in function 'cv::undistortPoints'

Oddly enough, the D drive does not exist in my computer.

Other information (versions):

  • conda 23.7.4 (Anaconda)
  • python 3.9.7
  • opencv-python 4.9.0.80

Did I pass in the wrong parameters or is this due to something else?

It's been bothering me for a long time. Looking forward to a reply... TAT

@coolashishpt
Copy link

coolashishpt commented Mar 13, 2024

may be this error you are getting because of incorrect use of arguments in the cv2.findEssentialMat() function

try this :

e, mask = cv2.findEssentialMat(pts1, pts2, k1, method=cv2.RANSAC, prob=0.999, threshold=1.0)

else : refer this https://stackoverflow.com/questions/54734538/opencv-assertion-failed-215assertion-failed-npoints-0-depth-cv-32

@MikeBrownse
Copy link
Author

Thank you for your reply. I checked the documentation about this function and the two Points passed in need to be first normalized according to the CameraMatrix in order to use this function.
OpenCV: Camera Calibration and 3D Reconstruction

But what still puzzles me is that if this is the case, why provide the usage of including two CameraMatrix, which I misinterpreted to mean that it is possible to pass in two different CameraMatrix.

may be this error you are getting because of incorrect use of arguments in the cv2.findEssentialMat() function

try this :

e, mask = cv2.findEssentialMat(pts1, pts2, k1, method=cv2.RANSAC, prob=0.999, threshold=1.0)

else : refer this https://stackoverflow.com/questions/54734538/opencv-assertion-failed-215assertion-failed-npoints-0-depth-cv-32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants