Ask Your Question

trouble with android sample

asked 2013-09-09 00:50:09 -0500

nakano gravatar image

updated 2013-09-10 02:42:45 -0500

Hello everyone

I have a strange behavior when launching openCV tutorial1 - Camera Preview.

When I launch the project on a galaxy tab (framework 2.3.3) and on an HTC ( framework 4.2.2) everything is fine but when I try to launch it on a panasonic 102P (framework 2.3.5) the screen is fully black. I've tried to change display mode between java and native surface view, change

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);


OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback);

but nothing changed. When launching for the first time, I've downloaded and installed openCV Manager v2.9.

Is there any trouble supporting panasonic device?

Furthermore, When launching the application for the first time, there is a message for downloading the openCV manager and I would like to know if it is possible to embedded the openCV manager in our project in order user doesn't have to download it before launching our application?

I really thank you for your help

Update: today I've tried to launch again the sample application without changing anything using the same android device which worked until yesterday and now I always have a black screen.

I've searched in the android documentation and I've seen that SurfaceTexture (which is in the openCV Library 2.4.6) have been added with API 11. However sample minSdkVersion is 8 like my own project which also display a black screen.

Is it the reason that I have a black screen? I don't understand how the sample worked until yesterday and from today I can no more use it. Is it an OS bug? Is there an equivalent of SurfaceTexture from android support v4 for example which can be used from API8?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-09-09 10:03:45 -0500

Andrey Pavlenko gravatar image

OpenCV camera support may not work on some devices due to Android OS vendor customization. In particular it happens on some TI-based hardware like the 'Panasonic SoftBank 102P' is. Also you can provide logcat for deeper analysis.

edit flag offensive delete link more


logcat doesn't doesn't really help me. In red, I only have : Could not find class '', referenced from method After I have "OpenCV libs init was ok!", "First attempts to load libs is OK" then I have some general information about openCV 2.4.6 configuration. The last rows are the following: Init finished with status 0 Unbind from service Calling using callback OpenCV loaded successfully call surfaceChanged event Connecting to camera Initialize java camera Trying to open camera with old open() getSupportedPreviewSizes() Set preview size to 960x540 GC_EXTERNAL_ALLOC freed 108K, 43% free 3535K/6151K, external 1827K/2137K, paused 25ms app passed NULL surface startPreview Starting processing thread

nakano gravatar imagenakano ( 2013-09-09 21:55:45 -0500 )edit

answered 2013-09-09 01:53:38 -0500

itay gravatar image

did you try to change the frame size?

i donn't know what is the allowed resolution for panasonic 102P.

This is the function that maybe help you:

mOpenCvCameraView.setMaxFrameSize(maxWidth, maxHeight)

edit flag offensive delete link more


Thank you for your message. On the onCameraViewStarted callback, I've seen that for the panasonic 102p, the screen screen is W:960, H:540. on the onCreate method, I've used the function mOpenCvCameraView.setMaxFrameSize(960,540) wich set the frame to 960*540, I've also tried to set Max frame size to W:480, H:360 which set the camera frame to W:320, H: 240 but for both setting the camera display is still fully black. (Because native surface view doesn't works with HTC, I've set mOpenCvCameraView with java surface view.) In the log cat, I only have one error (written in read) which is : Could not find class '', referenced from method

nakano gravatar imagenakano ( 2013-09-09 02:28:37 -0500 )edit

what is the android version of the panasonic 102P?

itay gravatar imageitay ( 2013-09-09 02:46:59 -0500 )edit

android version is 2.3.5 kernel version is build number is 07.0483 Android device is panasonic 102p by SoftBank

nakano gravatar imagenakano ( 2013-09-09 21:45:53 -0500 )edit

I have the same problem and see the same logcat behavior on my droid charge running android 2.3.6. I see this with opencv version 2.4.6 and 2.4.3. Even the opencv apps on google play no longer work on my phone. The camera never initializes.

anybody gravatar imageanybody ( 2013-09-13 10:45:44 -0500 )edit

Question Tools


Asked: 2013-09-09 00:50:09 -0500

Seen: 2,382 times

Last updated: Sep 10 '13