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
This commit is contained in:
Alberto Griggio 2018-01-31 18:09:28 +01:00
parent b09aeaa6ae
commit 74e31dff45

View File

@ -189,7 +189,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
int fw, fh; int fw, fh;
getFullSize(fw, fh, TR_NONE); getFullSize(fw, fh, TR_NONE);
int skip = 10; int skip = 3;
if (settings->verbose) { if (settings->verbose) {
std::cout << "histogram matching: full raw image size is " << fw << "x" << fh << std::endl; std::cout << "histogram matching: full raw image size is " << fw << "x" << fh << std::endl;
@ -213,6 +213,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
histMatchingCache = outCurve; histMatchingCache = outCurve;
return; 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)); source.reset(thumb->quickProcessImage(neutral, fh / skip, TI_Nearest));
if (settings->verbose) { if (settings->verbose) {