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

[FIX] ImageSimilarity / OpenCV Error: Assertion failed... #381

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

tanasebutcaru
Copy link

I'm using opencv to find image similarities and I was getting the following error:

OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)
) in batchDistance, file /build/opencv/src/opencv-2.4.12.3/modules/core/src/stat.cpp, line 2481
terminate called recursively
Aborted (core dumped)

This PR solves the error.
Got the fix hints from here.
I don't know if the way I'm handling the case when descriptors do not match is ok or not, but it works. I'm not a C++ dev.

@tanasebutcaru tanasebutcaru changed the title [FIX] OpenCV Error: Assertion failed... [FIX] ImageSimilarity / OpenCV Error: Assertion failed... Feb 29, 2016
sync to upstream/master 20160409
[20160421] sync to upstream/master
[20160423] sync to upstream/master
@saibabanadh
Copy link

I am new to OpenCV, when comparing two images using node-opencv, Iam getting the below error

OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /build/buildd/opencv-2.4.8+dfsg1/modules/core/src/stat.cpp, line 2473
terminate called after throwing an instance of 'cv::Exception'
what(): /build/buildd/opencv-2.4.8+dfsg1/modules/core/src/stat.cpp:2473: error: (-215) type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U) in function batchDistance

Please help me out to get rid of this issue.

@tanasebutcaru
Copy link
Author

You can try to apply the fix yourself or you can try to install my repo here.
First, uninstall the node-opencv and then npm install https://github.com/TanaseButcaru/node-opencv

@peterbraden
Copy link
Owner

Could you return an error when the types are different, rather than just a null?

@IonicaBizau
Copy link

@tanasebutcaru Thank you for fixing this! 🍰 Greetings from Bihor. 😂

@tanasebutcaru
Copy link
Author

@IonicaBizau you're welcome!
@peterbraden I'll try to change it to return an error these days, sorry for late response :)

@sapna-upreti
Copy link

@tanasebutcaru I'm not able to run this dissimilarity example as I'm getting this "TODO: Please port Features2d.cc to OpenCV 3", could you please help me do this?

PS: I'm new to this opencv

@tanasebutcaru
Copy link
Author

@NodeXperts16 I haven't used this feature with OpenCV 3 and currently I'm not working with OpenCV.
It seems that what you're trying to do is not compatible with OpenCV 3.

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

Successfully merging this pull request may close these issues.

5 participants