문제

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