libipa: awb: Make result of gainsFromColourTemp optional
In the grey world AWB case, if no colour gains are contained in the tuning file, the colour gains get reset to 1 when the colour temperature is set manually. This is unexpected and undesirable. Allow the gainsFromColourTemp() function to return a std::nullopt to handle that case. While at it, remove an unnecessary import from rkisp1/algorithms/awb.h. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
@@ -127,8 +127,12 @@ int Awb::configure(IPAContext &context,
|
||||
const IPACameraSensorInfo &configInfo)
|
||||
{
|
||||
context.activeState.awb.manual.gains = RGB<double>{ 1.0 };
|
||||
context.activeState.awb.automatic.gains =
|
||||
awbAlgo_->gainsFromColourTemperature(kDefaultColourTemperature);
|
||||
auto gains = awbAlgo_->gainsFromColourTemperature(kDefaultColourTemperature);
|
||||
if (gains)
|
||||
context.activeState.awb.automatic.gains = *gains;
|
||||
else
|
||||
context.activeState.awb.automatic.gains = RGB<double>{ 1.0 };
|
||||
|
||||
context.activeState.awb.autoEnabled = true;
|
||||
context.activeState.awb.manual.temperatureK = kDefaultColourTemperature;
|
||||
context.activeState.awb.automatic.temperatureK = kDefaultColourTemperature;
|
||||
@@ -185,11 +189,13 @@ void Awb::queueRequest(IPAContext &context,
|
||||
*/
|
||||
update = true;
|
||||
} else if (colourTemperature) {
|
||||
const auto &gains = awbAlgo_->gainsFromColourTemperature(*colourTemperature);
|
||||
awb.manual.gains.r() = gains.r();
|
||||
awb.manual.gains.b() = gains.b();
|
||||
awb.manual.temperatureK = *colourTemperature;
|
||||
update = true;
|
||||
const auto &gains = awbAlgo_->gainsFromColourTemperature(*colourTemperature);
|
||||
if (gains) {
|
||||
awb.manual.gains.r() = gains->r();
|
||||
awb.manual.gains.b() = gains->b();
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (update)
|
||||
|
||||
Reference in New Issue
Block a user