Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenCV on Android - Headers; No such file/directory
    primarykey
    data
    text
    <p>so I am new to using the JNI for Android so sorry in advance if this is something silly. I have installed the SDK and in Eclipse have added it as a library for the project. After finishing up everything, I have tried to run the ndk-build function but get this error:</p> <pre><code>Compile++ thumb : face_detect_rec &lt;= jni_part.cpp In file included from jni/face_detect_rec.h:11:0, from jni/jni_part.cpp:3: /Users/Justin/Documents/Android/opencv-2.4.3.2-android-sdk/sdk/native/jni/include/opencv2/core/core.hpp:56:21: fatal error: algorithm: No such file or directory compilation terminated. make: *** [obj/local/armeabi/objs/face_detect_rec/jni_part.o] Error 1 </code></pre> <p>That file location is where the core.hpp is so I am not sure why this is a problem. I'll post my code below for reference, thanks guys!</p> <p>jni_part.cpp:</p> <pre><code>#include &lt;jni.h&gt; #include "face_detect_rec.h" using namespace std; using namespace cv; extern "C" { JNIEXPORT void JNICALL Java_com_example_opencvandroidtest_MainActivity_detectFaces( JNIEnv* env, jclass mClass, jstring filePath) { detectFaces(filePath); } } </code></pre> <p>face_detect_rec.h</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;assert.h&gt; #include &lt;math.h&gt; #include &lt;float.h&gt; #include &lt;limits.h&gt; #include &lt;time.h&gt; #include &lt;ctype.h&gt; #include &lt;opencv2/core/core.hpp&gt; #include &lt;opencv2/highgui/highgui.hpp&gt; #include &lt;opencv2/contrib/contrib.hpp&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;sstream&gt; #include &lt;string&gt; using namespace cv; using namespace std; static void detectFaces(string filePath); </code></pre> <p>face_detect_rec.cpp:</p> <pre><code>#include "face_detect_rec.h" // Create a string that contains the exact cascade name string faceCascade_name = "/Users/Justin/Documents/OpenCV/data/haarcascades/haarcascade_frontalface_alt2.xml"; /* "haarcascade_profileface.xml";*/ string eyeCascade_name = "/Users/Justin/Documents/OpenCV/data/haarcascades/haarcascade_mcs_lefteye.xml"; //string rightEyeCascade_name = // "/Users/Justin/Documents/OpenCV/data/haarcascades/haarcascade_mcs_righteye.xml"; // Function to detect and draw any faces that is present in an image static void detectFaces(string filePath) { // Create a new Haar classifier CascadeClassifier faceCascade; Mat img = imread(filePath); //int scale = 1; // Load the HaarClassifierCascade faceCascade.load(faceCascade_name); // Check whether the cascade has loaded successfully. Else report and error and quit if( faceCascade.empty() ) { cout &lt;&lt; "ERROR: Could not load classifier cascade\n"; return; } // There can be more than one face in an image. So create a growable sequence of faces. // Detect the objects and store them in the sequence vector&lt;Rect&gt; faces; faceCascade.detectMultiScale(img, faces, 1.1, 2, CV_HAAR_SCALE_IMAGE, cvSize(70, 70)); // Loop the number of faces found. for( int i=0; i&lt;faces.size(); i++ ) { //save image Mat faceROI = img(faces[i]); stringstream s; s &lt;&lt; "/mnt/sdcard/Pictures/TagSense" &lt;&lt; i &lt;&lt; ".jpg"; imwrite(s.str(), faceROI); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload