GradStudent
GradStudent

Reputation: 186

JNI wrappers for C++ code using OpenCV

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!

Upvotes: 0

Views: 387

Answers (1)

Radu Diță
Radu Diță

Reputation: 14171

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.

Upvotes: 1

Related Questions