Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public void onPreviewFrame(byte[] data, Camera camera) {
  2. // TODO Auto-generated method stub
  3.  
  4. if( mYuv != null ) mYuv.release();
  5. mYuv = new Mat( height + height/2, width, CvType.CV_8UC1 );
  6. mYuv.put( 0, 0, data );
  7. Mat mRgba = new Mat();
  8.  
  9. Imgproc.cvtColor( mYuv, mRgba, Imgproc.COLOR_YUV2RGBA_NV21, 4 );
  10.  
  11. Bitmap map = Bitmap.createBitmap( width, height, Bitmap.Config.ARGB_8888 );
  12.  
  13. Utils.matToBitmap( mRgba, map );
  14.  
  15. preview.setBackgroundDrawable( new BitmapDrawable( where.getResources(), map ));
  16. mRgba.release();
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement