简体   繁体   中英

OpenCV findHomography errors

I'm using the SURF feature detection of OpenCV to compare two images. When I choose two identical images (sometimes the same image chosen), I get this:

 OpenCV Error: Assertion failed (CV_IS_MAT(imagePoints) && CV_IS_MAT(objectPoints)) in cvFindHomography, file /home/OpenCV/OpenCV-2.4.3/modules/calib3d/src/fundam.cpp, line 232 
Qt has caught an exception thrown from an event handler. Throwing 
exceptions from an event handler is not supported in Qt. You must 
reimplement QApplication::notify() and catch all exceptions there. 

terminate called after throwing an instance of 'cv::Exception' 
what(): /home/OpenCV/OpenCV-2.4.3/modules/calib3d/src/fundam.cpp:232: error: (-215) CV_IS_MAT(imagePoints) && CV_IS_MAT(objectPoints) in function cvFindHomography 

Le programme s'est terminé subitement

A second execution of the code with two different images says that:

what(): /home/OpenCV/OpenCV-2.4.3/modules/calib3d/src/fundam.cpp:235: error: (-215) count >= 4 in function cvFindHomography

I repeated the execution many times with differente images every time, and some test gave me the desired result.

It looks like you don't have enough amount of points to calculate a homography. You need at least 4 points to do this and the amount of points you match needs to be equal ( imagePoints and objectPoints ). See the reference for an explanation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM