我有一个使用 BOW + SVM 方法进行对象检测的 Android 应用程序。我使用 DynamicSURF 进行特征检测,使用 OpponentSURF 进行描述符提取和 FlannBased 匹配器。我正在获取 RGBA 格式的帧,所以我将其转换为 BGR。
当我尝试计算特征时,问题就来了。给出以下错误:
03-08 23:31:07.965: E/cv::error()(1578): OpenCV Error: Unsupported format or combination of formats (type=16
03-08 23:31:07.965: E/cv::error()(1578): ) in void cv::flann::buildIndex_(void*&, const cv::Mat&, const cv::flann::IndexParams&, const Distance&) [with Distance = cvflann::L2<float>, IndexType = cvflann::Index<cvflann::L2<float> >], file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/flann/src/miniflann.cpp, line 315
这是我的代码:
Mat matBGR;
cvtColor(matRGBA, matBGR, CV_RGBA2BGR);
const Ptr<FeatureDetector> detector = FeatureDetector::create("DynamicSURF");
const Ptr<DescriptorExtractor> descriptors = DescriptorExtractor::create("OpponentSURF");
const Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("FlannBased");
BOWImgDescriptorExtractor bowDE(descriptors, matcher);
FileStorage fileStorage(dictionaryPathString + dictionaryNameString, FileStorage::READ);
Mat dictionary;
fileStorage["dictionary"] >> dictionary;
fileStorage.release();
bowDE.setVocabulary(dictionary);
Mat features;
vector<KeyPoint> keypoints;
detector->detect(matBGR, keypoints);
KeyPointsFilter::retainBest(keypoints, 1700);
bowDE.compute(matBGR, keypoints, features);
你知道是什么导致了这个问题吗?我搜索了解决方案,但没有找到解决方案。