On my Samsung Galaxy A54 5G device with Android 14 I am trying the camera2 API and to take image in YUV 420 format. Device only supports JPEG and YUV 420. I tried many of methods to convert from YUV 420 to RGBA bitmap and display/save it but no matter which method, all of them works more or less and returns a correct but a greenish image. Among others I tried the below methods:
As mentioned earlier, all of the above methods are returning a greenish (or yellowish) image, where the greenish is visible mostly on white/gray areas, like the below example taken with my dev app:
What I would expect as a correct conversion result is something very similar to the below reference screenshot:
Update #1: Tried some of the available codes & examples on a Huawei device and there are the colors correct! For example the simplest way using ScriptIntrinsicYuvToRGB gives correct colors on the Huawei device but returns greenish image on Samsung. Apparently it's a weird Samsung behaviour.
Update #2: The HDRViewFinder demo available in google camera samples gives correct color but unfortunately it's renderscript part I can't use on Xamarin.Android platform. Is it possible to somehow rewrite it's hdrmerge code to a native Android code?
It took me ages to figure out but problem finally solved!
In the camera capture request settings before capture I had to change the WhiteBalance settings from Auto to Fluorescent and the green tint from final image is gone!