Maybe someone can help me. I need a Color32[] Array by calling GetPixels32(). Here is a good solution for an QR-Code Reader with webcam. How to decode QR code using Unity3D
Vuforia can unfortunately only give a byte array with...
Image.PIXEL_FORMAT mPixelFormat = Image.PIXEL_FORMAT.RGB565;
Image cameraImage = CameraDevice.Instance.GetCameraImage(mPixelFormat);
byte[] pixels = cameraImage.Pixels;
Does anyone have any idea how I can make a Pixel byte array to an Color32 array? Here is my question in the Vuforia Forum.
Maybe anyone have any other solutions for QR-Code decoding in Unity for Android and iOS. I would be very grateful for your help.
Edit: Here is the same Question in unityAnswers.
It looks like you're requesting the image data in 16-bit R5G6B5 format, so I expect that's what the data format is: pairs of bytes in 5-6-5-bit format. So, converting two bytes to a regular Color structure is something like:
color.r = (byte[0] & 0x1f) / (float)(0x1f);
color.g = ((byte[1] & 0x07) | ((byte[0] & 0xe0) >> 5)) / (float)(0x3f);
color.b = ((byte[1] & 0xf8) >> 3) / (float)(0x1f);
Then you can convert the Color to a Color32 just by casting it.
This said, if you can request the image data in a 24-bit format instead of a 16-bit format then you can just feed the byte values directly to the channels of the Color32.