ORB example fails [closed]
Hello, I am working through the examples in chapter 8 of the book Practical OpenCV by Samarth Brahmbhatt.
I'm running example 8.4, copied from their included source code:
vector<KeyPoint> train_kp;
Mat train_desc;
OrbFeatureDetector featureDetector;
featureDetector.detect(train_g, train_kp);
cout << "Key Point size" << train_kp.size() << endl;
OrbDescriptorExtractor featureExtractor;
featureExtractor.compute(train_g, train_kp, train_desc);
cout << "Descriptor depth " << train_desc.depth() << endl;
flann::Index flannIndex(train_desc, flann::LshIndexParams(12, 20, 2), cvflann::FLANN_DIST_HAMMING);
For train_kp.size(), I get 496. For train_descr.depth(), I get 0.
When executing I get an exception at the line, flann:: ...
I'm using their supplied image. I'm running on Windows compiling with Visual Studio 2012, while I believe they wrote and tested their code running on Linux. I have successfully run previous examples in the book.
I'm guessing that the 0 descriptors is at the heart of the problem and causes the exception at flann::.
Does anyone know why I'm getting this error? Is the problem, in fact, 0 descriptors?
Thanks, Barry.
"For train_descr.depth(), I get 0." - well, that should be correct, ORB descriptors are uchar, CV_8U.
did you confuse depth() and size() there ?
what exception do you get exactly ?
Thanks for your response. Yes, I was thinking that depth for a Mat was the same as size for a vector. I am very new to C++, I'll have to dig through some docs. I upgraded from OpenCV 2.4.10 to 2.4.11. The example now works as expected. Thanks.