I am writing a simple Android application where I retrieve frame buffers using ImageReader.OnImageAvailableListener to acquire the latest image and process the Y plane. I use this plane to calculate a simple metric whose value will decide whether I display something on the screen or not.
My question was how to process and interpret only the Y plane (I have no need for the U and the V planes). It is to my understanding that the Y plane contains the luminance channel; ie. the channel with the brightness of the image.
Documentation states that each pixel is 8 bits, ie, one byte, which I guess makes sense since the pixels are in a ByteBuffer. However, after some experiments printing the first byte of the Y channel (I do this by calling Log.i(TAG, String.valueOf(image.getPlanes()[0].getBuffer().get(0)
in my ImageReader.OnImageAvailableListener), I don't see any correlation between image "brightness" and the value of the byte. For example, when I put the camera on a completely black background, I get values from ~0 to 15 for the luminance. When I put it on a bright white background, I get values around -110. However, these aren't some kind of minima or maxima; I'll get values that don't seem to correlate with luminance at all when on a non all-white or all-black background.
My question is, how should these luminance values be interpreted, and are they correlated in any way at all with the brightness of the image at a particular pixel? Am I retrieving the luminance values for the frame buffer correctly, and if not, how should one retrieve them?