Problem in Running some Sample Projects in android-OpenCV

2,743 views
Skip to first unread message

Daniel Soleimani

unread,
Aug 14, 2011, 3:39:12 AM8/14/11
to android-opencv
Hello to everyone,
I was trying to run the sample projects on my Phone (Galaxy ACE) , but
just "15 puzzle" and "Tutorial 1 Basic 0- android Camera" run on my
phone, but others "Force to close".

Is that because of lack of front camera on my Phone? How can I change
the code so It uses the back camera in samoles like: "FaceDetection"?

Best Regards
Dan

Andrey Kamaev

unread,
Aug 14, 2011, 2:46:08 PM8/14/11
to android-opencv
Hi,

All the samples work with default camera and do not require front
camera.
Actually face detection and 15-puzzle samples has identical structure.
So if you can run 15-puzzle, then all samples should work on your
phone.

Have you tried prebuilt .apk's from the /OpenCV2.3.1/bin folder?

/Andrey

Peter Karasev

unread,
Aug 14, 2011, 2:58:05 PM8/14/11
to android...@googlegroups.com
Andrey-

I get the same error with both prebuilt APK and compiling my own. This
is droid-X , 2.2.1 android (maybe not supported? )


Tutorial 0 Logcat:

08-14 14:55:24.041 1157 1250 D CameraSettings: defaultCapabilities:
face-track-mode-values: off,on
08-14 14:55:24.041 1157 1250 D CameraSettings: SDM file does not
exist, default to SDM enabled
08-14 14:55:24.041 1157 1250 E CameraSettings: Param type 49 not supported
08-14 14:55:24.041 1157 1250 D CameraHal: CameraHal constructor exited ok
08-14 14:55:24.065 3456 3456 I Sample::SurfaceView: surfaceCreated
08-14 14:55:24.073 3456 3478 I Sample::SurfaceView: Starting processing thread
08-14 14:55:24.080 1157 1157 D CameraSettings: Extract changes
completed, 1 total changes
08-14 14:55:24.080 3456 3456 D Camera : app passed NULL surface
08-14 14:55:24.080 1157 1544 W CameraHal: No overlay set before start preview


Wouldn't this be a bug with the java setup? The same problem arises
both running the "tutorial 0" and "tutorial 3 - native " .


Peter K.

Daniel Soleimani

unread,
Aug 16, 2011, 3:53:58 AM8/16/11
to android-opencv
Thanks, as you said, the prebuilt.apk's from /OpenCV2.3.1/bin
directory worked on my phone. But I noticed something, the
prebuilt.apk's have a much greater size compare to my compiled apk's.
For example, the prebuilt "faceDetection" is 6MB and my compiled one
is just 181 KB!
Maybe I'm missing the openCV library in it. I will post again as soon
as I get better results.

Regards
Dan

Daniel Soleimani

unread,
Aug 16, 2011, 4:09:17 AM8/16/11
to android-opencv
I'm on Android 2.2.1 too and the prebuilt apk worked for me.
But read this on OpenCV-Android wiki on http://opencv.willowgarage.com/wiki/Android

"Known problems (beta2 package)
#1244 OpenCV native camera and all provided samples do not work on
some devices (Motorola Droid) because of problem in camera
initialization code."

Daniel Soleimani

unread,
Aug 16, 2011, 4:42:27 AM8/16/11
to android-opencv
Solved!
I needed to Open both projects "OpenCV-2.3.1" and "Sample-face-
detection" and the do a clean build again.
Thanks for your help :)

On Aug 14, 10:46 pm, Andrey Kamaev <andrey.kam...@itseez.com> wrote:

Richard Szabo

unread,
Aug 17, 2011, 10:06:35 AM8/17/11
to android-opencv
Hello,

I tried the prebuilt samples on Samsung Galaxy 3 updated to Froyo
(I5800XWJPI) and tutorials work fine but 15-puzzle, face-detection,
and image-manipulations hang.

Following 'Using Android binary package with Eclipse' I could rebuild
all the applications in Windows 7 and in Mandriva 2010 linux.
Non-native tutorials are still working deploying from linux but not
from windows (I cleaned everything to make eclipse rebuild the
projects).
Native apps after following 'Using C++ OpenCV code with Android binary
package' can also be built but they are not working on the phone after
building and deploying from linux. (Since basic apps are not working
from windows I have not tried the native ones.)

