如何在Android NDK中使用OpenCV BOWImgDescriptorExtractor
How to use OpenCV BOWImgDescriptorExtractor in Android NDK?
我有一个带有本地部分的Android应用程序。它将使用svm,所以我需要BOWImgDescriptorExtractor。我的问题是,我不能像在PC上使用bowDE.compute();
那样使用它。没有这个参数的Android实现:bowDe.compute(Mat& img, vector<KeyPoint>& keypoints, Mat& descriptors);
我必须使用以下方法:
void compute(const cv::Mat &, std::vector<cv::KeyPoint,std::allocator<cv::KeyPoint>> &, cv::Mat &, std::vector<std::vector<int,std::allocator<int>>,std::allocator<std::vector<int,std::allocator<int>>>> *, cv::Mat *)
我不知道怎么做。
当我将鼠标悬停在BOWImgDescriptorExtracotr上时,我可以看到类。在那里我可以看到方法声明,如下所示:
void compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& imgDescriptor,
vector<vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 );
// compute() is not constant because DescriptorMatcher::match is not constant
正如您所看到的,其他参数都有其默认值,但由于某种原因,我仍然会收到无效参数的错误。尽管它应该是的方法与类中给定的方法不同。。出于某种原因。。
我的代码如下:
Mat features;
vector<KeyPoint> keypoints;
detector->detect(matGray, keypoints);
KeyPointsFilter::retainBest(keypoints, 1500);
bowDE.compute(matGray, keypoints, features);
以下是尝试编译时的输出:
SVMDetector.cpp:45:45: error: no matching function for call to 'cv::BOWImgDescriptorExtractor::compute(cv::Mat&, std::vector<cv::KeyPoint>&, const cv::Mat&)'
SVMDetector.cpp:45:45: note: candidate is:
OpenCV-2.4.9-android-sdk/sdk/native/jni/include/opencv2/features2d/features2d.hpp:1592:10: note: void cv::BOWImgDescriptorExtractor::compute(const cv::Mat&, std::vector<cv::KeyPoint>&, cv::Mat&, std::vector<std::vector<int> >*, cv::Mat*)
OpenCV-2.4.9-android-sdk/sdk/native/jni/include/opencv2/features2d/features2d.hpp:1592:10: note: no known conversion for argument 3 from 'const cv::Mat' to 'cv::Mat&'
make: *** [/<some path>/local/armeabi-v7a/objs/svm_detector/SVMDetector.o] Error 1
你能举个例子或解释一下吗?提前感谢!
我认为IDE(Eclipse Luna)可能有问题。在我今天打开电脑并启动eclipse之后,没有出现任何错误。
相关文章:
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 如何使用OpenCV将RBG图像转换为HSV,并将H、S和V值保存为C++中的3个独立图像
- OpenCV EqualizeHist()从彩色图像创建黑白图像
- 将OpenCV C++重写为EmguCV C#-如何使用指针
- OpenCV C++.快速计算混淆矩阵
- 在C++代码中包含opencv时,使用ctypes创建.so文件
- 哪些库可以通过Opencv调整曝光率
- 安装opencv失败-粘贴CMakeError.log的内容
- C++中的openCV Mat访问冲突
- OpenCV Android C++ imwrite not found
- 未定义的引用 .. 使用 OpenCV 编译 C++ 代码时,从命令行
- 将 OpenCV 与 CMAKE 中的项目一起构建为第三方库的正确方法
- CV_OCL_RUN宏如何在OpenCV(版本3.4.5)的goodFeaturesToTrack实现中工作?
- OpenCV 4.1.2 - 从网络摄像头获取帧并将其拆分
- C++ OpenCV 卡尔曼滤波器构造函数错误
- 使用OpenCV和覆盆子上的多个网络摄像头拍摄延时摄影,出现多个V4L错误
- 如何使用OpenCV-C++编写*.mp4视频?
- Mingw-64 在构建和安装后不会编译 openCV 代码