There is no way to convert the preview frames that come as YUV data from
Camera.SetPrivewCallBack() into a bitmap.To draw the preview frames, you can
call Camera.startPreview() and the system takes care of the drawing.
CameraPreview sample code in ApiDemos is updated to use startPreview() now.


On Fri, Aug 22, 2008 at 4:50 AM, blindfold <[EMAIL PROTECTED]>wrote:

>
> I am trying to acquire camera preview images through
> onPreviewFrame(byte[] data, Camera c)  and, within this callback
> function, BitmapFactory.decodeByteArray(data, 0, data.length). The
> callback works and does get called as shown by my debug output.
> However, the Eclipse log file  shows error messages tagged by
> CameraHardwareStub stating that only yuv422sp preview is  supported,
> e.g., if I apply setPreviewFormat() to set PixelFormat.RGB_565 or
> PixelFormat.JPEG. BitmapFactory.decodeByteArray indeed returns null as
> expected under this pixel format restriction.
>
> Now I do not find support for something like PixelFormat.YUV_422_SP
> for use with  BitmapFactory.decodeByteArray. There is
> PixelFormat.YCbCr_422_SP, but with that,
> BitmapFactory.decodeByteArray(data, 0, data.length) still returns
> null. What's wrong? Is  Android lacking a set of compatible image
> formats across the various Camera and Bitmap APIs? That would be bad.
>
> Moreover, data.length in the callback is twice the number of pixels,
> implying a 16 bits per  pixel encoding, while yuv422sp would seem to
> be an 8 bit encoding?
>
> So what should be done here to decode preview images into a Bitmap for
> further image  processing? Or is there an alternative decent way to
> map camera preview images into a Bitmap? A working example would help!
>
> Thanks.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to