In an Android application, we can easily save a YUV frame to image using below code:
try {
YuvImage image = new YuvImage(data, format, width, height, null);
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
File file = new File(imageStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpeg");
FileOutputStream fileOut = new FileOutputStream(file);
image.compressToJpeg(new Rect(0, 0, image.getWidth(), image.getHeight()), 90,
fileOut);
} catch (Exception e) {
e.printStackTrace();
}
But my current function returns an RGBA frame so how could I save it to an image? Because I saw that the Android framework does not support RGBA class.