From 4ce9b0f010c92e856603e15341c57bbc5586388b Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 30 Jan 2018 00:35:18 +0100 Subject: [PATCH] avoid dependency of histmatching on the current demosaic algo (by performing an internal demosaicing step in histogram matching. Obviously this gets slower...) --- rtengine/histmatching.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index 4216c4581..56fe21d80 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -160,6 +160,8 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) } ProcParams neutral; + neutral.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST); + neutral.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST); std::unique_ptr source; { @@ -205,8 +207,15 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) } PreviewProps pp(cx, cy, fw, fh, skip); ColorTemp currWB = getWB(); + std::unique_ptr image(new Imagefloat(int(fw / skip), int(fh / skip))); - getImage(currWB, TR_NONE, image.get(), pp, neutral.toneCurve, neutral.raw); + { + RawImageSource rsrc; + rsrc.load(getFileName()); + rsrc.preprocess(neutral.raw, neutral.lensProf, neutral.coarse, false); + rsrc.demosaic(neutral.raw); + rsrc.getImage(currWB, TR_NONE, image.get(), pp, neutral.toneCurve, neutral.raw); + } // this could probably be made faster -- ideally we would need to just // perform the transformation from camera space to the output space