Add interval of pixel range
This commit is contained in:
1 parent
f8eb8a3650
commit
fdcb04e400
4 files changed
+93
-22
No files matched your search
+25
-13
@@ -143,8 +143,8 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
QLabel *rangeLabel = new QLabel( tr( "Range:" ) );
|
||||
rangeLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
QLabel *rangeSelectionLabel = new QLabel( tr( "Range:" ) );
|
||||
rangeSelectionLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
minInterv = new QSpinBox;
|
||||
minInterv->setRange( 0, 255 );
|
||||
@@ -161,7 +161,7 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
|
||||
" of the histogram selection." ) );
|
||||
|
||||
QHBoxLayout *rangeLayout = new QHBoxLayout;
|
||||
rangeLayout->addWidget( rangeLabel );
|
||||
rangeLayout->addWidget( rangeSelectionLabel );
|
||||
rangeLayout->addWidget( minInterv );
|
||||
rangeLayout->addWidget( maxInterv );
|
||||
|
||||
@@ -179,6 +179,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
|
||||
labelCountValue = new QLabel;
|
||||
labelCountValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QLabel *rangeLabel = new QLabel( tr( "Range:" ) );
|
||||
rangeLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
labelRangeValue = new QLabel;
|
||||
labelRangeValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QLabel *meanLabel = new QLabel( tr( "Mean:" ) );
|
||||
meanLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
labelMeanValue = new QLabel;
|
||||
@@ -199,17 +204,20 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
|
||||
labelPercentileValue = new QLabel;
|
||||
labelPercentileValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
Int gridRow = 0;
|
||||
QGridLayout *statisticsLayout = new QGridLayout;
|
||||
statisticsLayout->addWidget( pixelsLabel, 0, 0 );
|
||||
statisticsLayout->addWidget( labelPixelsValue, 0, 1 );
|
||||
statisticsLayout->addWidget( countLabel, 1, 0 );
|
||||
statisticsLayout->addWidget( labelCountValue, 1, 1 );
|
||||
statisticsLayout->addWidget( meanLabel, 2, 0 );
|
||||
statisticsLayout->addWidget( labelMeanValue, 2, 1 );
|
||||
statisticsLayout->addWidget( stdDevLabel, 3, 0 );
|
||||
statisticsLayout->addWidget( labelStdDevValue, 3, 1 );
|
||||
statisticsLayout->addWidget( medianLabel, 4, 0 );
|
||||
statisticsLayout->addWidget( labelMedianValue, 4, 1 );
|
||||
statisticsLayout->addWidget( pixelsLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelPixelsValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( countLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelCountValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( rangeLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelRangeValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( meanLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelMeanValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( stdDevLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelStdDevValue, gridRow++, 1 );
|
||||
statisticsLayout->addWidget( medianLabel, gridRow, 0 );
|
||||
statisticsLayout->addWidget( labelMedianValue, gridRow++, 1 );
|
||||
// statisticsLayout->addWidget( percentileLabel, 5, 0 );
|
||||
// statisticsLayout->addWidget( labelPercentileValue, 5, 1 );
|
||||
|
||||
@@ -437,6 +445,10 @@ Void FramePropertiesDock::updateStatistiques()
|
||||
|
||||
if( frame )
|
||||
{
|
||||
|
||||
QString rangeText = "[" + QString::number( frame->getMin( channel ) ) + ":" + QString::number( frame->getMax( channel ) ) + "]";
|
||||
labelRangeValue->setText( rangeText );
|
||||
|
||||
double mean = frame->getMean( channel, min, max );
|
||||
labelMeanValue->setText( value.setNum( mean, 'f', 1 ) );
|
||||
|
||||
|
||||
@@ -90,19 +90,15 @@ private:
|
||||
QSpinBox *minInterv;
|
||||
QSpinBox *maxInterv;
|
||||
|
||||
QLabel *colorsLabel;
|
||||
QLabel *labelMeanValue;
|
||||
QLabel *labelPixelsValue;
|
||||
QLabel *labelStdDevValue;
|
||||
QLabel *labelCountValue;
|
||||
QLabel *labelRangeValue;
|
||||
QLabel *labelMeanValue;
|
||||
QLabel *labelStdDevValue;
|
||||
QLabel *labelMedianValue;
|
||||
QLabel *labelPercentileValue;
|
||||
QLabel *formatValueLabel;
|
||||
QLabel *sizeValueLabel;
|
||||
QLabel *colorSpaceValueLabel;
|
||||
QLabel *colorModeValueLabel;
|
||||
QLabel *depthValueLabel;
|
||||
QLabel *alphaValueLabel;
|
||||
|
||||
QLabel *colorsLabel;
|
||||
|
||||
QRect m_cSelectionArea;
|
||||
|
||||
|
||||
@@ -901,6 +901,66 @@ Int getRealHistoChannel( Int colorSpace, Int channel )
|
||||
return histoChannel;
|
||||
}
|
||||
|
||||
UInt PlaYUVerFrame::getMin( Int channel )
|
||||
{
|
||||
UInt value;
|
||||
Int histoChannel;
|
||||
Int indexStart;
|
||||
|
||||
if( !d->m_bHasHistogram )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
histoChannel = getRealHistoChannel( getColorSpace(), channel );
|
||||
|
||||
if( histoChannel == -1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
indexStart = histoChannel * d->m_uiHistoSegments;
|
||||
|
||||
for( value = 0; value <= d->m_uiHistoSegments; value++ )
|
||||
{
|
||||
if( d->m_puiHistogram[indexStart + value] > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
UInt PlaYUVerFrame::getMax( Int channel )
|
||||
{
|
||||
Int value;
|
||||
Int histoChannel;
|
||||
Int indexStart;
|
||||
|
||||
if( !d->m_bHasHistogram )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
histoChannel = getRealHistoChannel( getColorSpace(), channel );
|
||||
|
||||
if( histoChannel == -1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
indexStart = histoChannel * d->m_uiHistoSegments;
|
||||
|
||||
for( value = d->m_uiHistoSegments - 1; value >= 0; value-- )
|
||||
{
|
||||
if( d->m_puiHistogram[indexStart + value] > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
UInt PlaYUVerFrame::getCount( Int channel, UInt start, UInt end )
|
||||
{
|
||||
UInt i;
|
||||
|
||||
@@ -223,6 +223,9 @@ public:
|
||||
*/
|
||||
Void calcHistogram();
|
||||
|
||||
UInt getMin( Int channel );
|
||||
UInt getMax( Int channel );
|
||||
|
||||
UInt getCount( Int channel, UInt start, UInt end );
|
||||
Double getMean( Int channel, UInt start, UInt end );
|
||||
Int getMedian( Int channel, UInt start, UInt end );
|
||||
|
||||
Reference in new issue
Block a user