有字节数组YUV NV21
如何进行转换并将其保存为jpg文件?
我使用下一个代码
byte[] mYUVData = YUV_420_888toNV21(planeY, planeU, planeV);
Mat mYuv = new Mat(1080 + 1080/2, 1040, CvType.CV_8UC1);
mYuv.put(0, 0, mYUVData);
Mat mRgba = new Mat();
Imgproc.cvtColor( mYuv, mRgba, Imgproc.COLOR_YUV420sp2RGBA );
// Read image as before
MatOfByte mob=new MatOfByte();
Imgcodecs.imencode(".jpg", mYuv, mob);
byte ba[]=mob.toArray();
BufferedImage bi= ImageIO.read(new ByteArrayInputStream(ba));
ImageIO.write(bi, "jpg", new File("C://Users/it/Downloads/image.jpg"));