Ask Your Question
3

feature 2d: Feature Matching fails with assert (stat.cpp)

asked 2013-03-25 08:58:48 -0600

yougo gravatar image

Hello,

I have tried to use all combinations of feature detectors, extractors and matchers. I have found that certain combinations are not allowed. These are detected and an exception thrown during runt-time. However certain combinations generate this error:

OpenCV Error: Assertion failed ((type == CV_8U && dtype == CV_32S) || dtype == CV_32F) in batchDistance, file /home/hugof/projects/recommender/opencv2.4/opencv-2.4.4/modules/core/src/stat.cpp, line 1810 terminate called after throwing an instance of 'cv::Exception' what(): /home/hugof/projects/recommender/opencv2.4/opencv-2.4.4/modules/core/src/stat.cpp:1810: error: (-215) (type == CV_8U && dtype == CV_32S) || dtype == CV_32F in function batchDistance

Of the total 1650 combinations, 169 fail with this exception (other exceptions occur in with other combinations also). My question is: is this solvable? If so, how may I solve it? (Images are loaded and converted to grey scale 8UC3).

I can make the source code available (test images are in the examples, matching_to_many_images/query.png and train*.png) but basically I copied an example in the tutorials. As an example I show some combinations that fail (see end of message, -d descriptor type, -e extractor, -m for the matcher). I can also send a text file with all 169 combinations.

Appreciate any help.

TIA, Hugo F.

option -d : GridSURF option -e : SURF option -m : BruteForce-Hamming(2)

option -d : GridSURF option -e : SURF option -m : BruteForce-Hamming

option -d : GridSURF option -e : OpponentSURF option -m : BruteForce-Hamming(2)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
7

answered 2013-03-25 09:13:32 -0600

Guanta gravatar image

Since SIFT and SURF return a detectorType() of CV32F (=float) you cannot use any Hamming-distance as matcher. Hamming-distance works only for binary feature-types like ORB, FREAK, ... I guess it would be possible if you'd convert them to CV8U. Afaik for SIFT this should be fairly easy since they are actually already normalized for the range 0-255 (double check that before you do it). However, I doubt that this is useful at all, use L2 norm for those and you should be fine.

edit flag offensive delete link more

Comments

@Guranta, Thanks for the explanation. I am new to this so I won't risk experimenting with changes.
I will do as you suggested an stick to L2 (BruteForce and FlannBased).

BTW, is that "FREAK" a typo?

yougo gravatar imageyougo ( 2013-03-25 11:44:48 -0600 )edit

You are welcome! No FREAK is a real descriptor, see http://docs.opencv.org/modules/features2d/doc/feature_detection_and_description.html?highlight=freak#FREAK . By the way, you can get the feature-type (like CV32F) of each descriptor with the function descriptorType().

Guanta gravatar imageGuanta ( 2013-03-25 14:51:23 -0600 )edit

I see. I had obtained the list of possible descriptors from: http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html No FREAK is listed. Going to see if the "common interfaces of feature detectors" also accepts this one. Thanks again.

yougo gravatar imageyougo ( 2013-03-26 05:46:18 -0600 )edit

Question Tools

Stats

Asked: 2013-03-25 08:58:48 -0600

Seen: 15,050 times

Last updated: Mar 25 '13