Thursday, January 7, 2010

[android-developers] converting ycbcr 420 to rgb

Hi,
I want to display the preview frames of an android smartphone on an
opengl texture. As opengl es only support RGB and the preview frame is
encoded with YCbCr 4:2:0. Therefor I have to convert from one to the
other. Though I wasn't successful in doing so, so far. Maybe someone
can help me with it. I found some sources/example code here:

http://groups.google.de/group/android-developers/browse_thread/thread/c85e829ab209ceea/adca218ec3555c81?lnk=gst&q=ycbcr+420+rgb#adca218ec3555c81
http://www.netmite.com/android/mydroid/donut/development/tools/yuv420sp2rgb/yuv420sp2rgb.c
http://blog.tomgibara.com/post/132956174/yuv420-to-rgb565-conversion-in-android

my code can be found here:
http://code.google.com/p/andar/source/browse/#svn/trunk/AndOpenGLCam/src/edu/dhbw/andopenglcam
especially the classes CameraPreviewHandler.java and
OpenGLCamRenderer.java are important.

When using the example from the android project(http://tinyurl.com/
y9l36tl
) it results in this:
http://picfront.de/d/Saj1pYfo4/IMG_7715.jpg

I can get the best result from using the outcommented formula from
(http://tinyurl.com/y9l36tl) and inverting RGB in BGR:
http://picfront.de/d/x4iMqes9/IMG_7717.jpg
it shows red planes in green and some blue edges around everything...

any help is appreciated :D

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate