Search code examples
androidcamerayuv

How to get the center of a YUV image without processing the rest?


I want to get, in RGB (or anything I can convert to RGB later), the middle color value of a YUV image. So the color of the centre XY pixel.

Theres nice code out there to convert the whole pixel array from an Android camera to RGB...but this seems a bit wasteful if I just want the center pixel.

Normally Id just look at the loop and figure out where its processing the middle pixel....but I dont understand the YUV or the conversion code well enough to figure out where the data I need is.

Any help or pointers?

Cheers -Thomas


Solution

  • Using this guide here; stackoverflow.com/questions/5272388/extract-black-and-white-image-from-android-cameras-nv21-format

    Explains the process fairly well. However, it seems I was having a different problem then I expected,but its different enough to repost the question.