Sum all channels histograms

This commit is contained in:
2023-11-14 12:04:55 +01:00
parent d462ece7c9
commit 4a9d720343
3 changed files with 6 additions and 5 deletions
+1 -2
View File
@@ -13,7 +13,7 @@ void Histogram::imageLoaded(Image *img)
{
if(img && img->rawImage())
{
m_histogram = img->rawImage()->imageStats().m_histogram[0];
m_histogram = img->rawImage()->imageStats().m_histogram;
m_points.clear();
update();
}
@@ -29,7 +29,6 @@ void Histogram::paintEvent(QPaintEvent *)
if(m_histogram.size())
{
if(m_points.size() != w)
{
m_points.clear();
+4 -2
View File
@@ -198,8 +198,10 @@ void calcStats(const T *data, size_t n, RawImage::Stats &stats)
}
}
for(size_t i = 0; i < ch; i++)
stats.m_histogram[i] = std::vector<uint32_t>(histogram[i], histogram[i] + histSize);
stats.m_histogram.resize(histSize, 0);
for(size_t i = 0; i < histSize; i++)
for(size_t o = 0; o < ch; o++)
stats.m_histogram[i] += histogram[o][i];
}
void RawImage::calcStats()
+1 -1
View File
@@ -57,7 +57,7 @@ public:
double m_max[4] = {0.0};
double m_mad[4] = {0.0};
uint32_t m_saturated[4] = {0};
std::vector<uint32_t> m_histogram[4];
std::vector<uint32_t> m_histogram;
};
protected:
std::unique_ptr<PixelType[]> m_pixels;