Add ANMS (SSC method) (#1276)

This commit is contained in:
Borong Yuan
2024-05-20 09:21:00 +08:00
committed by GitHub
parent 0d4e4730c7
commit fbeabf0751
12 changed files with 321 additions and 157 deletions

View File

@@ -5732,6 +5732,7 @@ void DatabaseViewer::updateStereo(const SensorData * data)
// generate kpts
std::vector<cv::KeyPoint> kpts;
uInsert(parameters, ParametersPair(Parameters::kKpMaxFeatures(), parameters.at(Parameters::kVisMaxFeatures())));
uInsert(parameters, ParametersPair(Parameters::kKpSSC(), parameters.at(Parameters::kVisSSC())));
uInsert(parameters, ParametersPair(Parameters::kKpMinDepth(), parameters.at(Parameters::kVisMinDepth())));
uInsert(parameters, ParametersPair(Parameters::kKpMaxDepth(), parameters.at(Parameters::kVisMaxDepth())));
uInsert(parameters, ParametersPair(Parameters::kKpDetectorStrategy(), parameters.at(Parameters::kVisFeatureType())));

View File

@@ -1029,6 +1029,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->checkBox_memDepthAsMask->setObjectName(Parameters::kMemDepthAsMask().c_str());
_ui->checkBox_memStereoFromMotion->setObjectName(Parameters::kMemStereoFromMotion().c_str());
_ui->surf_spinBox_wordsPerImageTarget->setObjectName(Parameters::kKpMaxFeatures().c_str());
_ui->checkBox_kp_ssc->setObjectName(Parameters::kKpSSC().c_str());
_ui->spinBox_KPGridRows->setObjectName(Parameters::kKpGridRows().c_str());
_ui->spinBox_KPGridCols->setObjectName(Parameters::kKpGridCols().c_str());
_ui->surf_doubleSpinBox_ratioBadSign->setObjectName(Parameters::kKpBadSignRatio().c_str());
@@ -1245,9 +1246,10 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->reextract_nn, SIGNAL(currentIndexChanged(int)), this, SLOT(updateFeatureMatchingVisibility()));
_ui->reextract_nndrRatio->setObjectName(Parameters::kVisCorNNDR().c_str());
_ui->spinBox_visCorGuessWinSize->setObjectName(Parameters::kVisCorGuessWinSize().c_str());
_ui->checkBox__visCorGuessMatchToProjection->setObjectName(Parameters::kVisCorGuessMatchToProjection().c_str());
_ui->checkBox_visCorGuessMatchToProjection->setObjectName(Parameters::kVisCorGuessMatchToProjection().c_str());
_ui->vis_feature_detector->setObjectName(Parameters::kVisFeatureType().c_str());
_ui->reextract_maxFeatures->setObjectName(Parameters::kVisMaxFeatures().c_str());
_ui->checkBox_visSSC->setObjectName(Parameters::kVisSSC().c_str());
_ui->reextract_gridrows->setObjectName(Parameters::kVisGridRows().c_str());
_ui->reextract_gridcols->setObjectName(Parameters::kVisGridCols().c_str());
_ui->loopClosure_bowMaxDepth->setObjectName(Parameters::kVisMaxDepth().c_str());
@@ -4180,7 +4182,7 @@ void PreferencesDialog::selectSourceDriver(Src src, int variant)
{
Src previousCameraSrc = getSourceDriver();
Src previousLidarSrc = getLidarSourceDriver();
if(_ui->comboBox_imuFilter_strategy->currentIndex()==0)
{
_ui->comboBox_imuFilter_strategy->setCurrentIndex(2);
@@ -5376,6 +5378,7 @@ void PreferencesDialog::useOdomFeatures()
_ui->surf_doubleSpinBox_maxDepth->setValue(_ui->loopClosure_bowMaxDepth->value());
_ui->surf_doubleSpinBox_minDepth->setValue(_ui->loopClosure_bowMinDepth->value());
_ui->surf_spinBox_wordsPerImageTarget->setValue(_ui->reextract_maxFeatures->value());
_ui->checkBox_kp_ssc->setChecked(_ui->checkBox_visSSC->isChecked());
_ui->spinBox_KPGridRows->setValue(_ui->reextract_gridrows->value());
_ui->spinBox_KPGridCols->setValue(_ui->reextract_gridcols->value());
_ui->lineEdit_kp_roi->setText(_ui->loopClosure_roi->text());

View File

@@ -10587,14 +10587,8 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QLabel" name="label_81">
<property name="toolTip">
<string>0 means that the response (hessian) threshold
used for the detector will not be adapted.
Otherwise, the threshold is modified to
generate the number of words requested.</string>
</property>
<property name="text">
<string>Bad signature ratio (less than Ratio x AverageWordsPerImage = bad).</string>
</property>
@@ -10606,7 +10600,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="11" column="1">
<widget class="QLabel" name="label_99">
<property name="text">
<string>Top ROI ratio (0 = no change).</string>
@@ -10619,7 +10613,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QDoubleSpinBox" name="surf_doubleSpinBox_ratioBadSign">
<property name="decimals">
<number>2</number>
@@ -10640,12 +10634,6 @@ generate the number of words requested.</string>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_57">
<property name="toolTip">
<string>0 means that the response (hessian) threshold
used for the detector will not be adapted.
Otherwise, the threshold is modified to
generate the number of words requested.</string>
</property>
<property name="text">
<string>Minimum words depth. Only used when a depth image is provided. Applied before &quot;Maximum words per image&quot;.</string>
</property>
@@ -10741,14 +10729,14 @@ generate the number of words requested.</string>
</item>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLineEdit" name="lineEdit_kp_roi">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QLabel" name="label_101">
<property name="text">
<string>ROI ratios [left, right, top, bottom] between 0 and 1.</string>
@@ -10763,12 +10751,6 @@ generate the number of words requested.</string>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_53">
<property name="toolTip">
<string>0 means that the response (hessian) threshold
used for the detector will not be adapted.
Otherwise, the threshold is modified to
generate the number of words requested.</string>
</property>
<property name="text">
<string>Maximum words depth (0 means inf). Only used when a depth image is provided. Applied before &quot;Maximum words per image&quot;.</string>
</property>
@@ -10780,7 +10762,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_kp_roi1">
<property name="suffix">
<string> %</string>
@@ -10834,11 +10816,31 @@ generate the number of words requested.</string>
<number>2000</number>
</property>
<property name="value">
<number>150</number>
<number>500</number>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="checkBox_kp_ssc">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_755">
<property name="text">
<string>If true, SSC (Suppression via Square Covering) is applied to limit keypoints.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_kp_roi0">
<property name="suffix">
<string> %</string>
@@ -10848,7 +10850,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QLabel" name="label_97">
<property name="text">
<string>Left ROI ratio (0 = no change).</string>
@@ -10861,7 +10863,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="QLabel" name="label_98">
<property name="text">
<string>Right ROI ratio (0 = no change).</string>
@@ -10874,7 +10876,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="10" column="0">
<item row="11" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_kp_roi2">
<property name="suffix">
<string> %</string>
@@ -10884,7 +10886,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="11" column="0">
<item row="12" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_kp_roi3">
<property name="suffix">
<string> %</string>
@@ -10894,7 +10896,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="11" column="1">
<item row="12" column="1">
<widget class="QLabel" name="label_100">
<property name="text">
<string>Bottom ROI ratio (0 = no change).</string>
@@ -10929,14 +10931,8 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="12" column="1">
<item row="13" column="1">
<widget class="QLabel" name="label_50">
<property name="toolTip">
<string>0 means that the response (hessian) threshold
used for the detector will not be adapted.
Otherwise, the threshold is modified to
generate the number of words requested.</string>
</property>
<property name="text">
<string>Number of rows of the grid used to extract uniformly &quot;max words / grid cells&quot; features from each cell.</string>
</property>
@@ -10948,7 +10944,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="12" column="0">
<item row="13" column="0">
<widget class="QSpinBox" name="spinBox_KPGridRows">
<property name="minimum">
<number>1</number>
@@ -10961,7 +10957,7 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="13" column="0">
<item row="14" column="0">
<widget class="QSpinBox" name="spinBox_KPGridCols">
<property name="minimum">
<number>1</number>
@@ -10974,14 +10970,8 @@ generate the number of words requested.</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="14" column="1">
<widget class="QLabel" name="label_86">
<property name="toolTip">
<string>0 means that the response (hessian) threshold
used for the detector will not be adapted.
Otherwise, the threshold is modified to
generate the number of words requested.</string>
</property>
<property name="text">
<string>Number of columns of the grid used to extract uniformly &quot;max words / grid cells&quot; features from each cell.</string>
</property>
@@ -10995,12 +10985,6 @@ generate the number of words requested.</string>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_262">
<property name="toolTip">
<string>0 means that the response (hessian) threshold
used for the detector will not be adapted.
Otherwise, the threshold is modified to
generate the number of words requested.</string>
</property>
<property name="text">
<string>Use depth image as mask when extracting features.</string>
</property>
@@ -11021,12 +11005,6 @@ generate the number of words requested.</string>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_582">
<property name="toolTip">
<string>0 means that the response (hessian) threshold
used for the detector will not be adapted.
Otherwise, the threshold is modified to
generate the number of words requested.</string>
</property>
<property name="text">
<string>Triangulate features without depth using stereo from motion (odometry). It would be ignored if depth as mask is checked and the feature detector used supports masking.</string>
</property>
@@ -21684,7 +21662,7 @@ Lower the ratio -&gt; higher the precision.</string>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox__visCorGuessMatchToProjection">
<widget class="QCheckBox" name="checkBox_visCorGuessMatchToProjection">
<property name="text">
<string/>
</property>
@@ -22461,7 +22439,7 @@ Lower the ratio -&gt; higher the precision.</string>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_25" columnstretch="0,1">
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLabel" name="label_237">
<property name="text">
<string>Maximum feature depth.</string>
@@ -22474,7 +22452,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QLabel" name="label_261">
<property name="text">
<string>ROI ratios [left right top bottom] between 0 and 1.</string>
@@ -22487,7 +22465,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLineEdit" name="loopClosure_roi"/>
</item>
<item row="2" column="0">
@@ -22510,7 +22488,27 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_visSSC">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_756">
<property name="text">
<string>If true, SSC (Suppression via Square Covering) is applied to limit keypoints.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_275">
<property name="text">
<string>Minimum feature depth.</string>
@@ -22613,7 +22611,7 @@ Lower the ratio -&gt; higher the precision.</string>
</item>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QDoubleSpinBox" name="loopClosure_bowMaxDepth">
<property name="suffix">
<string> m</string>
@@ -22636,7 +22634,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QDoubleSpinBox" name="loopClosure_bowMinDepth">
<property name="suffix">
<string> m</string>
@@ -22649,7 +22647,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QSpinBox" name="reextract_gridrows">
<property name="minimum">
<number>1</number>
@@ -22662,7 +22660,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QLabel" name="label_438">
<property name="text">
<string>Number of rows of the grid used to extract uniformly &quot;max features / grid cells&quot; features from each cell.</string>
@@ -22675,7 +22673,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QLabel" name="label_439">
<property name="text">
<string>Number of columns of the grid used to extract uniformly &quot;max features / grid cells&quot; features from each cell.</string>
@@ -22688,7 +22686,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QSpinBox" name="reextract_gridcols">
<property name="minimum">
<number>1</number>
@@ -22701,7 +22699,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLabel" name="label_450">
<property name="text">
<string>Use depth image as mask when extracting features.</string>
@@ -22714,7 +22712,7 @@ Lower the ratio -&gt; higher the precision.</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="checkBox_visDepthAsMask">
<property name="text">
<string/>