update ui

This commit is contained in:
Tri-Thien TRUONG
2020-05-12 14:02:21 +02:00
parent be7182659c
commit 27c615a754
5 changed files with 236 additions and 201 deletions
+25 -14
View File
@@ -175,6 +175,7 @@ QList<QAction*> ColorimetricSegmenter::getActions()
}
if (!m_action_filterRgbWithSegmentation)
{
// Here we use the default plugin name, description, and icon,
@@ -227,7 +228,7 @@ QList<QAction*> ColorimetricSegmenter::getActions()
// Here we use the default plugin name, description, and icon,
// but each action should have its own.
m_action_ToonMapping_Hist = new QAction("Histogram Clustering", this);
m_action_ToonMapping_Hist->setToolTip("Quantified cloud generator using histogram equalization");
m_action_ToonMapping_Hist->setToolTip("Quantify the number of colors using Histogram Clustering");
m_action_ToonMapping_Hist->setIcon(QIcon(":/CC/plugin/ColorimetricSegmenter/images/icon_quantif_h.png"));
// Connect appropriate signal
@@ -243,7 +244,7 @@ QList<QAction*> ColorimetricSegmenter::getActions()
// Here we use the default plugin name, description, and icon,
// but each action should have its own.
m_action_ToonMapping_KMeans = new QAction("Kmeans Clustering", this);
m_action_ToonMapping_KMeans->setToolTip("Quantified cloud generator using kmeans method");
m_action_ToonMapping_KMeans->setToolTip("Quantify the number of colors using Kmeans Clustering");
m_action_ToonMapping_KMeans->setIcon(QIcon(":/CC/plugin/ColorimetricSegmenter/images/icon_quantif_k.png"));
// Connect appropriate signal
@@ -316,17 +317,27 @@ void ColorimetricSegmenter::filterRgb()
// Start timer
auto start = std::chrono::high_resolution_clock::now();
// Get margin value (percent)
double marginError = static_cast<double>(rgbDlg->margin->value()) / 100.0;
// Get all values to make the color range with RGB values
int redInf = std::min(rgbDlg->red_first->value(), rgbDlg->red_second->value()) - (marginError * std::min(rgbDlg->red_first->value(), rgbDlg->red_second->value()));
int redSup = std::max(rgbDlg->red_first->value(), rgbDlg->red_second->value()) + (marginError * std::max(rgbDlg->red_first->value(), rgbDlg->red_second->value()));
int greenInf = std::min(rgbDlg->green_first->value(), rgbDlg->green_second->value()) - (marginError * std::min(rgbDlg->green_first->value(), rgbDlg->green_second->value()));
int greenSup = std::max(rgbDlg->green_first->value(), rgbDlg->green_second->value()) + (marginError * std::max(rgbDlg->green_first->value(), rgbDlg->green_second->value()));
int blueInf = std::min(rgbDlg->blue_first->value(), rgbDlg->blue_second->value()) - (marginError * std::min(rgbDlg->blue_first->value(), rgbDlg->blue_second->value()));
int blueSup = std::max(rgbDlg->blue_first->value(), rgbDlg->blue_second->value()) + (marginError * std::max(rgbDlg->blue_first->value(), rgbDlg->blue_second->value()));
int redInf = std::min(rgbDlg->red_first->value(), rgbDlg->red_second->value());
int redSup = std::max(rgbDlg->red_first->value(), rgbDlg->red_second->value());
int greenInf = std::min(rgbDlg->green_first->value(), rgbDlg->green_second->value());
int greenSup = std::max(rgbDlg->green_first->value(), rgbDlg->green_second->value());
int blueInf = std::min(rgbDlg->blue_first->value(), rgbDlg->blue_second->value());
int blueSup = std::max(rgbDlg->blue_first->value(), rgbDlg->blue_second->value());
if (rgbDlg->margin->value() > 0) {
// Get margin value (percent)
double marginError = static_cast<double>(rgbDlg->margin->value()) / 100.0;
redInf -= marginError * redInf;
redSup += marginError * redSup;
greenInf -= marginError * greenInf;
greenSup += marginError * greenSup;
blueInf -= marginError * blueInf;
blueSup += marginError * blueSup;
}
// Set to min or max value (0-255)
redInf = (redInf < MIN_VALUE ? MIN_VALUE : redInf);
greenInf = (greenInf < MIN_VALUE ? MIN_VALUE : greenInf);
blueInf = (blueInf < MIN_VALUE ? MIN_VALUE : blueInf);
@@ -347,9 +358,9 @@ void ColorimetricSegmenter::filterRgb()
for (unsigned j = 0; j < cloud->size(); ++j)
{
const ccColor::Rgb& rgb = cloud->getPointColor(j);
(rgb.r > redInf&& rgb.r < redSup &&
rgb.g > greenInf&& rgb.g < greenSup &&
rgb.b > blueInf&& rgb.b < blueSup) ? addPoint(filteredCloudInside, j) : addPoint(filteredCloudOutside, j);
(rgb.r >= redInf&& rgb.r <= redSup &&
rgb.g >= greenInf&& rgb.g <= greenSup &&
rgb.b >= blueInf&& rgb.b <= blueSup) ? addPoint(filteredCloudInside, j) : addPoint(filteredCloudOutside, j);
}
std::string name = "Rmin:" + std::to_string(redInf) + "/Gmin:" + std::to_string(greenInf) + "/Bmin:" + std::to_string(blueInf) +
"/Rmax:" + std::to_string(redSup) + "/Gmax:" + std::to_string(greenSup) + "/Bmax:" + std::to_string(blueSup);
+3
View File
@@ -279,6 +279,9 @@
<property name="text">
<string>Retain</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
+96 -65
View File
@@ -6,75 +6,106 @@
<rect>
<x>0</x>
<y>0</y>
<width>391</width>
<height>230</height>
<width>352</width>
<height>127</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Kmeans clustering setting</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>-50</x>
<y>180</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>351</width>
<height>111</height>
</rect>
</property>
<layout class="QGridLayout">
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_it">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_color">
<property name="text">
<string>Nombre couleurs</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox_k">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_It">
<property name="text">
<string>Nombre itération</string>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_color">
<property name="text">
<string>Number of colors</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="spinBox_k">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_It">
<property name="text">
<string>Number of iterations</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="spinBox_it">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
+111 -121
View File
@@ -6,131 +6,121 @@
<rect>
<x>0</x>
<y>0</y>
<width>401</width>
<height>204</height>
<width>325</width>
<height>115</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Histogram Clustering setting</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>-40</x>
<y>150</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QWidget" name="layoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>384</width>
<height>30</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_bottom">
<item>
<widget class="QLabel" name="quanti_label">
<property name="text">
<string>Indice de Quantification</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="area_quanti">
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>255.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>149</x>
<y>310</y>
<width>384</width>
<height>28</height>
</rect>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="text">
<string>Use PointPicking</string>
</property>
</widget>
<widget class="QLabel" name="quanti_label_2">
<property name="geometry">
<rect>
<x>120</x>
<y>90</y>
<width>174</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QWidget" name="layoutWidget_4">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>384</width>
<height>30</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_bottom_4">
<item>
<widget class="QLabel" name="quanti_label_5">
<property name="text">
<string>Couleurs possibles :</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nb_color_label">
<property name="text">
<string>1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_bottom">
<item>
<widget class="QLabel" name="quanti_label">
<property name="text">
<string>Quantification index</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="area_quanti">
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>255.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_bottom_4">
<item alignment="Qt::AlignLeft">
<widget class="QLabel" name="quanti_label_5">
<property name="text">
<string>Colors available :</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="nb_color_label">
<property name="text">
<string>1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
+1 -1
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>564</width>
<height>192</height>
<height>189</height>
</rect>
</property>
<property name="sizePolicy">