Hello.
I try to write method to make converion from rgb_565 byte array to argb_8888
array.
I need this becouse I want to make a lot of image processing from taken
photo and I get image data in byte array rgb_565 format (as I believe).
Firstly after creating reference to Camera i do:

>
> parameters.setPictureFormat(PixelFormat.RGB_565);
>
and push it to Camera.
mCamera.setParameters(parameters);
Then I implement:
onPictureTaken(byte[] imageData, Camera c)
method in Camera.PictureCallback

After I use my own method like this:
convert2ArgbArray(imageData, imageData.length);
Result is a little crappy ;( Maybe someone has ever try to do this, have the
same problem or just can help or have another idea for image processing??
Here is my method:

>    private synchronized int[] convert2ArgbArray(byte[] imageData, int
>  arraySize){
>
>           int argbArray[] = new int[CameraView.PICTURE_HEIGHT*CameraView.
> PICTURE_WIDTH];
>           int argbCounter = 0;
>
>           int r = 0x00,
>                g = 0x00,
>                b = 0x00;
>
>           for (int i = 0 ; i < arraySize; i++){
>
>                if (i%2==0){
>                     r = (imageData[i] >> 3 & 0x0000001F) << 19;
>                     g = (imageData[i] & 0x00000007) << 3;
>
>                } else {
>                     g = (((imageData[i] >> 5) & 0x7) | g ) << 10 ;
>                     b = (imageData[i] & 0x1f)  << 3;
>
>                     //insert into new array
>                     argbArray[argbCounter] = 0xff000000 | r | g| b;
>                     argbCounter = argbCounter + 1;
>
>                }
>           }
>           return argbArray;
>      }
-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to