Note that there are some explanatory texts on larger screens.

plurals
  1. POJNIEXPORT: getIplImageFromIntArray compile error
    primarykey
    data
    text
    <p>I want to take a picture with my Samsung GT-P1000, then edit this picture with some OpenCV functions and display it again on the tablet. I'm trying to edit the sample from this website: <a href="http://www.stanford.edu/~zxwang/android_opencv.html" rel="nofollow">http://www.stanford.edu/~zxwang/android_opencv.html</a></p> <p>However I've changed the project abit and am using OpenCV 2.3.1</p> <pre><code>if(requestCode == ACTIVITY_SELECT_IMAGE &amp;&amp; resultCode == RESULT_OK) { try { Uri currImageURI = data.getData(); String[] proj = {Images.Media.DATA, Images.Media.ORIENTATION}; Cursor cursor = managedQuery(currImageURI, proj, null, null, null); int columnIndex = cursor.getColumnIndex(proj[0]); cursor.moveToFirst(); mCurrentImagePath = cursor.getString(columnIndex); Bitmap bitmap = BitmapFactory.decodeFile(mCurrentImagePath); Log.i(TAG, mCurrentImagePath); int width = bitmap.getWidth(); int height = bitmap.getHeight(); int[] pixels = new int[width * height]; bitmap.getPixels(pixels, 0, width, 0, 0, width, height); opencv.setSourceImage(pixels, width, height); ...... &lt;some more irrelevant Java code&gt; .... </code></pre> <p>The sample project I'm using uses a JNIEXPORT JNICALL to load the bitmap as an IplImage so it's usable to edit with OpenCV. The code is listed below. However when I try to use ndk-build to compile the whole thing i get an error saying: <strong>../jni_part.cpp:28: undefined reference to 'getIplImageFromIntArray'.</strong> Does this mean I'm missing an import in my .cpp file or somethign else? I tried to google with 'getIplImageFromIntArray' but can't find any help. Can someone explain to me what is going wrong?</p> <pre><code>#ifdef __cplusplus extern "C" { #endif IplImage * pImage = NULL IplImage * loadpixels(int * pixels, int width, int height); IplImage * getIplImageFromIntArray (JNIEnv* env, jintArray array_data, jint width, jint height); JNIEXPORT jboolean JNICALL Java_org_opencv_example_pruts_Test1OpenCV_setSourceImage (JNIEnv * env, jobject thiz, jintArray photo_data, jint width, jint height) { if(pImage != NULL) { cvReleaseImage(&amp;pImage); pImage = NULL; } pImage = getIplImageFromIntArray(env, photo_data, width, height); if(pImage == 0) { return 0; } return 1; } </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.
    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