Ask Your Question

kwyjibo's profile - activity

2012-12-17 13:22:43 -0500 answered a question Samples not working on Samsung Galaxy SL

So, here is what I did, not a real solution, but it may point someone where the real problem is. As I commented, it seems obvious that you can't draw on the same surface used for the camera preview...

I modified in the Tutorial 0 this way to have it working:

public SampleViewBase(Context context) {
mHolder.setType( SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS );


public void setPreview() throws IOException { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) mCamera.setPreviewTexture( new SurfaceTexture(10) ); else mCamera.setPreviewDisplay(mHolder); }

public void surfaceCreated(SurfaceHolder holder) { Log.i(TAG, "surfaceCreated"); mHolder = holder; (new Thread(this)).start(); }

public void run() { [...] while (mThreadRun) { [...]

    if (bmp != null) {
        Canvas canvas = mHolder.lockCanvas();
        if (canvas != null) {
            canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);


2012-12-12 03:33:55 -0500 commented answer Samples not working on Samsung Galaxy SL

I managed somehow to solve this. The main problem was I can't draw on the same surface the camera is using for preview. I just disabled the lock on the holder, thus disabling what OpenCV may be drawing, but I can live with this, as the data is far more important than the preview. I suppose there is a better way to solve this, as this is not necessary in my other test device, and HTC One S. I'll add the code I modified in the in the Tutorial 0 sample.

2012-12-12 03:15:30 -0500 received badge  Editor (source)
2012-12-10 11:21:14 -0500 asked a question Samples not working on Samsung Galaxy SL

It's seems to be something related with the camera interface, both native and not native camera access samples don't work. And that means that app shows up, but only a black screen in showed.

Native camera throws some errors like this:

12-10 16:10:24.179: E/OpenCV::camera(2647): calling (*pGetPropertyC)(0x29c8a8, 2)

A simple example like this ( works, but I don't see what is the problem. Maybe the surface created?

Here is the software versions I'm working with:

  • Android 2.3.6
  • Android OpenCV SDK 2.4.2
  • OpenCV Manager 2.3
  • OCV 2.4 armeabi-v7a with NEON 2.4.3 rev 3