Ask Your Question
0

Problem in creating hello project with OpenCV for Android

asked 2014-09-11 04:18:30 -0600

Quang gravatar image

Hi,

I'm struggling with OpenCV for Android for a week now. I googled a lot but can't find any solution.

So first, I'm a newbie to OpenCV, I tried to install OpenCV for Android following the instruction on OpenCV (http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html). I've tried both the manual way and the Tegra Android Development Pack (have both installations now). I can import OpenCV library and fix those errors with OpenCV sample projects: Import successful.png.

However, while I'm trying to create a new OpenCV project, I could not import OpenCV library. The first import looks OK first import.png but after hitting Apply and OK, if I tried to fix project properties or import OpenCV dependencies in my .java files, the new imports "cannot not be resolve" and the OpenCV library in Property>Android becomes red: after touch.png.

It seems to be a simple problem but I could not make my way out of it so I'm appreciate if someone could help me out.

PS: I'm using Windows 7 with OpenCV 2.4.8.2 on Tegra Android Development Pack and Open CV 2.4.9 on the manual install.

Regards, Quang.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-09-11 05:18:19 -0600

itay gravatar image

You can try THIS example from github.

Take the whole code and try to run it on your machine.

If it work, than try to find the difference from your code to the Github code.

don't forget to look carefully on the manifest and the activity XML files.

Let me know if it work or not.

edit flag offensive delete link more

Comments

Hi Itay,

Many thanks for your reply. I tried the code but it couldn't solve my problem. So I created a new project, add the OpenCV library and then copy and paste your code into the java file. At this point my Eclipse shows errors right away at those opencv imports (ex: import org.opencv.core.Core; and so on). I really don't think there is any thing wrong with the code, it's more likely to me that something is wrong in the installation but can't figure out where it is. :(

Quang gravatar imageQuang ( 2014-09-11 08:48:05 -0600 )edit

Take 2:27 min and follow exactly what they're doing here:* https://www.youtube.com/watch?v=AXUvjOG4QK4*

itay gravatar imageitay ( 2014-09-14 02:57:20 -0600 )edit

Hi Itay, Many thanks again for your reply. I tried the video you sent but it doesn't help out with the hello project. As soon as I add the OpenCV library then clean the project, the library turn red. I can run those imported Opencv examples on my phone just fine.

Quang gravatar imageQuang ( 2014-09-14 05:12:55 -0600 )edit

Can you upload an print screen of your problem?

itay gravatar imageitay ( 2014-09-14 05:14:43 -0600 )edit

Hi Itay,

Please refer to those print screen I posted in the question. especially the "first import.png" and the "after touch.png".

Quang gravatar imageQuang ( 2014-09-18 05:08:31 -0600 )edit

Hi Itay, isn't it the same package as the official download which I used?

Quang gravatar imageQuang ( 2014-09-22 05:13:32 -0600 )edit

It's look that you used the tegra version, I don't know if the problem is there. but try to download it also from the link I sent you.

itay gravatar imageitay ( 2014-09-22 05:17:19 -0600 )edit

Hi Itay, I have both opencv with the official package and the tegra pack on my system and the problem is with both of them. However, I tried the package you sent anyway. It doesn't help, the library is still in red. I feel very hopeless now :(

Quang gravatar imageQuang ( 2014-09-24 08:14:44 -0600 )edit

This is really wired, If you want, this is my mail : [email protected] talk with me there,I believe we can solve your problem with teamviewer.

itay gravatar imageitay ( 2014-09-28 01:10:03 -0600 )edit
0

answered 2014-09-12 08:31:38 -0600

Hi,

When importing the OpenCV lib on eclipse, make sure that it is checked as "Is library". You can do so by right clicking the opencv lib project -> properties, it is listed in the Android column. Then, try adding the opencv lib again to your project

Good luck,

edit flag offensive delete link more

Comments

Hi Turk2Iton,

Many thanks for your reply. The "Is library" was checked when I import the OpenCV library and I didn't change it since. I don't know why Eclipse doesn't accept it as a library. I just need to import the OpenCV library in my hello project and clean it then the OpenCV library in the properties of the hello project turns red as in the above screenshots. It is really annoying :(

Quang gravatar imageQuang ( 2014-09-18 05:15:02 -0600 )edit

Question Tools

Stats

Asked: 2014-09-11 04:18:30 -0600

Seen: 837 times

Last updated: Sep 12 '14