15 #include <QApplication>
17 #include <QMainWindow>
18 #include <QPushButton>
30 : QDialog(app ? app->getActiveWindow() : 0),
35 int maxThreadCount = QThread::idealThreadCount();
36 maxThreadCountSpinBox->setRange(1, maxThreadCount);
37 maxThreadCountSpinBox->setSuffix(QString(
"/%1").arg(maxThreadCount));
38 maxThreadCountSpinBox->setValue(maxThreadCount);
42 connect(model1CloudComboBox, SIGNAL(currentIndexChanged(
int)),
this,
44 connect(model2CloudComboBox, SIGNAL(currentIndexChanged(
int)),
this,
58 unsigned cloudCount = 0;
59 model1CloudComboBox->clear();
60 model2CloudComboBox->clear();
61 evaluationCloudComboBox->clear();
62 for (
size_t i = 0; i < clouds.size(); ++i) {
67 QVariant uniqueID(clouds[i]->getUniqueID());
68 model1CloudComboBox->addItem(
name, uniqueID);
69 model2CloudComboBox->addItem(
name, uniqueID);
70 evaluationCloudComboBox->addItem(
name, uniqueID);
77 model1CloudComboBox->setCurrentIndex(
78 cloudCount > 0 ? (cloudCount > 2 ? 1 : 0) : -1);
79 model2CloudComboBox->setCurrentIndex(
80 cloudCount > 1 ? (cloudCount > 2 ? 2 : 1) : -1);
82 if (cloudCount < 1 &&
m_app)
84 tr(
"You need at least 1 loaded clouds to perform matching"),
90 int c1 = model1CloudComboBox->currentIndex();
91 if (model1checkBox->isChecked()) {
96 int c2 = model2CloudComboBox->currentIndex();
97 if (model2checkBox->isChecked()) {
103 if (model1checkBox->isChecked() && model2checkBox->isChecked()) {
104 if (c1 == c2)
return false;
111 return maxThreadCountSpinBox->value();
115 return verificationCheckBox->isChecked();
119 return static_cast<float>(modelSearchRadiusSpinBox->value());
123 return static_cast<float>(sceneSearchRadiusSpinBox->value());
127 return static_cast<float>(shotDescriptorRadiusSpinBox->value());
131 return static_cast<float>(normalKSearchSpinBox->value());
135 return GCcheckBox->isChecked() ? true :
false;
139 return static_cast<float>(gcResolutionSpinBox->value());
143 return static_cast<float>(gcMinClusterSizeSpinBox->value());
147 return static_cast<float>(LRFRadiusSpinBox->value());
151 return static_cast<float>(houghBinSizeSpinBox->value());
155 return static_cast<float>(houghThresholdSpinBox->value());
159 if (useVoxelGridCheckBox->isChecked()) {
160 return static_cast<float>(leafSizeSpinBox->value());
170 if (scalesRampRadioButton->isChecked()) {
171 double maxScale = maxScaleDoubleSpinBox->value();
172 double step = stepScaleDoubleSpinBox->value();
173 double minScale = minScaleDoubleSpinBox->value();
174 if (maxScale < minScale || maxScale < 0 || step < 1.0e-6)
177 static_cast<unsigned>(
178 floor((maxScale - minScale) / step + 1.0e-6)) +
180 scales.resize(stepCount);
181 for (
unsigned i = 0; i < stepCount; ++i)
182 scales[i] =
static_cast<float>(maxScale - i * step);
183 }
else if (scalesListRadioButton->isChecked()) {
184 QStringList scaleList = scalesListLineEdit->text().split(
187 int listSize = scaleList.size();
188 scales.resize(listSize);
189 for (
int i = 0; i < listSize; ++i) {
192 f = scaleList[i].toFloat(&ok);
193 if (!ok)
return false;
199 }
catch (
const std::bad_alloc&) {
207 buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
validParameters());
212 if (model1checkBox->isChecked()) {
221 if (model2checkBox->isChecked()) {
248 QSettings settings(
"templateAlignment");
249 settings.beginGroup(
"Align");
287 QSettings settings(
"templateAlignment");
288 settings.beginGroup(
"Align");
310 if (
name.isEmpty())
name = tr(
"unnamed");
317 QComboBox* comboBox,
ccHObject* dbRoot) {
318 assert(comboBox && dbRoot);
319 if (!comboBox || !dbRoot) {
325 int index = comboBox->currentIndex();
330 unsigned uniqueID = comboBox->itemData(index).toUInt();
CANUPO plugin's training dialog.
QString getEntityName(ccHObject *obj)
void saveParamsToPersistentSettings()
Saves parameters to persistent settings.
void loadParamsFromPersistentSettings()
Loads parameters from persistent settings.
bool isGCActivated() const
void refreshCloudComboBox()
ccPointCloud * getModelCloudByIndex(int index)
ccPointCloud * getModel1Cloud()
Get model #1 point cloud.
float getModelSearchRadius() const
Returns the Model Search Radius.
float getShotDescriptorRadius() const
Returns the Shot Descriptor Radius.
float getHoughBinSize() const
float getVoxelGridLeafSize() const
float getHoughLRFRadius() const
bool validParameters() const
float getNormalKSearch() const
Returns the normal KSearch.
ccPointCloud * getEvaluationCloud()
Get evaluation point cloud.
int getMaxThreadCount() const
Returns the max number of threads to use.
float getGcMinClusterSize() const
CorrespondenceMatchingDialog(ecvMainAppInterface *app)
Default constructor.
ecvMainAppInterface * m_app
Gives access to the application (data-base, UI, etc.)
bool getScales(std::vector< float > &scales) const
Returns input scales.
ccPointCloud * getCloudFromCombo(QComboBox *comboBox, ccHObject *dbRoot)
float getSceneSearchRadius() const
Returns the Scene Search Radius.
ccPointCloud * getModel2Cloud()
Get model #2 point cloud.
float getHoughThreshold() const
float getGcConsensusSetResolution() const
bool getVerificationFlag() const
Hierarchical CLOUDVIEWER Object.
ccHObject * find(unsigned uniqueID)
Finds an entity in this object hierarchy.
unsigned filterChildren(Container &filteredChildren, bool recursive=false, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, bool strict=false) const
Collects the children corresponding to a certain pattern.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
virtual QString getName() const
Returns object name.
virtual unsigned getUniqueID() const
Returns object unique ID.
bool isA(CV_CLASS_ENUM type) const
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Main application interface (for plugins)
virtual ccHObject * dbRootObject()=0
Returns DB root (as a ccHObject)
virtual void dispToConsole(QString message, ConsoleMessageLevel level=STD_CONSOLE_MESSAGE)=0
constexpr Qt::SplitBehavior SkipEmptyParts
MiniVec< float, N > floor(const MiniVec< float, N > &a)