I am using camera 2 API to take images
I need only the brightness of the images so I use the y buffer only as below
ByteBuffer buffer = image.getPlanes()[0].getBuffer();
byte[] bytes = new byte[buffer.capacity()];
buffer.get(bytes);
as far as i know the y plane has all the image pixels and each value of pixel brightness is stored in the byte array value, whats the sequnce they are stored in ? for example is image is like this :
xxxxx
yyyyy
zzzzz
then the bytes array would be like [xxxxyyyyyzzzzz] or [xyzxyzxyzxyz] ?
I tried both sequence but I keep getting wrong results also when I try different phones I get different results ? while the resolution is fixed the image format is YUV_420 the images that I use are only black or white !