Created
August 14, 2012 03:13
-
-
Save kimkidong/3346014 to your computer and use it in GitHub Desktop.
Convert YUV420 to RGB8888
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in Camera callback preview | |
int w = params.getPreviewSize().width; | |
int h = params.getPreviewSize().height; | |
int format = params.getPreviewFormat(); | |
YuvImage image = new YuvImage(data, format, w, h, null); | |
ByteArrayOutputStream out = new ByteArrayOutputStream(); | |
Rect area = new Rect(0, 0, w, h); | |
image.compressToJpeg(area, 50, out); | |
Bitmap bm = BitmapFactory.decodeByteArray(out.toByteArray(), 0, out.size()); | |
ivCam.setImageBitmap(bm); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment