Camera preview image data processing with Android L and Camera2 API

前端 未结 5 540
失恋的感觉
失恋的感觉 2020-11-27 11:46

I\'m working on an android app that is processing the input image from the camera and displays it to the user. This is fairly simple, I register a PreviewCallback

5条回答
  •  Happy的楠姐
    2020-11-27 12:16

    Since the Camera2 API is very different from the current Camera API, it might help to go through the documentation.

    A good starting point is camera2basic example. It demonstrates how to use Camera2 API and configure ImageReader to get JPEG images and register ImageReader.OnImageAvailableListener to receive those images

    To receive preview frames, you need to add your ImageReader's surface to setRepeatingRequest's CaptureRequest.Builder.

    Also, you should set ImageReader's format to YUV_420_888, which will give you 30fps at 8MP (The documentation guarantees 30fps at 8MP for Nexus 5).

提交回复
热议问题