StreamPack icon indicating copy to clipboard operation
StreamPack copied to clipboard

[Feat]: WB (White balance) by color temperature

Open Rider02vn opened this issue 11 months ago • 6 comments

Version

2.6.1

Environment that reproduces the issue

Samsung A35 - Android 13

Use case description

Dear. Currently I am using: streamer.settings.camera.whiteBalance.availableAutoModes to get the awb list. And using whiteBalance.autoMode (set) to set the wb mode. availableAutoModes returns a list of integers, as my device is returning: [1, 2, 3, 4, 5, 6, 7, 8, 0] Currently the camera apps of the devices are using wb based on color temperature (eg from 2300K to 10000K). How can I set the white balance like that ? Thanks.

Image

Image

Image

Proposed solution

No response

Alternative solutions

No response

Rider02vn avatar Feb 26 '25 05:02 Rider02vn

Hi,

In Android camera2, I guess this value in Kelvin is infered from COLOR_CORRECTION_TRANSFORM and COLOR_CORRECTION_GAINS.

As it is not a direct camera2 API settings, it is not that easy.

We need to find the transformation between COLOR_CORRECTION_GAINS, COLOR_CORRECTION_TRANSFORM <-> tempature in K

ThibaultBee avatar Feb 26 '25 10:02 ThibaultBee

Hi Most camera apps and live streaming apps use the K parameter for white balance. I think that might be a common standard and really necessary for this library. Do you plan to develop in that direction for this feature?

Rider02vn avatar Feb 27 '25 04:02 Rider02vn

Hi,

Yes, I plan to implement it. But I have got other priorities right now. The formula for COLOR_CORRECTION_GAINS, COLOR_CORRECTION_TRANSFORM <-> tempature in K seems complex and undocumented. If you find a documentation or an official API, I will integrate it ASAP.

ThibaultBee avatar Feb 27 '25 09:02 ThibaultBee

Hi,

Yes, I plan to implement it. But I have got other priorities right now. The formula for COLOR_CORRECTION_GAINS, COLOR_CORRECTION_TRANSFORM <-> tempature in K seems complex and undocumented. If you find a documentation or an official API, I will integrate it ASAP.

Hi. I also tried searching Google and it was hard to find official documentation for converting color temperature with K. I have now tried this formula and it works as a fallback although it is not 100% accurate. https://stackoverflow.com/a/50077521

Image

Rider02vn avatar Feb 28 '25 07:02 Rider02vn

Hi,

I won't add the temperature to RggbChannelVector now, but I can add a setter/getter for RggbChannelVector (almost what you did). I think the implementation would be a ColorCorrection class in CameraSettings.

ThibaultBee avatar Feb 28 '25 12:02 ThibaultBee

I think that's a reasonable way to go until a more accurate method is found.

Rider02vn avatar Mar 03 '25 03:03 Rider02vn

The 3.0.0-RC contains an API to set RggbChannelVector in the ColorCorrection class.

ThibaultBee avatar Apr 10 '25 07:04 ThibaultBee