From 74e31dff45293ca5e8ce3fe22c1d870eca290b65 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Wed, 31 Jan 2018 18:09:28 +0100 Subject: [PATCH] histmatching: dynamically adjust the skip factor according to the side of the embedded thumbnail with large the embedded thumbnails we should skip less to improve the quality of the matching --- rtengine/histmatching.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index e496f6f82..e326a3f7d 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -189,7 +189,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) int fw, fh; getFullSize(fw, fh, TR_NONE); - int skip = 10; + int skip = 3; if (settings->verbose) { std::cout << "histogram matching: full raw image size is " << fw << "x" << fh << std::endl; @@ -213,6 +213,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) histMatchingCache = outCurve; return; } + skip = LIM(5, skip * fh / h, 10); // adjust the skip factor -- the larger the thumbnail, the less we should skip to get a good match source.reset(thumb->quickProcessImage(neutral, fh / skip, TI_Nearest)); if (settings->verbose) {