Unlike the previous android Camera API, which preferred the NV21 image format, the new Camera2 API seems to want to use YUV_420_888. I would like to convert a YUV_420_888 preview image to a GrayU8 instance as efficiently as possible. My understanding is that the Y color plane already represents the grayscale data. I currently have the following code to obtain the first plane's bytes:
Image image = reader.acquireLatestImage();
ByteBuffer buffer = image.getPlanes()[0].getBuffer();
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
Hoping there is BoofCV method that accepts these bytes and returns a GrayU8. Any help is greatly appreciated.
- Ken