Incorrect image converting YUV_420_888 into Bitmaps under Android camera2

前端 未结 3 1449
予麋鹿
予麋鹿 2020-12-11 07:47

I’m trying to convert YUV_420_888 images into bitmaps, coming from the camera2 preview. But the output image has incorrect colors.

Next is the test code I’m running

3条回答
  •  暖寄归人
    2020-12-11 08:41

    There is no direct way to copy a YUV_420_888 camera frame in into an RS Allocation. Actually, as of today, Renderscript does not support this format.

    If you know that, under the hood, your frame is NV21 or YV12 - you can copy the entire ByteBuffer to an array and pass it to RS Allocation.

提交回复
热议问题