Repository: opencv
Issue: Android Camera2Renderer can't find the correct size
Labels: bug,priority: low,platform: android,affected: 3.4

Hi,

I'm trying to run this opencv4android example (android tutorial 4): https://github.com/opencv/opencv/tree...

The project compiles fine, but when i tryied to run, there is only a black screen and org.opencv.android.Camera2Renderer can't find the correct size (always 0x0). This is the log cat:

```

08-07 23:02:57.854 30516-30572/com.negi.app I/OpenGLRenderer: Initialized EGL, version 1.4
08-07 23:02:57.912 30516-30563/com.negi.app I/CameraGLRendererBase: onSurfaceCreated
08-07 23:02:57.912 30516-30563/com.negi.app I/CameraGLRendererBase: OpenGL ES version: OpenGL ES 3.0 V@140.0 AU@ (GIT@I3f4bae6ca5)
08-07 23:02:57.912 30516-30563/com.negi.app D/CameraGLRendererBase: loadShader
08-07 23:02:57.940 30516-30563/com.negi.app D/CameraGLRendererBase: Shader program is built OK
08-07 23:02:57.941 30516-30563/com.negi.app D/CameraGLRendererBase: loadShader
08-07 23:02:57.948 30516-30563/com.negi.app D/CameraGLRendererBase: Shader program is built OK
08-07 23:02:57.948 30516-30563/com.negi.app I/CameraGLRendererBase: onSurfaceChanged(720x1072)
08-07 23:02:57.948 30516-30563/com.negi.app D/CameraGLRendererBase: updateState
08-07 23:02:57.948 30516-30563/com.negi.app D/CameraGLRendererBase: mEnabled=true, mHaveSurface=true
08-07 23:02:57.948 30516-30563/com.negi.app D/Camera2Renderer: doStart
08-07 23:02:57.948 30516-30563/com.negi.app I/Camera2Renderer: startBackgroundThread
08-07 23:02:57.948 30516-30563/com.negi.app I/Camera2Renderer: stopBackgroundThread
08-07 23:02:57.950 30516-30563/com.negi.app D/CameraGLRendererBase: doStart
08-07 23:02:57.951 30516-30563/com.negi.app D/CameraGLRendererBase: initSurfaceTexture
08-07 23:02:57.951 30516-30563/com.negi.app D/CameraGLRendererBase: deleteSurfaceTexture
08-07 23:02:57.953 30516-30563/com.negi.app I/Camera2Renderer: openCamera
08-07 23:02:57.953 30516-30563/com.negi.app I/CameraManagerGlobal: Connecting to camera service
08-07 23:02:57.958 30516-30563/com.negi.app I/Camera2Renderer: Opening camera: 0
08-07 23:02:57.974 30516-30563/com.negi.app I/CameraManager: Using legacy camera HAL.
08-07 23:02:58.050 30516-30572/com.negi.app V/RenderScript: 0xaebf9000 Launching thread(s), CPUs 4
08-07 23:02:58.097 30516-30516/com.negi.app I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@db53606 time:220493642
08-07 23:02:58.330 30516-30563/com.negi.app D/CameraGLRendererBase: updateState end
08-07 23:02:58.330 30516-30563/com.negi.app I/Camera2Renderer: setCameraPreviewSize(720x1072)
08-07 23:02:58.330 30516-30563/com.negi.app I/Camera2Renderer: cacPreviewSize: 720x1072
08-07 23:02:58.330 30516-30604/com.negi.app I/Camera2Renderer: createCameraPreviewSession(-1x-1)
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 1600x1200
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 1280x720
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 960x720
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 720x480
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 640x480
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 480x320
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 320x240
08-07 23:02:58.335 30516-30563/com.negi.app D/Camera2Renderer: trying size: 176x144
08-07 23:02:58.335 30516-30563/com.negi.app I/Camera2Renderer: best size: 0x0
08-07 23:02:58.335 30516-30563/com.negi.app D/CameraGLRendererBase: initFBO(-1x-1)
08-07 23:02:58.335 30516-30563/com.negi.app D/CameraGLRendererBase: deleteFBO(-1x-1)
08-07 23:02:58.335 30516-30563/com.negi.app W/Adreno-ES20: <core_glTexImage2D:501>: GL_INVALID_VALUE
08-07 23:02:58.339 30516-30563/com.negi.app D/CameraGLRendererBase: initFBO error status: 1281
08-07 23:02:58.339 30516-30563/com.negi.app E/CameraGLRendererBase: initFBO failed, status: 36054
08-07 23:02:58.340 30516-30563/com.negi.app W/Adreno-ES20: <core_glClear:37>: Error: Unknown: 0x506
```

I tried this tutorial http://docs.opencv.org/trunk/d7/dbd/tutorial_android_ocl_intro.html#gsc.tab=0 but is deprecated and can`t find any solution.