fixup! Fix images that have values outside of 0-1 range
This commit is contained in:
+6
-5
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user