Camera preview image data processing with Android L and Camera2 API

前端 未结 5 555
失恋的感觉
失恋的感觉 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条回答
  •  半阙折子戏
    2020-11-27 12:28

    It's better to init ImageReader with max image buffer is 2 then use reader.acquireLatestImage() inside onImageAvailable().

    Because acquireLatestImage() will acquire the latest Image from the ImageReader's queue, dropping older one. This function is recommended to use over acquireNextImage() for most use-cases, as it's more suited for real-time processing. Note that max image buffer should be at least 2.

    And remember to close() your image after processing.

提交回复
热议问题