Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onPreviewFrame(byte[] data, Camera camera) {
- // TODO Auto-generated method stub
- if( mYuv != null ) mYuv.release();
- mYuv = new Mat( height + height/2, width, CvType.CV_8UC1 );
- mYuv.put( 0, 0, data );
- Mat mRgba = new Mat();
- Imgproc.cvtColor( mYuv, mRgba, Imgproc.COLOR_YUV2RGBA_NV21, 4 );
- Bitmap map = Bitmap.createBitmap( width, height, Bitmap.Config.ARGB_8888 );
- Utils.matToBitmap( mRgba, map );
- preview.setBackgroundDrawable( new BitmapDrawable( where.getResources(), map ));
- mRgba.release();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement