How to use openCV with Android?

903 views
Skip to first unread message

Yau Mun

unread,
May 19, 2012, 11:43:35 PM5/19/12
to android...@googlegroups.com
Hi all, I'm new in openCV and I currently doing an project about image processing with android and need to use openCV. The problem is I don't know what is the next step after i download the openCV version 2.4. 

Can anyone guide me on what I need to do?

Thanks.

Shervin Emami

unread,
May 20, 2012, 3:00:58 AM5/20/12
to android...@googlegroups.com
Start with the tutorial at "http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package.html" that explains how to start using OpenCV for Android using Java. OpenCV comes with various Android sample projects, which you should also look at once you've followed the tutorial above (but ignore the sample projects that say "(Advanced)"). Then if you want to use OpenCV on Android using C/C++ instead of Java, then follow the NDK tutorial "http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package_using_with_NDK.html#android-binary-package-with-ndk" and look at the OpenCV Android sample projects that say "(Advanced)" because they use C with Java.

Cheers,
Shervin.

Yau Mun

unread,
May 20, 2012, 3:35:59 AM5/20/12
to android...@googlegroups.com
Hi, i get an exclamation mark on my apps when i import the openCV library. Any solution?

Shervin Emami

unread,
May 20, 2012, 3:49:36 AM5/20/12
to android...@googlegroups.com
Make sure you right-click on OpenCV and your app projects and click on
Refresh, sometimes Eclipse does not refresh itself properly. If the
OpenCV-2.4.0 Java project is in your Eclipse workspace and it builds
fine, but your apps give errors, then they aren't referencing the
OpenCV project correctly.

eg: Right-click on one of your projects in Package Explorer, click on
Properties, click on Android, and look in the Libraries section. It
should show a green tick to say it is linked to the OpenCV project,
but if it is a red cross then "Remove" it and click on "Add..." and
double-click on the OpenCV library. Now it should work.

Cheers,
Shervin Emami.
http://www.shervinemami.info/openCV.html

Yau Mun

unread,
May 20, 2012, 4:20:23 AM5/20/12
to android...@googlegroups.com
But it still have the red exclamation mark on my app....is it I use the 4.0.4 version? And one more thing to ask about is can my android apps integrate with openCv?

Shervin Emami

unread,
May 20, 2012, 4:25:50 AM5/20/12
to android...@googlegroups.com
What is the error message or what line of code is giving the error?
Sounds like you haven't setup OpenCV properly but depends on the error

Yau Mun

unread,
May 20, 2012, 4:40:45 AM5/20/12
to android...@googlegroups.com
when i run the application, it pop up "Android libraries project cannot be launched"

peppschmier

unread,
May 21, 2012, 2:54:04 AM5/21/12
to android...@googlegroups.com
Make sure to launch your own project (with reference to the OpenCV library project) and not to launch the OpenCV library project itself.
(Right click on your project in Project Explorer - "Run As or "Debug As" - Android Application).

Cheers,
Michael

sanju

unread,
Sep 19, 2012, 10:09:11 AM9/19/12
to android...@googlegroups.com
sir i'm beginner I followed your all step 

when i gives this command on command prompt the error showing like this

E:\newworkspace\OpenCVSample-face-detection>D:\NitinGuptaAndroid\SanjayBarfa\and
roid-ndk-r8b\ndk-build.cmd
jni/Android.mk:8: ../../sdk/native/jni/OpenCV.mk: No such file or directory
make: *** No rule to make target `../../sdk/native/jni/OpenCV.mk'.  Stop.


and on eclipse consol this error 

**** Build of configuration Default for project OpenCVSample-face-detection ****

\ndk-build.cmd 

Cannot run program "\ndk-build.cmd": Launching failed
Error: Program "/ndk-build.cmd" is not found in PATH

PATH=[C:/Program Files/Java/jdk1.6.0/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0/bin/../jre/lib/i386;C:\Program Files\Java\jdk1.6.0\bin;C:\Program Files\Common Files\Ahead\Lib\;D:\NitinGuptaAndroid\eclipse12;]

**** Build Finished ****



sir i dont know what is hell is committing there plz help me

Reply all
Reply to author
Forward
0 new messages