Skip to content

In the Android project, using the Rust NDK Camera API, call the camera. How to convert YUV to RGB? #74

Answered by awxkee
paulzhang5511 asked this question in Q&A
Discussion options

You must be logged in to vote

I’ve already answered once, see the issue .

Android default Yuv layout is NV12 or NV21, I’ve always mixing up because they are using different notation system. Only some buggy emulators will send YUV 4:2:0 for you.

Your methods actually already trying to work partially as with NV21 layout but something goes wrong after.
After you get ‘uv_pixel_stride’ on the second plane by AImage_getPlanePixelStride check the value, it should be 2, that means data is interlaced and it is actually NV layout. If value is 1 then it is planar YUV.

Then you get two planes, where one plane is Y and other plane is UV, construct YuvBiPlanarImage and everything should start working.

I've never used exactly those …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by paulzhang5511
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants