Issues with Camera Preview

I am currently trying to develop on a Motorola Droid for a project, and I am trying to use the camera preview and its callback for taking the images directly from the feed.

This has not been as straightforward as I thought it should be, mostly due to the preview being in the YUVSP420 (at least, I believe so) format. After searching through a lot of the developer resources, I found some conversion code posted by (who I believe was) an Android Engineer, which would convert the raw image to a RGB, but I cannot seem to get this to work correctly. I get a very warped image, with the colors very far off. I think this may be due to using the wrong resolution for the conversion.

My question here, mostly, is does anyone have any suggestions? Also, is there an easy way to find what resolution an image is from the previewCallback? I can post more specific code and values, if they are necessary, I just do not have it running right now.

What are you trying to accomplish with the callback? It seems like using camera.takePicture() would be a better choice if you're working with the image data in most cases. That'd let you specify the jpeg callback, which gives you a much more easily used format.

My application is more real time. I first investigated taking the picture itself, but the lag will be a bit much for me to handle (in in the end, the plan is to make a disability assistance program for people with limited vision).

So, in essence, I looked into picture taking, but it wouldn't serve my needs.

The preview format is only available in FroYo, but I was able to find a workaround from a post by a Google engineer. Hopefully, when I finally get FroYo on my dev phone, it'll be a much quicker process!

They come normally in the YUV420 format, that's just how the camera takes them. I am unsure of how it handles it when the format is changed (I haven't been able to try it in 2.2).

The easiest way to find out if it's coming is probably to just use the BitmapFactory.decodeByteArray method. Since it's (at least should be) coming in as JPEG, the BitmapFactory should recognize it and convert it.