Ask Your Question
0

ORB::detectAndCompute Debug Assertion Failed (5 code lines)

asked 2017-01-06 06:10:32 -0600

deshan gravatar image

updated 2017-01-06 10:23:33 -0600

Hi All,

I am trying to implement a simple keypoint detector. When calling detectAndCompute it gives me Debug assertion fail error. I am on windows 10 + Opencv 3.0. Same code works in Android + Opencv 3.0

Pls help. Following is my code.

cv::Ptr<cv::Feature2D> keypointDetector  = cv::ORB::create(750);

cv::Mat cvImage = cv::imread("a.jpg", CV_LOAD_IMAGE_GRAYSCALE);

std::vector<cv::KeyPoint> keypoints;
cv::Mat descriptors;

keypointDetector->detectAndCompute(cvImage, cv::noArray(), keypoints, descriptors); // fail here
edit retag flag offensive close merge delete

Comments

please add exact error msg.

also, check cvImage.empty() after imread() (that's probably the cause)

berak gravatar imageberak ( 2017-01-06 06:14:43 -0600 )edit
1

Thanks berak, I have checked. Image is ok.

Another thing is I am using Visual studio 2015 but using OpenCV3.0 precomplied libs of VC12. (OpenCV3.0\opencv\build\x86\vc12\lib) can it be the issue? Because AKAZE and ORB planar tracking opencv example gives me the same error http://docs.opencv.org/3.1.0/dc/d16/t...

deshan gravatar imagedeshan ( 2017-01-06 07:38:32 -0600 )edit

.. you forgot the error msg ..

berak gravatar imageberak ( 2017-01-06 08:11:06 -0600 )edit

It's _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) screen shot added to original message

deshan gravatar imagedeshan ( 2017-01-06 10:16:09 -0600 )edit
1

ok. buffer overflow, UB.

unfortunately, noone cares about 3.0 anymore, so the proper thing would be: update to 3.2 (or github master branch, even), try to replicate the situation, if it still crashes, file official bugreport.

berak gravatar imageberak ( 2017-01-06 10:20:06 -0600 )edit

Thanks Berek, seems i should do this. NEW: When I run the exe outside visual studio no problem, do not know why

deshan gravatar imagedeshan ( 2017-01-06 10:25:17 -0600 )edit
1

ohhh, missed it - ofc. you cannot use vs2015 with vc12 libs !

please use the vc14 ones (if they are there)

berak gravatar imageberak ( 2017-01-06 10:27:24 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-01-06 12:32:35 -0600

deshan gravatar image

That was the reason, i built opencv 3.0 with vs 2015 and everything ok now. Thanks berak

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-06 06:10:32 -0600

Seen: 1,226 times

Last updated: Jan 06 '17