I think you got a bit confused. Use NV21 for setPreviewFormat (which is 
YUV420sp), and Jpeg for setPictureFormat.

If you want to process RGB pixels on the "onPictureTaken" callback which is 
when a picture is taken, then use the next line:

public void onPictureTaken(final byte[] data, final Camera camera)
{
Bitmap bitmap = BitmapFactory.decodeByteArray(jpegData, 0, jpegData.length);
        ....
}

If instead you want to process the preview frames, then you need to find a 
converter for YUV42sp to RGB, there are many around if you google a bit.


On Saturday, March 16, 2013 5:45:08 AM UTC+1, Qianqian Fang wrote:
>
> Based on the help for getSupportedPreviewFormats [1], NV21 should be 
> always supported. However, when I run 
>
> camParam = mCamera.getParameters(); 
> camParam.setPictureFormat(ImageFormat.NV21); 
> mCamera.setParameters(camParam); 
>
> on my nexus 4, I get an error "setParameters failed". The only way to 
> get through is to use ImageFormat.JPEG, which is the default. is nv21 
> supported on nexus 4? 
>
> if I can not set format to nv21, how can I read the RGB values per 
> pixel with an JPEG preview buffer format? 
>
> thanks 
>
> Qianqian 
>
>
> [1] 
> http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getSupportedPreviewFormats()
>  
>

-- 
-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to