Fix the wrong statistics value in the frame information dock

This commit is contained in:
2016-04-10 21:05:34 +01:00
parent 6e1455fa52
commit 3a3c012820
5 changed files with 37 additions and 35 deletions
+3 -3
View File
@@ -427,10 +427,9 @@ Void FramePropertiesDock::updateStatistiques()
Int min = minInterv->value();
Int max = maxInterv->value();
Int channel = histogramWidget->m_channelType;
//Int channel = channelCB->currentIndex();
if( channel == HistogramWidget::ColorChannelsHistogram )
channel = colorsCB->currentIndex() + 1;
channel = colorsCB->currentIndex();
PlaYUVerFrame* frame;
@@ -528,7 +527,8 @@ Void FramePropertiesDock::slotChannelChanged( Int channel )
colorsCB->setEnabled( true );
break;
default: // Luminance.
histogramWidget->m_channelType = HistogramWidget::LumaHistogram;
//histogramWidget->m_channelType = HistogramWidget::LumaHistogram;
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
colorsCB->setEnabled( false );
break;
}
+23 -21
View File
@@ -24,7 +24,7 @@
*/
//TODO:
// - Optimizar paintEvent. Parece haver codigo redundante !!
// - Optimizar paintEvent. Parece haver codigo redundante !!
#include "config.h"
#include <cmath>
#include <QtGui>
@@ -63,6 +63,8 @@ public:
// eventData->histogram = m_histogram;
// QCoreApplication::postEvent( m_parent, eventData );
eventData->starting = true;
m_pcFrame->calcHistogram();
eventData->starting = false;
@@ -167,7 +169,7 @@ public:
};
////////////////////////////////////////////////////////////////////////////////
// Constructors
// Constructors
////////////////////////////////////////////////////////////////////////////////
//Constructor without image data
@@ -178,7 +180,8 @@ HistogramWidget::HistogramWidget( Int width, Int height, QWidget *parent ) :
d = new HistogramWidgetPrivate;
m_channelType = LumaHistogram;
// m_channelType = LumaHistogram;
m_channelType = FirstChannelHistogram;
m_scaleType = LogScaleHistogram;
m_colorType = FirstChannelColor;
m_renderingType = FullImageHistogram;
@@ -202,7 +205,7 @@ HistogramWidget::HistogramWidget( Int width, Int height, QWidget *parent ) :
}
////////////////////////////////////////////////////////////////////////////////
// Destructor
// Destructor
////////////////////////////////////////////////////////////////////////////////
HistogramWidget::~HistogramWidget()
{
@@ -220,7 +223,7 @@ HistogramWidget::~HistogramWidget()
delete d;
}
////////////////////////////////////////////////////////////////////////////////
// Setup Functions
// Setup Functions
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::setOptions( HistogramOptions options )
@@ -249,7 +252,7 @@ Void HistogramWidget::reset()
}
////////////////////////////////////////////////////////////////////////////////
// Custom Event Handler
// Custom Event Handler
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::customEvent( QEvent *event )
@@ -341,7 +344,7 @@ Void HistogramWidget::customEvent( QEvent *event )
//delete ed;
}
////////////////////////////////////////////////////////////////////////////////
// Data Loading Functions
// Data Loading Functions
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::setDataLoading()
@@ -390,13 +393,12 @@ Void HistogramWidget::stopHistogramComputation()
}
////////////////////////////////////////////////////////////////////////////////
// Update Data Methods
// Update Data Methods
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::updateData( PlaYUVerFrame *pcFrame, PlaYUVerFrame *pcFrameSelection )
{
d->imageBits = pcFrame->getBitsPel();
//d->imageColorSpace = image.getPelFormat();
d->imageColorSpace = pcFrame->getColorSpace();
d->imageChannels = pcFrame->getNumberChannels();
@@ -429,7 +431,7 @@ Void HistogramWidget::slotBlinkTimerDone()
}
////////////////////////////////////////////////////////////////////////////////
// Paint Event
// Paint Event
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::paintEvent( QPaintEvent * )
@@ -534,9 +536,9 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
case HistogramWidget::ColorChannelsHistogram: // All color channels.
max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ), frame->getMaximum( CHROMA_V ) );
break;
case HistogramWidget::LumaHistogram: // Luminance.
max = frame->getMaximum( LUMA );
break;
// case HistogramWidget::LumaHistogram: // Luminance.
// max = frame->getMaximum( LUMA );
// break;
}
switch( m_scaleType )
@@ -596,11 +598,11 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
case HistogramWidget::ColorChannelsHistogram: // All color.
vr = frame->getHistogramValue( LUMA, i );
vg = frame->getHistogramValue( CHROMA_U, i );
vb = frame->getHistogramValue( CHROMA_U, i++ );
break;
case HistogramWidget::LumaHistogram: // Luminance.
v = frame->getHistogramValue( LUMA, i++ );
vb = frame->getHistogramValue( CHROMA_V, i++ );
break;
// case HistogramWidget::LumaHistogram: // Luminance.
// v = frame->getHistogramValue( LUMA, i++ );
// break;
}
@@ -900,9 +902,9 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
guidePos = d->colorGuide.blue();
break;
case HistogramWidget::LumaHistogram:
guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green() ), d->colorGuide.blue() );
break;
// case HistogramWidget::LumaHistogram:
// guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green() ), d->colorGuide.blue() );
// break;
default: // Alpha.
guidePos = -1;
@@ -985,7 +987,7 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
}
////////////////////////////////////////////////////////////////////////////////
// Mouse Events
// Mouse Events
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::mousePressEvent( QMouseEvent * e )
+2 -2
View File
@@ -49,9 +49,9 @@ public:
enum HistogramChannel
{
/** Luminance */
LumaHistogram = 0,
//LumaHistogram = 0,
/** Channels */
FirstChannelHistogram,
FirstChannelHistogram = 0,
SecondChannelHistogram,
ThirdChannelHistogram,
/** Alpha channel */
+8 -8
View File
@@ -681,11 +681,11 @@ Int PlaYUVerFrame::getRealHistoChannel( Int channel )
}
else
{
if( channel == LUMA )
{
histoChannel = 3;
}
else
// if( channel == LUMA )
// {
// histoChannel = 3;
// }
// else
{
histoChannel = channel;
}
@@ -724,12 +724,12 @@ Int PlaYUVerFrame::getRealHistoChannel( Int channel )
return histoChannel;
}
Double PlaYUVerFrame::getCount( Int channel, UInt start, UInt end )
UInt PlaYUVerFrame::getCount( Int channel, UInt start, UInt end )
{
UInt i;
Int histoChannel;
Int indexStart;
Double count = 0.0;
UInt count = 0;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
@@ -740,7 +740,7 @@ Double PlaYUVerFrame::getCount( Int channel, UInt start, UInt end )
if( histoChannel == -1 )
{
return 0.0;
return 0;
}
indexStart = histoChannel * m_uiHistoSegments;
+1 -1
View File
@@ -229,7 +229,7 @@ public:
*/
Void calcHistogram();
Double getCount( Int channel, UInt start, UInt end );
UInt getCount( Int channel, UInt start, UInt end );
Double getMean( Int channel, UInt start, UInt end );
Int getMedian( Int channel, UInt start, UInt end );
Double getStdDev( Int channel, UInt start, UInt end );