ipa: raspberrypi: Estimate the colour temerature if starting with fixed colour gains
When the AWB is started from "cold" with fixed colour gains, we try to estimate the colour temperature this corresponds to (if a calibrated CT curve was supplied). When fixed colour gains are set after the AWB has been running, we leave the CT estimate alone, as the one we have is probably sensible. This estimated colour is passed out in the metadata for other algorithms - notably ALSC - to use. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
1a6a7d4a8e
commit
4cd283acd0
3 changed files with 20 additions and 1 deletions
|
@ -19,6 +19,9 @@ using namespace RPiController;
|
|||
|
||||
const double Awb::RGB::INVALID = -1.0;
|
||||
|
||||
// todo - the locking in this algorithm needs some tidying up as has been done
|
||||
// elsewhere (ALSC and AGC).
|
||||
|
||||
void AwbMode::Read(boost::property_tree::ptree const ¶ms)
|
||||
{
|
||||
ct_lo = params.get<double>("lo");
|
||||
|
@ -121,6 +124,7 @@ Awb::Awb(Controller *controller)
|
|||
async_abort_ = async_start_ = async_started_ = async_finished_ = false;
|
||||
mode_ = nullptr;
|
||||
manual_r_ = manual_b_ = 0.0;
|
||||
first_switch_mode_ = true;
|
||||
async_thread_ = std::thread(std::bind(&Awb::asyncFunc, this));
|
||||
}
|
||||
|
||||
|
@ -199,9 +203,19 @@ void Awb::SwitchMode([[maybe_unused]] CameraMode const &camera_mode,
|
|||
prev_sync_results_.gain_r = manual_r_;
|
||||
prev_sync_results_.gain_g = 1.0;
|
||||
prev_sync_results_.gain_b = manual_b_;
|
||||
// If we're starting up for the first time, try and
|
||||
// "dead reckon" the corresponding colour temperature.
|
||||
if (first_switch_mode_ && config_.bayes) {
|
||||
Pwl ct_r_inverse = config_.ct_r.Inverse();
|
||||
Pwl ct_b_inverse = config_.ct_b.Inverse();
|
||||
double ct_r = ct_r_inverse.Eval(ct_r_inverse.Domain().Clip(1 / manual_r_));
|
||||
double ct_b = ct_b_inverse.Eval(ct_b_inverse.Domain().Clip(1 / manual_b_));
|
||||
prev_sync_results_.temperature_K = (ct_r + ct_b) / 2;
|
||||
}
|
||||
sync_results_ = prev_sync_results_;
|
||||
}
|
||||
metadata->Set("awb.status", prev_sync_results_);
|
||||
first_switch_mode_ = false;
|
||||
}
|
||||
|
||||
void Awb::fetchAsyncResults()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue