/**
* 图片格式转换
*/
private final int colorFormatI420 = 1;
private final int colorFormatNV21 = 2;
private byte[] data = new byte[0];
private byte[] rowData = new byte[0];
private byte[] getDataFromImage(Image image, int colorFormat) {
Rect crop = image.getCropRect();
int format = image.getFormat();
int width = crop.width();
int height = crop.height();
Image.Plane[] planes = image.getPlanes();
if (data.length == 0) {
data = new byte[width * height * ImageFormat.getBitsPerPixel(format) / 8];
}
if (rowData.length == 0) {
rowData = new byte[planes[0].getRowStride()];
}
int channelOffset = 0;
int outputStride = 1;
for (int i = 0; i < planes.length; i++) {