Question

I have to reuse some C++ code using OpenCV in the Android platform using NDK. I have the setup done correctly, but I am not sure how to write wrappers for the C++ code. Could someone provide me with some documentation so I could understand how to go about it? So far I have:

using namespace cv;

void surf_detection(Mat img_1,Mat img_2);

void
Java_com_example_trafficvideo_MainActivity_countFromJNI( JNIEnv* env,
                                              jobject thiz ){
 /** @function main */

 int i;
 int key;

 CvCapture* capture = cvCaptureFromAVI("raw.TrafficVideoNew.mp4");// Read the video file

 if (!capture){

 std::cout <<" Error in capture video file";
.
.
.
.
.
.
.

Which I am pretty sure is wrong. Any help will be appreciated!

Was it helpful?

Solution

You can take a look over SWIG.

It should be able to generate all the JNI code for you.

I've done this about a year ago and I remember that it wasn't painless.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top