How to include OpenCV files in include folder ?

asked 2015-10-21 12:58:19 -0500

Actually when I try to run my project I face the following error:

22:51:45 * Incremental Build of configuration Default for project DarwinWallet * "D:\FYP\android-ndk-r10e\ndk-build.cmd" all [armeabi-v7a] Compile++ thumb: native_wallet <= jni_recognizer.cpp jni/jni_recognizer.cpp:2:33: fatal error: opencv2/core/core.hpp: No such file or directory #include <opencv2 core="" core.hpp=""> ^ compilation terminated. make.exe: * [obj/local/armeabi-v7a/objs/native_wallet/jni_recognizer.o] Error 1

My Android.mk is given below:

OPENCV_INSTALL_MODULES:=on

include $(OPENCV_MK_PATH)

Profiler

-include android-ndk-profiler.mk

include ../includeOpenCV.mk

ifeq ("$(wildcard $(OPENCV_MK_PATH))","")

try to load OpenCV.mk from default install location

include $(TOOLCHAIN_PREBUILT_ROOT)/user/share/OpenCV/OpenCV.mk

else

include $(OPENCV_MK_PATH)

endif

LOCAL_C_INCLUDES:=D:\FYP\darwinwallet-master\OpenCV-2.4.9-android-sdk\sdk\native\jni\include

LOCAL_MODULE:=native_wallet LOCAL_SRC_FILES:=jni_recognizer.cpp NativeVision\vision.cpp LOCAL_CFLAGS=-ffast-math -O3 -funroll-loops

LOCAL_CFLAGS=-O3 -funroll-loops

LOCAL_LDLIBS+=-llog -ldl

Profiling

LOCAL_CFLAGS:=-pg

LOCAL_STATIC_LIBRARIES:=andprof

include $(BUILD_SHARED_LIBRARY)

jni_recognizer.cpp is given below:

include <jni.h>

include <opencv2 core="" core.hpp="">

include <opencv2 imgproc="" imgproc.hpp="">

include <opencv2 features2d="" features2d.hpp="">

include <opencv2 highgui="" highgui.hpp="">

include <vector>

include "NativeVision/vision.h"

include <time.h>

include <android log.h="">

using namespace std; using namespace cv;

define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "JNI_DEBUGGING", __VA_ARGS__)

double diffclock(clock_t clock1,clock_t clock2) { double diffticks=clock2-clock1; double diffms=(diffticks*1000)/ CLOCKS_PER_SEC;

return diffms;

}

static Ptr<orb> detector; static Ptr<descriptormatcher> descriptorMatcher;

static vector<mat> trainImages; static bool training_complete = false;

static vector<string> billMapping;

extern "C" { JNIEXPORT void JNICALL Java_com_ndu_mobile_darwinwallet_Recognizer_nvInitialize(JNIEnv* env, jobject thiz) {

    LOGD( "Started nvInitialize" );

    detector = getQueryDetector();
    descriptorMatcher = getMatcher();

    LOGD( "Finished nvInitialize" );

}

}

extern "C" { JNIEXPORT void JNICALL Java_com_ndu_mobile_darwinwallet_Recognizer_nvResetTrainedDatabase(JNIEnv* env, jobject thiz) { LOGD( "Started nvResetTrainedDatabase" );

    training_complete = false;
    descriptorMatcher = getMatcher();
    trainImages.clear();
    billMapping.clear();

    LOGD( "Finished nvResetTrainedDatabase" );
}

} extern "C" { JNIEXPORT void JNICALL Java_com_ndu_mobile_darwinwallet_Recognizer_nvTrainImage(JNIEnv* env, jobject thiz, jstring billname, jstring billpath) { //char* _imgBytes = (char*) env->GetPrimitiveArrayCritical(imgBytes, 0); const char * _billpath = env->GetStringUTFChars(billpath, 0); const char * _billname = env->GetStringUTFChars(billname, 0);

    LOGD( "Started nvTrainImage" );

    std::ostringstream out;

    //std::ostringstream out;
    //out << " : billname: " << _billname << ": BILLPATH: " << billpath << endl;
    LOGD( out.str().c_str() );
    //LOGD( "nvTrainImage: 1" );
    //Mat mgray(1, bytelength, CV_8U, (unsigned char *)_imgBytes);
    //LOGD( "nvTrainImage: 2" );
    Mat img = imread(_billpath, 0);
    //Mat img = imread("/sdcard/wallet/us/100b/full_pic.jpg", 0);

    //LOGD( "nvTrainImage: 3" );
    Mat trainData = trainImage( img,  detector, descriptorMatcher );

    out << "nvTrainImage: " << _billpath << " (" << trainData.rows << " x " << trainData.cols << ")" << endl;
    LOGD( out.str().c_str() );

    trainImages.push_back(trainData);

    string billstr(_billname);
    billMapping.push_back(billstr);

    LOGD( "Finished nvTrainImage" );
    env->ReleaseStringUTFChars(billpath, _billpath);
    env->ReleaseStringUTFChars(billname, _billname);
    //env->ReleasePrimitiveArrayCritical(imgBytes, _imgBytes, 0);
}

} extern "C" { JNIEXPORT void JNICALL Java_com_ndu_mobile_darwinwallet_Recognizer_nvFinalizeTraining(JNIEnv* env, jobject thiz) { LOGD( "Started nvFinalizeTraining" ); descriptorMatcher->add(trainImages); descriptorMatcher->train();

    training_complete = true;

    LOGD( "Finished nvFinalizeTraining" );
}

}

extern "C" { JNIEXPORT jstring JNICALL Java_com_ndu_mobile_darwinwallet_Recognizer_nvRecognize(JNIEnv* env, jobject thiz, jint width, jint height, jbyteArray yuv) { jbyte* _yuv = env->GetByteArrayElements(yuv, 0); //jint* _bgra = env->GetIntArrayElements(bgra, 0);

    LOGD( "Started nvFindFeatures" );


    jstring response = env->NewStringUTF("");

    if (training_complete == true)
    {

        clock_t begin;
        clock_t end;



        //Mat myuv(height + height/2, width, CV_8UC1, (unsigned char *)_yuv);
        //Mat mbgra(height, width, CV_8UC4);
        Mat mgray(height, width, CV_8UC1, (unsigned char *)_yuv);


        //Mat myuv(width ...
(more)
edit retag flag offensive close merge delete

Comments

ow god ... take a look at the FAQ and take a look at how you could improve this question ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-10-22 04:28:12 -0500 )edit