WODY_STD 2error itms 90032这个是...

[android]ndk 生成 error.opencv2/core/core.hpp: 没有这样的文件或目录
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.
我要使用 OpenCV 私有模块在 android 系统中的问题。我读此教程
但是,运行后 ndk 生成,它显示以下错误...
guru@guru-Aspire-5738:~/Android/OpenCVWorkspace/sift_opencv_android/jni$ ~/Android/android-ndk-r9/ndk-build
: libopencv_java.so =& libs/armeabi-v7a/libopencv_java.so
: libnonfree.so =& libs/armeabi-v7a/libnonfree.so
Compile++ thumb
: test_sift &= test_sift.cpp
/home/guru/Android/OpenCVWorkspace/sift_opencv_android/jni/test_sift.cpp:2:33: fatal error: opencv2/core/core.hpp: No such file or directory
compilation terminated.
make: ***[/home/guru/Android/OpenCVWorkspace/sift_opencv_android/obj/local/armeabi-v7a/objs/test_sift/test_sift.o] Error 1
这里是我的代码...
#include &iostream&
#include &opencv2/core/core.hpp&
#include &opencv2/highgui/highgui.hpp&
#include &opencv2/nonfree/features2d.hpp&
#include &opencv2/nonfree/nonfree.hpp&
int main( int argc, char** argv )
if( argc != 3)
cout &&" Usage: sift input_image output_image" &&
return -1;
//cv::initModule_nonfree();
//cout &&"initModule_nonfree() called" &&
image = imread(argv[1], CV_LOAD_IMAGE_COLOR);
if(! image.data )
"Could not open or find the image" && std::
return -1;
vector&KeyPoint&
// Create a SIFT keypoint detector.
SiftFeatureD
detector.detect(image, keypoints);
cout && "Detected " && (int) keypoints.size() && " keypoints" &&
// Compute feature description.
pute(image,keypoints, descriptors);
cout && "Computed feature."&&
// Store description to "descriptors.des".
fs.open("descriptors.des", FileStorage::WRITE);
cout && "Opened file to store the features."&&
fs && "descriptors" &&
cout && "Finished writing file."&&
fs.release();
cout && "Released file."&&
// Show keypoints in the output image.
Mat outputI
Scalar keypointColor = Scalar(0, 0, 255);
drawKeypoints(image, keypoints, outputImg, keypointColor, DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cout && "Drew keypoints in output image file."&&
namedWindow("Output image", CV_WINDOW_NORMAL );
imshow("Output image", outputImg);
waitKey(0);
cout && "Generate the output image."&&
imwrite(argv[2], outputImg);
cout && "Done."&&
我 Android.mk 是...
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE
:= sift_prebuilt
LOCAL_SRC_FILES := libnonfree.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE
:= opencv_java_prebuilt
LOCAL_SRC_FILES := libopencv_java.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_C_INCLUDE:= /home/guru/Android/OpenCV-2.4.6-android-sdk/sdk/native/jni/include
LOCAL_MODULE
:= test_sift
LOCAL_LDLIBS +=
-llog -ldl
LOCAL_SHARED_LIBRARIES := sift_prebuilt opencv_java_prebuilt
LOCAL_SRC_FILES := test_sift.cpp
include $(BUILD_EXECUTABLE)
解决方法 1:
我想你忘了包括"opencv2/core/core.hpp"。这里是您的包括:
LOCAL_C_INCLUDE:= /home/guru/Android/OpenCV-2.4.6-android-sdk/sdk/native/jni/include
将"opencv2/core/core.hpp"添加到 LOCAL_C_INCLUDE 。安全检查中...
请打开浏览器的javascript,然后刷新浏览器
< 浏览器安全检查中...
还剩 5 秒&

参考资料

 

随机推荐