node-opencv
node-opencv copied to clipboard
[FIX] ImageSimilarity / OpenCV Error: Assertion failed...
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.
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.
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
Could you return an error when the types are different, rather than just a null?
@TanaseButcaru Thank you for fixing this! :cake: Greetings from Bihor. :joy:
@IonicaBizau you're welcome! @peterbraden I'll try to change it to return an error these days, sorry for late response :)
@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
@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.