-1


does anybody know what pixel type does BitmapFactory.decodeByteArray() returns?

basicly i'm using this snippet on the camera preview callback:

YuvImage img = new YuvImage(mLastFrame, ImageFormat.NV21, mPreviewSize.width, mPreviewSize.height, null);
ByteArrayOutputStream out = new ByteArrayOutputStream();
img.compressToJpeg(new Rect(0,0,mPreviewSize.width, mPreviewSize.height), 30, out);
return BitmapFactory.decodeByteArray(out.toByteArray(), 0, out.size());

i get a good Bitmap which i can use with android. but if i want to use it with OpenCV, it doesn't work, and as OpenCV requires an ARGB_8888 type, i'm guessing, i get another type from the decodeByteArray() function.

thanks,
Vlad

Vlad
  • 735
  • 2
  • 10
  • 19

1 Answers1

2

You can use Bitmap.getConfig() on your resulting Bitmap and see if it is ALPHA_8, RGB_565 etc...

Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158