mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-17 01:54:42 +00:00
- implemented clump's histogram function
- implemented brightness spinbox connection
This commit is contained in:
parent
87d6e6275f
commit
eac082d263
@ -50,6 +50,9 @@ typedef unsigned int UINT32;
|
||||
|
||||
#define NUMBER_OF_HISTOGRAM_BINS 200
|
||||
|
||||
// The defalut percentile for clamping equalizer histogram
|
||||
#define CLAMP_PERCENTILE 90
|
||||
|
||||
|
||||
//set of macros used to tell to clearItems method what to remove and\or delete
|
||||
//each macro refers to a particular type of graphic item
|
||||
|
||||
@ -329,36 +329,7 @@ bool QualityMapperDialog::initEqualizerHistogram()
|
||||
|
||||
// SETTING SPNIBOX VALUES
|
||||
// (Se venissero inizializzati prima di impostare setHistogramInfo sulle handles darebbero errore nello SLOT setX delle handles.)
|
||||
double singleStep = (_histogram_info->maxX - _histogram_info->minX) / _histogram_info->chartWidth;
|
||||
int decimals = 0;
|
||||
if (singleStep > std::numeric_limits<float>::epsilon())
|
||||
{
|
||||
double temp = singleStep;
|
||||
while (temp < 0.1)
|
||||
{
|
||||
decimals++;
|
||||
temp *= 10;
|
||||
}
|
||||
|
||||
}
|
||||
decimals+=2;
|
||||
|
||||
ui.minSpinBox->setDecimals(decimals);
|
||||
ui.minSpinBox->setValue(_histogram_info->minX);
|
||||
//ui.minSpinBox->setRange(_histogram_info->minX, _histogram_info->maxX);
|
||||
ui.minSpinBox->setRange(2*_histogram_info->minX - _histogram_info->maxX, 2*_histogram_info->maxX - _histogram_info->minX);
|
||||
ui.minSpinBox->setSingleStep(singleStep);
|
||||
|
||||
ui.midSpinBox->setDecimals(decimals);
|
||||
ui.midSpinBox->setValue((_histogram_info->maxX + _histogram_info->minX) / 2.0f);
|
||||
ui.midSpinBox->setRange(_histogram_info->minX, _histogram_info->maxX);
|
||||
ui.midSpinBox->setSingleStep(singleStep);
|
||||
|
||||
ui.maxSpinBox->setDecimals(decimals);
|
||||
ui.maxSpinBox->setValue(_histogram_info->maxX);
|
||||
//ui.maxSpinBox->setRange(_histogram_info->minX, _histogram_info->maxX);
|
||||
ui.maxSpinBox->setRange(2*_histogram_info->minX - _histogram_info->maxX, 2*_histogram_info->maxX - _histogram_info->minX);
|
||||
ui.maxSpinBox->setSingleStep(singleStep);
|
||||
initEqualizerSpinboxes();
|
||||
|
||||
//SETTING UP CONNECTIONS
|
||||
// Connecting spinboxes to handles
|
||||
@ -394,6 +365,10 @@ bool QualityMapperDialog::initEqualizerHistogram()
|
||||
connect(_equalizerHandles[MID_HANDLE], SIGNAL(handleReleased()), this, SLOT(on_Handle_released()));
|
||||
connect(_equalizerHandles[RIGHT_HANDLE], SIGNAL(handleReleased()), this, SLOT(on_Handle_released()));
|
||||
connect(ui.brightnessSlider, SIGNAL(sliderReleased()), this, SLOT(on_Handle_released()));
|
||||
connect(ui.minSpinBox, SIGNAL(editingFinished()), this, SLOT(on_previewButton_clicked()));
|
||||
connect(ui.midSpinBox, SIGNAL(editingFinished()), this, SLOT(on_previewButton_clicked()));
|
||||
connect(ui.maxSpinBox, SIGNAL(editingFinished()), this, SLOT(on_previewButton_clicked()));
|
||||
|
||||
|
||||
ui.equalizerGraphicsView->setScene(&_equalizerHistogramScene);
|
||||
|
||||
@ -403,6 +378,41 @@ bool QualityMapperDialog::initEqualizerHistogram()
|
||||
return true;
|
||||
}
|
||||
|
||||
void QualityMapperDialog::initEqualizerSpinboxes()
|
||||
{
|
||||
double singleStep = (_histogram_info->maxX - _histogram_info->minX) / _histogram_info->chartWidth;
|
||||
int decimals = 0;
|
||||
if (singleStep > std::numeric_limits<float>::epsilon())
|
||||
{
|
||||
double temp = singleStep;
|
||||
while (temp < 0.1)
|
||||
{
|
||||
decimals++;
|
||||
temp *= 10;
|
||||
}
|
||||
|
||||
}
|
||||
decimals+=2;
|
||||
|
||||
ui.minSpinBox->setDecimals(decimals);
|
||||
ui.minSpinBox->setValue(_histogram_info->minX);
|
||||
//ui.minSpinBox->setRange(_histogram_info->minX, _histogram_info->maxX);
|
||||
ui.minSpinBox->setRange(2*_histogram_info->minX - _histogram_info->maxX, 2*_histogram_info->maxX - _histogram_info->minX);
|
||||
ui.minSpinBox->setSingleStep(singleStep);
|
||||
|
||||
ui.maxSpinBox->setDecimals(decimals);
|
||||
ui.maxSpinBox->setValue(_histogram_info->maxX);
|
||||
//ui.maxSpinBox->setRange(_histogram_info->minX, _histogram_info->maxX);
|
||||
ui.maxSpinBox->setRange(2*_histogram_info->minX - _histogram_info->maxX, 2*_histogram_info->maxX - _histogram_info->minX);
|
||||
ui.maxSpinBox->setSingleStep(singleStep);
|
||||
|
||||
ui.midSpinBox->setDecimals(decimals);
|
||||
ui.midSpinBox->setValue((_histogram_info->maxX + _histogram_info->minX) / 2.0f);
|
||||
ui.midSpinBox->setRange(_histogram_info->minX, _histogram_info->maxX);
|
||||
ui.midSpinBox->setSingleStep(singleStep);
|
||||
|
||||
}
|
||||
|
||||
// Add histogram bars to equalizerHistogram Scene
|
||||
// Return false if mesh has no quality => dialog will not be built
|
||||
bool QualityMapperDialog::drawEqualizerHistogram(bool leftHandleIsInsideHistogram, bool rightHandleIsInsideHistogram)
|
||||
@ -1261,6 +1271,20 @@ void QualityMapperDialog::on_TF_view_doubleClicked(QPointF pos)
|
||||
on_applyButton_clicked();
|
||||
}
|
||||
|
||||
// Cut unuseful tails from equalizer histogram
|
||||
void QualityMapperDialog::on_clampButton_clicked()
|
||||
{
|
||||
_leftHandleWasInsideHistogram = false;
|
||||
_rightHandleWasInsideHistogram = false;
|
||||
|
||||
// Calculate new Min e Max values
|
||||
_histogram_info->minX = _equalizer_histogram->Percentile((float)ui.clampHistogramSpinBox->value()/100.0f);
|
||||
_histogram_info->maxX = _equalizer_histogram->Percentile(1.0f-(float)ui.clampHistogramSpinBox->value()/100.0f);
|
||||
|
||||
initEqualizerSpinboxes(); // reset Spinboxes and handles
|
||||
drawEqualizerHistogram(true, true); // redrawing histogram
|
||||
}
|
||||
|
||||
//writes in the x-quality label the quality value corresponding to the position of the currently selected TF handle
|
||||
void QualityMapperDialog::updateXQualityLabel(float xPos)
|
||||
{
|
||||
@ -1302,3 +1326,11 @@ void QualityMapperDialog::setEqualizerParameters(EQUALIZER_INFO data)
|
||||
on_applyButton_clicked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void QualityMapperDialog::on_brightnessSlider_valueChanged(int value)
|
||||
{
|
||||
ui.brightessSpinBox->setValue((double)value/50.0);
|
||||
}
|
||||
@ -150,6 +150,7 @@ private:
|
||||
void updateColorBand(void);
|
||||
void drawTransferFunctionBG(void);
|
||||
bool drawEqualizerHistogram(bool leftHandleInsideHistogram, bool rightHandleInsideHistogram);
|
||||
void initEqualizerSpinboxes();
|
||||
void drawHistogramBars (QGraphicsScene&, CHART_INFO*, int minIndex, int maxIndex, QColor color = QColor(Qt::black));
|
||||
|
||||
GRAPHICS_ITEMS_LIST *clearScene(QGraphicsScene *scene, int toClean=0);
|
||||
@ -169,6 +170,8 @@ signals:
|
||||
void closingDialog();
|
||||
|
||||
private slots:
|
||||
void on_brightnessSlider_valueChanged(int);
|
||||
void on_clampButton_clicked();
|
||||
void on_ySpinBox_valueChanged(double);
|
||||
void on_xSpinBox_valueChanged(double);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user