saki4510t / UVCCamera

library and sample to access to UVC web camera on non-rooted Android device
2.99k stars 1.2k forks source link

IFrameCallback sends bytes in BGR format (instead of RGB) #483

Open anonym24 opened 5 years ago

anonym24 commented 5 years ago

When I convert bytes[] data from IFrameCallback to Bitmap with Android RenderScript https://stackoverflow.com/questions/20358803/how-to-use-scriptintrinsicyuvtorgb-converting-byte-yuv-to-byte-rgba it's in BGR channel but Android uses RGB

Everything is ok if I convert byte array from default internal device camera (onPreviewFrame). It's in RGB

How to make this library send byte arrays from external usb camera in RGB format?

I use this example https://github.com/saki4510t/UVCCamera/blob/master/usbCameraTest0/src/main/java/com/serenegiant/usbcameratest0/MainActivity.java

anonym24 commented 5 years ago

Converting from BGR to RGB eats quite a lot of cpu

gxshao commented 5 years ago

it's make no sense, why ScriptIntrinsicYuvToRGB output BGR?

anonym24 commented 5 years ago

@gxshao because USB camera sends BGR frames, everything is ok with built-in device cameras (front and back), blue and red channels are in the correct position