improve generated curve in histogram matching on underexposed pictures

This commit is contained in:
Alberto Griggio
2018-01-30 10:06:57 +01:00
parent 8af91ce74c
commit 71a3af0c86

View File

@@ -120,6 +120,15 @@ void mappingToCurve(const std::vector<int> &mapping, std::vector<double> &curve)
curve.pop_back();
curve.pop_back();
}
// remove the plateau at the end (if any)
size_t j = curve.size() / 2;
for (; j > 1; --j) {
if (std::abs(curve[2*(j-1)-1] - curve.back()) > 0.01) {
break;
}
}
curve.resize(2*j);
curve.push_back(1.0);
curve.push_back(1.0);