How to create multi lenses or preview using one camera in Android

前端 未结 1 1334
轻奢々
轻奢々 2021-02-09 01:13

\"\"

I wanted to create something like above, that three box, will be like a camera preview. Any idea or concept o

1条回答
  •  灰色年华
    2021-02-09 01:44

    You can only open a given camera (front or back) once; you cannot open the camera multiple times to produce multiple preview streams. In fact, on most devices, you can't open the front and back cameras simultaneously, since the camera processing pipeline is shared between the two cameras.

    To do this, you need to only open the camera once, and then split the output preview data into the three parts that you then display.

    If you need to run on Android versions before 3.0 (Honeycomb), then you need to use the preview callbacks. With them, you'll get a byte[] array of YUV data for each frame that you can then crop, convert to RGB, and place in an ImageView or SurfaceView.

    On Android 3.0 or later, you can use the setPreviewTexture method to pipe the preview data into an OpenGL texture, which you can then render to multiple quads in a GLSurfaceView or equivalent.

    0 讨论(0)
提交回复
热议问题