I'm using camera2 API I'm interested in getting RGB value from byte array actually average of RGB values can I get it from this part when byte array is collected from ByteBuffer and gets written in file with FileOutputStream.write(bytes)
Here is my code:
ByteBuffer byteBuffer = mImage.getPlanes()[0].getBuffer();
byte[] bytes = new byte[byteBuffer.remaining()];
byteBuffer.get(bytes);
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(mImageFile);
fileOutputStream.write(bytes);
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block e.printStackTrace(); } catch
(IOException e) {
// TODO Auto-generated catch block e.printStackTrace();
}
finally {
mImage.close();
try {
fileOutputStream.close();
}
catch (IOException e) { // TODO Auto-generated catch block
e.printStackTrace();
}
}