Using OpenCV Android Porting

I want to use the Android OpenCV port that you can find HERE to do some image transformations for an augmented reality application. I did not find any problems with setting up and creating the library, I get no errors, and I successfully applied it in my Android JHI process: the libopencv.so library is in the correct directory "\ libs \ armeabi \" in my project directory, And now the problems:

1) First, I want to understand from which version of the openCV source library this transfer is received. It’s important for me to know if this comes from versions 1.5, 2.0 or 2.1, because the same functions are very different and the others are missing.

2) Before proceeding with the manipulation of real-time video, I will try to do some simple operations with a single image or saved video:


JNIEXPORT
jstring
JNICALL
Java_org_examples_testOpenCV_OpenCV_LoadImage(JNIEnv* env, jobject thiz)
{
    IplImage* imgIn = cvLoadImage("/sdcard/testimage.jpg", -1);

if (!imgIn) return env->NewStringUTF("Error");

cvReleaseImage( &imgIn );

return env->NewStringUTF("Ok");

}

code>


JNIEXPORT
jstring
JNICALL
Java_balmas_examples_testOpenCV_OpenCV_manageVideo(JNIEnv* env, jobject thiz)
{
     CvCapture* capture = cvCaptureFromFile("/sdcard/video_galaxyspica_352x288_15fps.3gp");

    if (!capture) return env->NewStringUTF("Error");

    return env->NewStringUTF("Ok");

}

code>

In both cases, I get an "Error". There is no problem with files on sdcard, because I'm trying to do this:


FILE* file = fopen("/sdcard/video_galaxyspica_352x288_15fps.3gp","w+");

//FILE* file = fopen("/sdcard/testimage.jpg","w+");

if (!file) return env->NewStringUTF("Error");
else {
    fflush(file);
    fclose(file);
    return env->NewStringUTF("OK");
}

code>

and I get "OK." I understand that there is some problem in the highgui library, but I do not understand what and what to do to avoid the problem. Some suggestions !!!

Thank you all

+3
source share
1 answer

- , "" ++ opencv. IplImage , , .

http://code.google.com/p/android-opencv/

, , K.

: STL- crashax ndk, http://www.crystax.net/android/ndk-r4.php

+2

Source: https://habr.com/ru/post/1744807/


All Articles