I'm using the Zxing API to decode some QR Code images. I need to convert the YUV format to -> RGB format to be used in an other application.

I know the camera buffer returns a byte[] under the NV21 format (YUV), but which one is it ?

  • Do I get a YUV420 format ? Or a YUV422 format ?
  • If so, how do I convert this format to an RGB888 format ? Do I need to convert the YUV to YUV888 before that ?

Thanks for your time,

EDIT: One thing I do not undestand is the length of the byte[] from the YUV420 preview frame. For a 1280*720 resolution , I get 1,382,400.00 bytes. How is it calculated ?

有帮助吗?

解决方案

NV21 is basically YUV420. You can convert directly: http://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28NV21.29_to_ARGB8888_conversion

其他提示

While the accepted answer is correct, it is worth pointing out that the ZXing library includes PlanarYUVLuminanceSource, which encapsulates this transform and can limit peak memory usage if the decoder access the data row-by-row.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top