Improve histogram for 8 bit images
This commit is contained in:
+3
-2
@@ -40,7 +40,8 @@ void Histogram::paintEvent(QPaintEvent *)
|
|||||||
uint64_t end =(i+1) * m_histogram.size() / w;
|
uint64_t end =(i+1) * m_histogram.size() / w;
|
||||||
for(uint64_t o = start; o < end; o++)
|
for(uint64_t o = start; o < end; o++)
|
||||||
sum += m_histogram[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());
|
float scale = *std::max_element(m_points.begin(), m_points.end());
|
||||||
if(m_log)
|
if(m_log)
|
||||||
@@ -57,7 +58,7 @@ void Histogram::paintEvent(QPaintEvent *)
|
|||||||
points.push_back(QPointF(0, h));
|
points.push_back(QPointF(0, h));
|
||||||
for(size_t i = 0; i < m_points.size(); i++)
|
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));
|
points.push_back(QPoint(w, h));
|
||||||
painter.setBrush(Qt::gray);
|
painter.setBrush(Qt::gray);
|
||||||
|
|||||||
Reference in New Issue
Block a user