histmatching: use fewer points in the auto-matched curve
makes editing the curve by hand much easier
This commit is contained in:
@@ -100,7 +100,6 @@ void mappingToCurve(const std::vector<int> &mapping, std::vector<double> &curve)
|
|||||||
{
|
{
|
||||||
curve.clear();
|
curve.clear();
|
||||||
|
|
||||||
const int npoints = 8;
|
|
||||||
int idx = 15;
|
int idx = 15;
|
||||||
for (; idx < int(mapping.size()); ++idx) {
|
for (; idx < int(mapping.size()); ++idx) {
|
||||||
if (mapping[idx] >= idx) {
|
if (mapping[idx] >= idx) {
|
||||||
@@ -114,7 +113,6 @@ void mappingToCurve(const std::vector<int> &mapping, std::vector<double> &curve)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int step = std::max(int(mapping.size())/npoints, 1);
|
|
||||||
|
|
||||||
auto coord = [](int v) -> double { return double(v)/255.0; };
|
auto coord = [](int v) -> double { return double(v)/255.0; };
|
||||||
auto doit =
|
auto doit =
|
||||||
@@ -148,8 +146,16 @@ void mappingToCurve(const std::vector<int> &mapping, std::vector<double> &curve)
|
|||||||
++start;
|
++start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int npoints = 8;
|
||||||
|
int step = std::max(int(mapping.size())/npoints, 1);
|
||||||
|
int end = mapping.size();
|
||||||
|
if (idx <= end / 3) {
|
||||||
|
doit(start, idx, idx / 2, true);
|
||||||
|
doit(idx, end, (end - idx) / 3, false);
|
||||||
|
} else {
|
||||||
doit(start, idx, idx > step ? step : idx / 2, true);
|
doit(start, idx, idx > step ? step : idx / 2, true);
|
||||||
doit(idx, int(mapping.size()), step, idx - step > step / 2 && std::abs(curve[curve.size()-2] - coord(idx)) > 0.01);
|
doit(idx, int(mapping.size()), step, idx - step > step / 2 && std::abs(curve[curve.size()-2] - coord(idx)) > 0.01);
|
||||||
|
}
|
||||||
|
|
||||||
if (curve.size() > 2 && (1 - curve[curve.size()-2] <= step / (256.0 * 3))) {
|
if (curve.size() > 2 && (1 - curve[curve.size()-2] <= step / (256.0 * 3))) {
|
||||||
curve.pop_back();
|
curve.pop_back();
|
||||||
|
Reference in New Issue
Block a user