Android yuv转Bitmap

 
YuvImage image = new YuvImage(data, ImageFormat.NV21, size.width, size.height, null);
                if(image!=null){
                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    image.compressToJpeg(new Rect(0, 0, size.width, size.height), 80, stream);

                    Bitmap bmp = BitmapFactory.decodeByteArray(stream.toByteArray(), 0, stream.size());
                    //TODO:此处可以对位图进行处理,如显示,保存等

                    stream.close();

 

posted @ 2017-12-21 09:42  sysu_huangwei  阅读(6439)  评论(0编辑  收藏  举报