mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-04 17:17:47 +08:00
Support AprilTAg library not built with aruco
This commit is contained in:
@@ -475,16 +475,6 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
_ui->checkBox_showOdomFrustums->setChecked(false);
|
||||
#endif
|
||||
|
||||
//if OpenCV < 3.4.2
|
||||
#if !defined(RTABMAP_APRILTAG) && (CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION <4 || (CV_MINOR_VERSION ==4 && CV_SUBMINOR_VERSION<2))))
|
||||
_ui->MarkerDictionary->setItemData(17, 0, Qt::UserRole - 1);
|
||||
_ui->MarkerDictionary->setItemData(18, 0, Qt::UserRole - 1);
|
||||
_ui->MarkerDictionary->setItemData(19, 0, Qt::UserRole - 1);
|
||||
_ui->MarkerDictionary->setItemData(20, 0, Qt::UserRole - 1);
|
||||
#endif
|
||||
#if !defined(RTABMAP_APRILTAG) && (CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <8))
|
||||
_ui->MarkerDictionary->setItemData(21, 0, Qt::UserRole - 1);
|
||||
#endif
|
||||
#if !defined(HAVE_OPENCV_ARUCO) && !defined(RTABMAP_APRILTAG)
|
||||
_ui->label_markerDetection->setText(_ui->label_markerDetection->text()+" This option works only if OpenCV has been built with \"aruco\" module and/or RTAB-Map has been built with AprilTag library support.");
|
||||
#endif
|
||||
@@ -1762,19 +1752,22 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
// Aruco marker
|
||||
_ui->MarkerStrategy->setObjectName(Parameters::kMarkerStrategy().c_str());
|
||||
connect(_ui->MarkerStrategy, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_markerStrategy, SLOT(setCurrentIndex(int)));
|
||||
connect(_ui->MarkerStrategy, SIGNAL(currentIndexChanged(int)), this, SLOT(updateAvailableMarkerDictionaries()));
|
||||
_ui->MarkerStrategy->setCurrentIndex(Parameters::defaultMarkerStrategy());
|
||||
updateAvailableMarkerDictionaries();
|
||||
_ui->MarkerDictionary->setObjectName(Parameters::kMarkerDictionary().c_str());
|
||||
_ui->ArucoMarkerLength->setObjectName(Parameters::kMarkerLength().c_str());
|
||||
_ui->ArucoMaxDepthError->setObjectName(Parameters::kMarkerMaxDepthError().c_str());
|
||||
_ui->ArucoVarianceLinear->setObjectName(Parameters::kMarkerVarianceLinear().c_str());
|
||||
_ui->ArucoVarianceAngular->setObjectName(Parameters::kMarkerVarianceAngular().c_str());
|
||||
_ui->ArucoVarianceOrientationIgnored->setObjectName(Parameters::kMarkerVarianceOrientationIgnored().c_str());
|
||||
_ui->ArucoMarkerRangeMin->setObjectName(Parameters::kMarkerMinRange().c_str());
|
||||
_ui->ArucoMarkerRangeMax->setObjectName(Parameters::kMarkerMaxRange().c_str());
|
||||
_ui->ArucoMarkerPriors->setObjectName(Parameters::kMarkerPriors().c_str());
|
||||
_ui->ArucoPriorsVarianceLinear->setObjectName(Parameters::kMarkerPriorsVarianceLinear().c_str());
|
||||
_ui->ArucoPriorsVarianceAngular->setObjectName(Parameters::kMarkerPriorsVarianceAngular().c_str());
|
||||
_ui->ArucoCornerRefinementMethod->setObjectName(Parameters::kMarkerOpenCVCornerRefinementMethod().c_str());
|
||||
_ui->MarkerLength->setObjectName(Parameters::kMarkerLength().c_str());
|
||||
_ui->MarkerLengths->setObjectName(Parameters::kMarkerLengths().c_str());
|
||||
_ui->MarkerMaxDepthError->setObjectName(Parameters::kMarkerMaxDepthError().c_str());
|
||||
_ui->MarkerVarianceLinear->setObjectName(Parameters::kMarkerVarianceLinear().c_str());
|
||||
_ui->MarkerVarianceAngular->setObjectName(Parameters::kMarkerVarianceAngular().c_str());
|
||||
_ui->MarkerVarianceOrientationIgnored->setObjectName(Parameters::kMarkerVarianceOrientationIgnored().c_str());
|
||||
_ui->MarkerRangeMin->setObjectName(Parameters::kMarkerMinRange().c_str());
|
||||
_ui->MarkerRangeMax->setObjectName(Parameters::kMarkerMaxRange().c_str());
|
||||
_ui->MarkerPriors->setObjectName(Parameters::kMarkerPriors().c_str());
|
||||
_ui->MarkerPriorsVarianceLinear->setObjectName(Parameters::kMarkerPriorsVarianceLinear().c_str());
|
||||
_ui->MarkerPriorsVarianceAngular->setObjectName(Parameters::kMarkerPriorsVarianceAngular().c_str());
|
||||
_ui->OpenCVCornerRefinementMethod->setObjectName(Parameters::kMarkerOpenCVCornerRefinementMethod().c_str());
|
||||
_ui->apriltag_nthreads->setObjectName(Parameters::kMarkerAprilTagNThreads().c_str());
|
||||
_ui->apriltag_quad_decimate->setObjectName(Parameters::kMarkerAprilTagQuadDecimate().c_str());
|
||||
_ui->apriltag_quad_sigma->setObjectName(Parameters::kMarkerAprilTagQuadSigma().c_str());
|
||||
@@ -3970,9 +3963,20 @@ bool PreferencesDialog::validateForm()
|
||||
if(_ui->MarkerDictionary->currentIndex()>=21)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Parameter warning"),
|
||||
tr("opencv-aruco: cannot use selected dictionary (%1), OpenCV version should be at least 4.8.0. Setting back to 0.").arg(_ui->MarkerDictionary->currentIndex()));
|
||||
tr("Opencv Strategy: cannot use selected dictionary (%1), OpenCV version should be at least 4.8.0. Setting back to 0.").arg(_ui->MarkerDictionary->currentIndex()));
|
||||
_ui->MarkerDictionary->setCurrentIndex(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(_ui->MarkerStrategy->currentIndex() == 1)
|
||||
{
|
||||
#ifndef RTABMAP_APRILTAG_WITH_ARUCO
|
||||
if(_ui->MarkerDictionary->currentIndex() < 17 || _ui->MarkerDictionary->currentIndex() == 21)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Parameter warning"),
|
||||
tr("AprilTag Strategy: cannot use selected dictionary (%1), AprilTag should be built with aruco support. Setting back to 17.").arg(_ui->MarkerDictionary->currentIndex()));
|
||||
_ui->MarkerDictionary->setCurrentIndex(17);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
@@ -5601,6 +5605,53 @@ void PreferencesDialog::updateGlobalDescriptorVisibility()
|
||||
_ui->groupBox_pydescriptor->setVisible(_ui->comboBox_globalDescriptorExtractor->currentIndex() == 1);
|
||||
}
|
||||
|
||||
void PreferencesDialog::updateAvailableMarkerDictionaries()
|
||||
{
|
||||
Qt::ItemFlags enableFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
for(int i=0;i<_ui->MarkerDictionary->count();++i) {
|
||||
_ui->MarkerDictionary->setItemData(i, QVariant(static_cast<int>(enableFlags)), Qt::UserRole - 1);
|
||||
}
|
||||
|
||||
if(_ui->MarkerStrategy->currentIndex() == 1) // AprilTag Strategy is selected
|
||||
{
|
||||
// ARUCO_ORIGINAL not available with AprilTag lib
|
||||
_ui->MarkerDictionary->setItemData(16, 0, Qt::UserRole - 1);
|
||||
#if !defined(RTABMAP_APRILTAG_WITH_ARUCO)
|
||||
// disable all aruco dictionaries
|
||||
for(int i=0;i<17;++i) {
|
||||
_ui->MarkerDictionary->setItemData(i, 0, Qt::UserRole - 1);
|
||||
}
|
||||
_ui->MarkerDictionary->setItemData(21, 0, Qt::UserRole - 1);
|
||||
if(_ui->MarkerDictionary->currentIndex() < 17 || _ui->MarkerDictionary->currentIndex() > 20)
|
||||
{
|
||||
_ui->MarkerDictionary->setCurrentIndex(20); // 36h11 by default
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else //if(_ui->MarkerStrategy->currentIndex() == 0) // OpenCV Strategy is selected
|
||||
{
|
||||
//if OpenCV < 3.4.2
|
||||
#if !defined(RTABMAP_APRILTAG) && (CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION <4 || (CV_MINOR_VERSION ==4 && CV_SUBMINOR_VERSION<2))))
|
||||
// disable all apriltag dictionaries
|
||||
for(int i=17;i<21;++i) {
|
||||
_ui->MarkerDictionary->setItemData(i, 0, Qt::UserRole - 1);
|
||||
}
|
||||
if(_ui->MarkerDictionary->currentIndex() >=17 && _ui->MarkerDictionary->currentIndex() <= 20)
|
||||
{
|
||||
_ui->MarkerDictionary->setCurrentIndex(Parameters::defaultMarkerDictionary());
|
||||
}
|
||||
#endif
|
||||
#if !defined(RTABMAP_APRILTAG_WITH_ARUCO) && (CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <8))
|
||||
// disable aruco MPI dictionary
|
||||
_ui->MarkerDictionary->setItemData(21, 0, Qt::UserRole - 1);
|
||||
if(_ui->MarkerDictionary->currentIndex() == 21)
|
||||
{
|
||||
_ui->MarkerDictionary->setCurrentIndex(Parameters::defaultMarkerDictionary());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::updateOdometryStackedIndex(int index)
|
||||
{
|
||||
if(index == 11) // FLOAM -> LOAM
|
||||
@@ -6265,7 +6316,7 @@ bool PreferencesDialog::isMarkerDetection() const
|
||||
}
|
||||
double PreferencesDialog::getMarkerLength() const
|
||||
{
|
||||
return _ui->ArucoMarkerLength->value();
|
||||
return _ui->MarkerLength->value();
|
||||
}
|
||||
bool PreferencesDialog::isCloudMeshing() const
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-526</y>
|
||||
<y>0</y>
|
||||
<width>684</width>
|
||||
<height>5218</height>
|
||||
</rect>
|
||||
@@ -15529,14 +15529,14 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="ArucoVarianceOrientationIgnored">
|
||||
<widget class="QCheckBox" name="MarkerVarianceOrientationIgnored">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoVarianceLinear">
|
||||
<widget class="QDoubleSpinBox" name="MarkerVarianceLinear">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -15555,7 +15555,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoMarkerLength">
|
||||
<widget class="QDoubleSpinBox" name="MarkerLength">
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
@@ -15587,7 +15587,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoMarkerRangeMax">
|
||||
<widget class="QDoubleSpinBox" name="MarkerRangeMax">
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
@@ -15648,7 +15648,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoPriorsVarianceAngular">
|
||||
<widget class="QDoubleSpinBox" name="MarkerPriorsVarianceAngular">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -15818,7 +15818,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLineEdit" name="ArucoMarkerPriors">
|
||||
<widget class="QLineEdit" name="MarkerPriors">
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -15854,7 +15854,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoMarkerRangeMin">
|
||||
<widget class="QDoubleSpinBox" name="MarkerRangeMin">
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
@@ -15915,7 +15915,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoMaxDepthError">
|
||||
<widget class="QDoubleSpinBox" name="MarkerMaxDepthError">
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
@@ -15941,7 +15941,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoPriorsVarianceLinear">
|
||||
<widget class="QDoubleSpinBox" name="MarkerPriorsVarianceLinear">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -15962,7 +15962,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_space2_24">
|
||||
<property name="text">
|
||||
<string>Detector implementation. Note that both aruco and apriltag dictionaries can be used with either strategy.</string>
|
||||
<string>Detector implementation. Note that both aruco and apriltag dictionaries may be used with either strategy. Scroll down to see specific parameters for the strategy used.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@@ -15973,7 +15973,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QDoubleSpinBox" name="ArucoVarianceAngular">
|
||||
<widget class="QDoubleSpinBox" name="MarkerVarianceAngular">
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -15995,7 +15995,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLineEdit" name="ArucoMarkerLengths">
|
||||
<widget class="QLineEdit" name="MarkerLengths">
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -16019,7 +16019,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget_markerStrategy">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_104">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_189">
|
||||
@@ -16043,7 +16043,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="ArucoCornerRefinementMethod">
|
||||
<widget class="QComboBox" name="OpenCVCornerRefinementMethod">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
@@ -16071,6 +16071,12 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -16230,12 +16236,15 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QSpinBox" name="apriltag_quad_decimate">
|
||||
<property name="minimum">
|
||||
<widget class="QDoubleSpinBox" name="apriltag_quad_decimate">
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user