hico
hico

Reputation: 1880

Zxing camera and preview frame format (YUV, RGB...)

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 ?

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 ?

Upvotes: 0

Views: 2365

Answers (2)

Rupert Rawnsley
Rupert Rawnsley

Reputation: 2659

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.

Upvotes: 0

Sean Owen
Sean Owen

Reputation: 66886

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

Upvotes: 1

Related Questions