From 65ecfb533bff6498b68476de6e44733a5e6f8006 Mon Sep 17 00:00:00 2001 From: gr5 Date: Sat, 19 Jul 2025 13:03:38 -0400 Subject: [PATCH] Fixed bug in histogram feature (button above countour plot) that was causing intermittent crashes --- pixelstats.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pixelstats.cpp b/pixelstats.cpp index 56162f95..e9bc20bd 100644 --- a/pixelstats.cpp +++ b/pixelstats.cpp @@ -493,11 +493,8 @@ void pixelStats::updateHisto(){ ui->histo->detachItems( QwtPlotItem::Rtti_PlotCurve); ui->histo->detachItems( QwtPlotItem::Rtti_PlotMarker); ui->histo->detachItems(QwtPlotItem::Rtti_PlotItem); - // Quantize the hue to 30 levels - // and the saturation to 32 levels - int hbins = 1000, sbins = 32; - int histSize[] = {hbins, sbins}; - // hue varies from 0 to 179, see cvtColor + int hbins = 1000; // make histogram with 1000 bins + int histSize[] = {hbins}; cv::Mat hist; @@ -510,7 +507,7 @@ void pixelStats::updateHisto(){ float hranges[] = { (float)m_wf->min, (float)m_wf->max}; const float* ranges[] = { hranges }; - int channels[] = {0, 1}; + int channels[] = { 0 }; cv::calcHist( &values, 1, channels, m_wf->workMask, // do not use mask hist, 1, histSize, ranges, true, // the histogram is uniform