Ask Your Question
1

Android : Native OpenCV

asked 2012-09-03 04:56:01 -0600

Bia6969 gravatar image

updated 2012-09-03 05:06:23 -0600

When we are programing for Android and we want to use Opencv in the native code, the api for calling the Opencv structures and methods isn't the same used by c++ for Opencv for Linux,is it? Because i've been trying to compile a cpp (native) file based on one detect.cpp file which i used back when i was running opencv on ubuntu.

Any insight would be welcome. Thanks!

edit retag flag offensive close merge delete

Comments

Maybe the version you used on ubuntu is different (older) from the one you are using now? You should post here any errors you have so we can see what is wrong.

Rui Marques gravatar imageRui Marques ( 2012-09-03 13:01:53 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-09-03 07:06:23 -0600

Morty gravatar image

Hi,

the OpenCV Android native api is the same as the standard c++ api. I have a c++ class which is used to create panorama images in real-time. The class uses lots of OpenCV's functions and data structures and can be compiled for Android and my PC without any platform dependent code. Some OpenCV modules, e.g. the gpu module, are not supported on Android. Maybe you are using some of these unsupported modules in your code.

Best regards,

Morty

edit flag offensive delete link more

Comments

Hi. Thanks for the answer!!

I'm calling all opencv stuff within a function like this: JNIEXPORT cv::Mat JNICALL Java_com_example_display_Display_bee (JNIEnv * env, jobject obj, cv::Mat frame){ ... }

is this the wrong approach? Should i make a class that would be called from that function? Or is it up to me?

Bia6969 gravatar imageBia6969 ( 2012-09-03 08:15:39 -0600 )edit
1

Hi,

I would suggest that you have a look at the samples which are included in the OpenCV4Android SDK. I think there are 3 samples included which make calls to JNI. At least for me these samples were a great help. The OpenCV Documentation contains a nice tutorial on how to setup these samples in Eclipse:

http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_binary_package.html

or

http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/O4A_SDK.html

Best regards,

Morty

Morty gravatar imageMorty ( 2012-09-03 10:12:39 -0600 )edit

Question Tools

Stats

Asked: 2012-09-03 04:56:01 -0600

Seen: 644 times

Last updated: Sep 03 '12