Message ID | 20250319161152.63625-14-stefan.klug@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Quoting Stefan Klug (2025-03-19 16:11:18) > Use the color gains for white balance if calibrated light sources are > contained in the tuning file. The results are generally better > especially when large uniformly colored objects are in the scene. Pure > grey world model is still available by removing the color gains from the > tuning file. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> > --- > src/ipa/rkisp1/algorithms/awb.cpp | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp > index 58b8370d2c61..286d9e3e2018 100644 > --- a/src/ipa/rkisp1/algorithms/awb.cpp > +++ b/src/ipa/rkisp1/algorithms/awb.cpp > @@ -218,6 +218,16 @@ void Awb::prepare(IPAContext &context, const uint32_t frame, > auto &awb = context.activeState.awb; > frameContext.awb.gains = awb.automatic.gains; > frameContext.awb.temperatureK = awb.automatic.temperatureK; > + > + const auto &gains = awbAlgo_->gainsFromColourTemperature( > + awb.automatic.temperatureK); > + if (gains) { > + frameContext.awb.gains.r() = gains->r(); > + frameContext.awb.gains.g() = 1.0; > + frameContext.awb.gains.b() = gains->b(); > + } else { > + frameContext.awb.gains = awb.automatic.gains; > + } > } > > auto gainConfig = params->block<BlockType::AwbGain>(); > -- > 2.43.0 >
Hi Stefan, Thank you for the patch. On Wed, Mar 19, 2025 at 05:11:18PM +0100, Stefan Klug wrote: > Use the color gains for white balance if calibrated light sources are > contained in the tuning file. The results are generally better > especially when large uniformly colored objects are in the scene. Pure > grey world model is still available by removing the color gains from the > tuning file. We'll get an error in the log for every frame then. I think that needs to be addressed. > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> > --- > src/ipa/rkisp1/algorithms/awb.cpp | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp > index 58b8370d2c61..286d9e3e2018 100644 > --- a/src/ipa/rkisp1/algorithms/awb.cpp > +++ b/src/ipa/rkisp1/algorithms/awb.cpp > @@ -218,6 +218,16 @@ void Awb::prepare(IPAContext &context, const uint32_t frame, > auto &awb = context.activeState.awb; > frameContext.awb.gains = awb.automatic.gains; This doesn't seem to be needed anymore. > frameContext.awb.temperatureK = awb.automatic.temperatureK; > + > + const auto &gains = awbAlgo_->gainsFromColourTemperature( > + awb.automatic.temperatureK); > + if (gains) { > + frameContext.awb.gains.r() = gains->r(); > + frameContext.awb.gains.g() = 1.0; > + frameContext.awb.gains.b() = gains->b(); > + } else { > + frameContext.awb.gains = awb.automatic.gains; > + } Shouldn't this be done in Awb::process() where awb.automatic.gains is set ? Or maybe even in calculateAwb() ? > } > > auto gainConfig = params->block<BlockType::AwbGain>();
diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 58b8370d2c61..286d9e3e2018 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -218,6 +218,16 @@ void Awb::prepare(IPAContext &context, const uint32_t frame, auto &awb = context.activeState.awb; frameContext.awb.gains = awb.automatic.gains; frameContext.awb.temperatureK = awb.automatic.temperatureK; + + const auto &gains = awbAlgo_->gainsFromColourTemperature( + awb.automatic.temperatureK); + if (gains) { + frameContext.awb.gains.r() = gains->r(); + frameContext.awb.gains.g() = 1.0; + frameContext.awb.gains.b() = gains->b(); + } else { + frameContext.awb.gains = awb.automatic.gains; + } } auto gainConfig = params->block<BlockType::AwbGain>();
Use the color gains for white balance if calibrated light sources are contained in the tuning file. The results are generally better especially when large uniformly colored objects are in the scene. Pure grey world model is still available by removing the color gains from the tuning file. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- src/ipa/rkisp1/algorithms/awb.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+)