title: How to add openCV files in "include" folder in JNI using Eclipse
body: <p>I am implementing the following project:
  <a href="https://github.com/matthill/darwinwallet" rel="nofollow">https://github.com/matthill/darwinwallet</a>
  I am getting the following error when I am executing a OpenCV android project in Eclipse:</p>
  
  <pre><code>    jni/jni_recognizer.cpp:2:33: fatal error: opencv2/core/core.hpp: No such file or directory
   #include &lt;opencv2/core/core.hpp&gt;
                                   ^
  compilation terminated.
  make.exe: *** [obj/local/armeabi-v7a/objs/native_wallet/jni_recognizer.o] Error 1
  </code></pre>
  
  <p>in my jni/include folder in Eclipse,there is no openCV files.There are only NDK files, so, maybe that is the issue. SO, please tell me how to add openCV files in the include folder.</p>
  
  <p>This is my recognizer.cpp file</p>
  
  <p>`</p>
  
  <pre><code>#include &lt;jni.h&gt;
  #include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include &lt;opencv2/features2d/features2d.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;vector&gt;
  #include "NativeVision/vision.h"
  #include &lt;time.h&gt;
  #include &lt;android/log.h&gt;
  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&lt;ORB&gt; detector;
  static Ptr&lt;DescriptorMatcher&gt; descriptorMatcher;
  static vector&lt;Mat&gt; trainImages;
  static bool training_complete = false;
  static vector&lt;string&gt; 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-&gt;GetPrimitiveArrayCritical(imgBytes, 0);
          const char * _billpath = env-&gt;GetStringUTFChars(billpath, 0);
          const char * _billname = env-&gt;GetStringUTFChars(billname, 0);
          LOGD( "Started nvTrainImage" );
          std::ostringstream out;
          //std::ostringstream out;
          //out &lt;&lt; " : billname: " &lt;&lt; _billname &lt;&lt; ": BILLPATH: " &lt;&lt; billpath &lt;&lt; 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 &lt;&lt; "nvTrainImage: " &lt;&lt; _billpath &lt;&lt; " (" &lt;&lt; trainData.rows &lt;&lt; " x " &lt;&lt; trainData.cols &lt;&lt; ")" &lt;&lt; endl;
          LOGD( out.str().c_str() );
          trainImages.push_back(trainData);
          string billstr(_billname);
          billMapping.push_back(billstr);
          LOGD( "Finished nvTrainImage" );
          env-&gt;ReleaseStringUTFChars(billpath, _billpath);
          env-&gt;ReleaseStringUTFChars(billname, _billname);
          //env-&gt;ReleasePrimitiveArrayCritical(imgBytes, _imgBytes, 0);
      }
  }
  extern "C" {
      JNIEXPORT void JNICALL Java_com_ndu_mobile_darwinwallet_Recognizer_nvFinalizeTraining(JNIEnv* env, jobject thiz)
      {
          LOGD( "Started nvFinalizeTraining" );
          descriptorMatcher-&gt;add(trainImages);
          descriptorMatcher-&gt;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-&gt;GetByteArrayElements(yuv, 0);
          //jint*  _bgra = env-&gt;GetIntArrayElements(bgra, 0);
          LOGD( "Started nvFindFeatures" );
          jstring response = env-&gt;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, 1, CV_8U, (unsigned char *)_yuv);
              //Mat mgray = imdecode(myuv, 0);
              //Please make attention about BGRA byte order
              //ARGB stored in java as int array becomes BGRA at native level
              //cvtColor(myuv, mbgra, CV_YUV420sp2BGR, 4);
              vector&lt;KeyPoint&gt; v;
              //FastFeatureDetector detector(50);
              //detector.detect(mgray, v);
              float divisor = 1;
              if (height &lt; width)
              {
                  divisor = (((double) height) / 240);
              }
              else
              {
                  divisor = (((double) width) / 240);
              }
              if (divisor == 0)
                  divisor = 1;
              Size idealSize(width/divisor, height/divisor);
              Mat mgray_small;
              resize(mgray, mgray_small, idealSize);
              Mat descriptors;
              vector&lt;DMatch&gt; matches;
              begin=clock();
              //detector-&gt;detect(mgray_small, v);
              //descriptorExtractor-&gt;compute( mgray_small, v, descriptors );
              //surfStyleMatching( descriptorMatcher, descriptors, matches );
              Mat* dummy;
              //imwrite("/sdcard/wallet_debug.jpg", mgray_small );
              bool debug_on = true;
              int debug_matches[billMapping.size()];
              RecognitionResult result = recognize( mgray_small, false, dummy, detector, descriptorMatcher, billMapping,
                      debug_on, debug_matches);
              end=clock();
              std::ostringstream out;
              out &lt;&lt; "time: " &lt;&lt; diffclock(begin, end) &lt;&lt; " ms | matches: " &lt;&lt; matches.size() &lt;&lt; endl;
              if (debug_on)
              {
                  for (int k = 0; k &lt; billMapping.size(); k++)
                      out &lt;&lt; " --" &lt;&lt; billMapping[k] &lt;&lt; " : " &lt;&lt; debug_matches[k] &lt;&lt; endl;
              }
              out &lt;&lt; "orig_width: " &lt;&lt; width &lt;&lt; "orig_height: " &lt;&lt; height &lt;&lt; endl;
              out &lt;&lt; "divisor: " &lt;&lt; divisor &lt;&lt; endl;
              //LOGD( (char*) out.str().c_str());
              if (result.haswinner == false)
                  out &lt;&lt; "No winner frown emoticon" &lt;&lt; endl;
              else
              {
                  out &lt;&lt; "Big Winner!  " &lt;&lt; result.winner &lt;&lt; " : " &lt;&lt; result.confidence &lt;&lt; endl;
                  std::ostringstream responsetext;
                  responsetext &lt;&lt; result.winner &lt;&lt; "," &lt;&lt; result.confidence;
                  response = env-&gt;NewStringUTF(responsetext.str().c_str());
              }
              LOGD( (char*) out.str().c_str());
              //for( size_t i = 0; i &lt; v.size(); i++ )
              //  circle(mbgra, Point(v[i].pt.x, v[i].pt.y), 10, Scalar(0,0,255,255));
          }
          LOGD( "Finished nvFindFeatures" );
          //env-&gt;ReleaseIntArrayElements(bgra, _bgra, 0);
          env-&gt;ReleaseByteArrayElements(yuv, _yuv, 0);
          return response;
      }
  }
  </code></pre>
  
  <p>`</p>
  
  <p>And this is my android.mk file:</p>
  
  <pre><code>LOCAL_PATH:= $(call my-dir)
  include $(CLEAR_VARS)
  OPENCV_CAMERA_MODULES:= off
  #OPENCV_MK_PATH:D:\FYP\darwinwallet-master\OpenCV-2.4.9-android-sdk\sdk\native\jni
  OPENCV_MK_PATH:D:\FYP\darwinwallet-master\OpenCV-2.4.9-android-sdk\sdk\native\jni\OpenCV.mk
  OPENCV_LIB_TYPE:=STATIC
  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)
  </code></pre>