Hello I search hard but not find anything useful so I post here.
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 crapy Maybe someone has ever try to do this, have
the same problem or just can help or have another idea for image
processing?? Or maybe I don't even get rgb_565 in this byte array???
here is my method body:
private synchronized void 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;
}
}
mPhotoPicture2 = Bitmap.createBitmap(argbArray,
CameraView.PICTURE_WIDTH, CameraView.PICTURE_HEIGHT,
Bitmap.Config.ARGB_8888);
}
After That I simply display mPhotoPicture2 on the screen to test, and
all I get is badly hype.
--
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