Improve histogram for 8 bit images

This commit is contained in:
2023-11-13 23:15:34 +01:00
parent 46b0210078
commit d462ece7c9
+3 -2
View File
@@ -40,7 +40,8 @@ void Histogram::paintEvent(QPaintEvent *)
uint64_t end =(i+1) * m_histogram.size() / w;
for(uint64_t o = start; o < end; o++)
sum += m_histogram[o];
m_points.push_back(sum);
if(start != end)
m_points.push_back(sum);
}
float scale = *std::max_element(m_points.begin(), m_points.end());
if(m_log)
@@ -57,7 +58,7 @@ void Histogram::paintEvent(QPaintEvent *)
points.push_back(QPointF(0, h));
for(size_t i = 0; i < m_points.size(); i++)
{
points.push_back(QPointF(i, h - m_points[i] * h));
points.push_back(QPointF((float)i * w / m_points.size(), h - m_points[i] * h));
}
points.push_back(QPoint(w, h));
painter.setBrush(Qt::gray);