So it seems to me that the phone current OS is capable of running the
samples and my configuration is not completely messy.
What should I do to run native apps after my own builds at least on
linux?

Thank you in advance,
Richard
> > > Dan- Hide quoted text -
>
> - Show quoted text -

Andrey Kamaev

unread,
Aug 17, 2011, 10:32:16 AM8/17/11
to android...@googlegroups.com
Hi,

It seems that your phone has ARMv6 CPU. But native samples are configured for ARMv7 architecture.
So you need to edit Application.mk files and put the line

APP_ABI := armeabi

instead of

APP_ABI := armeabi-v7a

/Andrey

Richard Szabo

unread,
Aug 17, 2011, 1:47:06 PM8/17/11
to android-opencv
Yes, this was the problem!

After the modification in both Application.mks I saw the libraries in
obj/local/armeabi and libs/armeabi instead of */armeabi-v7a and now
the deployed apks are working as expected.

(Somehow I had to perform the clean all and deploy process twice
because first time it did not work - may be I am not familiar enough
with eclipse.)

Thank you for your quick and correct answer!

Bests,
Richard

On Aug 17, 4:32 pm, Andrey Kamaev <andrey.kam...@itseez.com> wrote:
> Hi,
>
> It seems that your phone has ARMv6 CPU. But native samples are configured
> for ARMv7 architecture.
> So you need to edit Application.mk files and put the line
>
> APP_ABI := armeabi
>
> instead of
>
> APP_ABI := armeabi-v7a
>
> /Andrey
>

Seba

unread,
Sep 3, 2011, 5:06:14 PM9/3/11
to android-opencv
Hi,

I changed the processor definition at Application.mks, but still not
working.

I'm on p500-h with android 2.2 that has ARMv6 CPU

Any suggestion??


Seba
> > > > > > I was trying to run thesampleprojects on my Phone (Galaxy ACE) ,

Andrey Pavlenko

unread,
Sep 5, 2011, 2:33:18 AM9/5/11
to android-opencv
What do you mean saying 'not working'?
Please remove the 'libs' and 'obj' folders in your proj folder, make a
build and check if the 'libs\armeabi' folder contains your JNI .so
file.
Also please look into the .apk file (in 'bin' folder) - this is ZIP
archive - and check if it contains your JNI .so inside 'lib\armeabi'.
/Andrey.

Seba

unread,
Sep 5, 2011, 4:37:40 PM9/5/11
to android-opencv
Thanks for the reply

I mean "not working" that I can not run the tutorials that use JNI on
my device.

I do not understand where to find the lib and obj folders, then follow
the tutorial in eclipse in the example "tutorial-4-mixed"
does not have these folders. The only lib folder I find Eclipse is a
dentrp OpenCV library. This is where I have to delete?

Excuse my writing, my English leaves much to be desired but my
interest is huge.

regards

Seba

Nathan

unread,
Sep 12, 2011, 2:28:18 PM9/12/11
to android-opencv
Hi, I had a similar problem to which this was a solution. May I
suggest adding a note about checking and configuring the instruction
set to the android OpenCV documentation and tutorials?

On Aug 17, 7:32 am, Andrey Kamaev <andrey.kam...@itseez.com> wrote:
> Hi,
>
> It seems that your phone has ARMv6 CPU. But native samples are configured
> for ARMv7 architecture.
> So you need to edit Application.mk files and put the line
>
> APP_ABI := armeabi
>
> instead of
>
> APP_ABI := armeabi-v7a
>
> /Andrey
>

Andrey Pavlenko

unread,
Sep 13, 2011, 1:11:54 AM9/13/11
to android...@googlegroups.com
yes, suggest please!

Andrey Pavlenko

unread,
Sep 13, 2011, 1:19:39 AM9/13/11
to android...@googlegroups.com
tutorial-4-mixed
|_  .settings <-- eclipse generated
|_  bin <-- eclipse generated
|     |_ <your>.apk
|_  gen <-- eclipse generated
|_  jni
|     |_ jni_part.cpp, Android.mk, Application.mk
|_  libs <-- eclipse/ndk-build generated
|     |_ armeabi-v7a
|              |_  <your>.so
|_  obj <-- eclipse/ndk-build generated
|_  res
|_  src
|_   .classpath, .project, AndroidManifest.xml, build.xml, default.properties, local.properties, proguard.cfg ...
Reply all
Reply to author
Forward
0 new messages