How to print and verify that MatDescriptors are non-empty?? [closed]

asked 2013-02-07 07:58:10 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

For example, suppose I run following snippet

Mat descriptors;
std::cout << descriptors.empty << std::endl; // writes 0
extractor.compute( object, keypoints, descriptors );
std::cout << descriptors.empty << std::endl; //  writes 0

So, as you can see even after calling extractor.compute(), descriptors are empty. So, how can one figure out that compute() was called and processed successfully.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by SR
close date 2013-06-15 17:08:23.981699

Comments

descriptors are not vectors, they are of Mat-type. So I guess, your pointer won't suffice.

Abhinav gravatar imageAbhinav ( 2013-02-07 11:37:06 -0600 )edit

My fault. You are right. Check the docs for cv::Mat. It's as easy as reading the doc page.

sammy gravatar imagesammy ( 2013-02-07 13:01:28 -0600 )edit

You answered your question already (except that you code misses brackets after empty such as std::cout<<descriptors.empty()<<std::endl;. Why there are no descriptors is an entirely different question. You may have detected or specified no keypoints for example.

SR gravatar imageSR ( 2013-06-15 17:05:52 -0600 )edit