Ask Your Question
2

OpenCV for Android (2.4.2): OpenCV Loader imports not resolved

asked 2012-07-05 20:35:14 -0600

Spooky gravatar image

updated 2012-07-09 09:02:18 -0600

Andrey Pavlenko gravatar image

The three imports (copied from samples/tutorial-3-..... are repeatedly not seen by Eclipse. As a result, OpenCVLoader.initDebug doesn't load, nor does it load my JNI lib. I need to find out if the JNI C++ code I did today (to convert a bitmap to a Mat in C++) to see if I got it right---it's 100% trial and error for that. I was hoping 2.4.2 would build and run in Eclipse, where 2.4.1 did not (and hopefully, from there, run on my tablet without force closing the instant it tries to load libopencv_java.so).

I followed the directions on both tutorials on installing and using OpenCV (on the SDK side, and on the JNI side, respectively), very carefully, and found the imports for the loader in, as I said, tutorial-3, but it didn't work. For my project, all of the image conversion, resizing, blending, and post-processing must be done in JNI, not in Java (memory constraints in Java).

Please advise.

Thanks, --jim

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-07-06 02:14:18 -0600

Andrey Pavlenko gravatar image

Please describe your problem more clearly: what steps you did, what you got, what you expected.

BTW, OpenCV does conversion from Bitmap to Mat and back in C++ and provides just a thin wrapper for that on Java side.

edit flag offensive delete link more

Comments

In my main activity (UltraCamPro.java), I added the following after the global variables: [trying to move to a new line to add src, but no luck---it just ends the comment, so this may get messy] static {\n if (OpenCVLoader.initDebug()) { System.loadLibrary("cvBlend"); } else { // Report initialization error } } I was expecting this to load opencv into my app, as per the docs for 2.4.2. Instead, I got an error saying that OpenCVLoader cannot be resolved. So I looked at tutorial-3, and saw three import files that appeared to be what I needed (import org.opencv.android.BaseLoaderCallback; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; Eclipse then says for each): the import ... cannot be resolved.

Spooky gravatar imageSpooky ( 2012-07-06 04:00:50 -0600 )edit

My workspace is in /Users/jim/Android/workspace, and both my app's top-level directory (UltraCamPro) and OpenCV-2.4.2-android-sdk (which I downloaded yesterday) are directly under the workspace directory. You mention that OpenCV does convert bitmap to Mat in C++ ... I have not found ANY documentation or examples---please point me in the right direction. I need to be able to do this entirely in C++, as I'm working with high-res camera images that exceed the Java memory limits on Android by 3--4 times, and I'm only working with a 5 MP camera...some devices have up to either 13 or 15 MP (can't remember which it was). I have NO idea how those manage to work at all, though, as the image itself exceeds Java's memory limit on Android... Thanks.

Spooky gravatar imageSpooky ( 2012-07-06 04:15:19 -0600 )edit

Can I please get an answer on this? And it does no good to simply tell me that there's a way to convert a bitmap to Mat in C++ if you won't point me to either a reference indicating how, a tutorial, or simply tell me how to do it. Am I just supposed to GUESS? As I said, I have NOT found ANY reference or tutorial showing how to do so IN C++. I have only found info on doing this from Java, which will not work, unless it uses ZERO additional RAM. Thanks.....

Spooky gravatar imageSpooky ( 2012-07-07 08:59:55 -0600 )edit

Question Tools

Stats

Asked: 2012-07-05 20:35:14 -0600

Seen: 3,863 times

Last updated: Jul 09 '12