fixup! Fix images that have values outside of 0-1 range

This commit is contained in:
2025-03-09 17:51:26 +01:00
parent c05fc36ee3
commit 96a89bff92
+6 -5
View File
@@ -243,11 +243,6 @@ void calcStats(const T *data, size_t n, size_t w, RawImage::Stats &stats)
{
T mmin = *std::min_element(min, min + 4);
T mmax = *std::max_element(max, max + 4);
for(int i=0; i<4; i++)
{
histogram[i].clear();
histogram[i].resize(histSize, 0);
}
T a = 1.0 / (mmax - mmin);
T b = -mmin / (mmax - mmin);
@@ -261,6 +256,12 @@ void calcStats(const T *data, size_t n, size_t w, RawImage::Stats &stats)
// calculate histogram again
if(mmin < 0.0 || mmax > 1.0)
{
for(int i=0; i<4; i++)
{
histogram[i].clear();
histogram[i].resize(histSize, 0);
}
for(size_t i = 0; i < n; i++)
{
histFunc(data[i*ch], 0);