node-opencv icon indicating copy to clipboard operation
node-opencv copied to clipboard

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

Open tanasebutcaru opened this issue 9 years ago • 7 comments

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 avatar Feb 29 '16 09:02 tanasebutcaru

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.

saibabanadh avatar Apr 26 '16 13:04 saibabanadh

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

tanasebutcaru avatar Apr 26 '16 13:04 tanasebutcaru

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

peterbraden avatar May 03 '16 13:05 peterbraden

@TanaseButcaru Thank you for fixing this! :cake: Greetings from Bihor. :joy:

IonicaBizau avatar Oct 17 '16 17:10 IonicaBizau

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

tanasebutcaru avatar Oct 18 '16 06:10 tanasebutcaru

@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

sapna-upreti avatar Sep 11 '17 08:09 sapna-upreti

@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.

tanasebutcaru avatar Sep 25 '17 18:09 tanasebutcaru