Adding OpenCV's GPU GFTT/ OpticalFlow and CudaSift support (#1330)

* Adding GFTT and SIFT Cuda support

* Working CudaSift

* Disable cudasift option when not available

* Added check to avoid re-allocating gpu memory everytime parseParameters is called. Added workaround of to detect/ignore invalid descriptors

* Added SIFT/PreciseUpscale and SIFT/Upscale parameters. Adjusted max octave to behave more like opencv

* Refactored how maximum features are thresholded, to be more similar to OpenCV version

* Updated loop closure benchmark scripts

* Cuda optical flow tmp commit

* Added Stereo/Gpu Vis/CorFlowGpu parameters (optical flow gpu integration for F2F odom and stereo correspondences)

* Fixed build without opencv cuda

* Fixed build with Opencv 4.10

* ZED: updated parameters to match zed sdk 4

* MRPT requires C++17

* updated max octave limit CudaSift
This commit is contained in:
matlabbe
2024-09-13 14:22:54 -07:00
committed by GitHub
parent f3ccfcb452
commit 69ac21f811
37 changed files with 2253 additions and 1375 deletions
+37 -8
View File
@@ -159,10 +159,28 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->checkBox_ORBGpu->setEnabled(false);
_ui->label_orbGpu->setEnabled(false);
_ui->checkBox_GFTT_gpu->setEnabled(false);
_ui->label_GFTT_gpu->setEnabled(false);
// disable BruteForceGPU option
_ui->comboBox_dictionary_strategy->setItemData(4, 0, Qt::UserRole - 1);
_ui->reextract_nn->setItemData(4, 0, Qt::UserRole - 1);
}
#ifndef RTABMAP_CUDASIFT
_ui->sift_checkBox_gpu->setEnabled(false);
_ui->sift_label_gpu->setEnabled(false);
_ui->sift_doubleSpinBox_gaussianDiffThreshold->setEnabled(false);
_ui->sift_label_gaussianThreshold->setEnabled(false);
_ui->sift_checkBox_upscale->setEnabled(false);
_ui->sift_label_upscale->setEnabled(false);
#endif
#ifndef HAVE_OPENCV_CUDAOPTFLOW
_ui->odom_flow_gpu->setEnabled(false);
_ui->label_odom_flow_gpu->setEnabled(false);
_ui->stereo_flow_gpu->setEnabled(false);
_ui->label_stereo_flow_gpu->setEnabled(false);
#endif
#ifndef RTABMAP_OCTOMAP
_ui->groupBox_octomap->setChecked(false);
@@ -242,6 +260,10 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->vis_feature_detector->setItemData(1, 0, Qt::UserRole - 1);
#endif
#endif
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 8)
_ui->sift_checkBox_preciseUpscale->setEnabled(false);
_ui->sift_label_preciseUpscale->setEnabled(false);
#endif
#if CV_MAJOR_VERSION >= 3 && !defined(HAVE_OPENCV_XFEATURES2D)
_ui->comboBox_detector_strategy->setItemData(3, 0, Qt::UserRole - 1);
@@ -401,7 +423,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
}
else if(CameraStereoZed::sdkVersion() < 4)
{
_ui->comboBox_stereoZed_resolution->setItemData(2, 0, Qt::UserRole - 1);
_ui->comboBox_stereoZed_resolution->setItemData(1, 0, Qt::UserRole - 1);
_ui->comboBox_stereoZed_resolution->setItemData(4, 0, Qt::UserRole - 1);
_ui->comboBox_stereoZed_resolution->setItemData(6, 0, Qt::UserRole - 1);
_ui->comboBox_stereoZed_quality->setItemData(3, 0, Qt::UserRole - 1);
@@ -1063,12 +1085,15 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->surf_doubleSpinBox_gpuKeypointsRatio->setObjectName(Parameters::kSURFGpuKeypointsRatio().c_str());
//SIFT detector
_ui->sift_spinBox_nFeatures->setObjectName(Parameters::kSIFTNFeatures().c_str());
_ui->sift_spinBox_nOctaveLayers->setObjectName(Parameters::kSIFTNOctaveLayers().c_str());
_ui->sift_doubleSpinBox_contrastThr->setObjectName(Parameters::kSIFTContrastThreshold().c_str());
_ui->sift_doubleSpinBox_edgeThr->setObjectName(Parameters::kSIFTEdgeThreshold().c_str());
_ui->sift_doubleSpinBox_sigma->setObjectName(Parameters::kSIFTSigma().c_str());
_ui->sift_checkBox_preciseUpscale->setObjectName(Parameters::kSIFTPreciseUpscale().c_str());
_ui->sift_checkBox_rootsift->setObjectName(Parameters::kSIFTRootSIFT().c_str());
_ui->sift_checkBox_gpu->setObjectName(Parameters::kSIFTGpu().c_str());
_ui->sift_doubleSpinBox_gaussianDiffThreshold->setObjectName(Parameters::kSIFTGaussianThreshold().c_str());
_ui->sift_checkBox_upscale->setObjectName(Parameters::kSIFTUpscale().c_str());
//BRIEF descriptor
_ui->briefBytes->setObjectName(Parameters::kBRIEFBytes().c_str());
@@ -1106,6 +1131,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->spinBox_GFTT_blockSize->setObjectName(Parameters::kGFTTBlockSize().c_str());
_ui->checkBox_GFTT_useHarrisDetector->setObjectName(Parameters::kGFTTUseHarrisDetector().c_str());
_ui->doubleSpinBox_GFTT_k->setObjectName(Parameters::kGFTTK().c_str());
_ui->checkBox_GFTT_gpu->setObjectName(Parameters::kGFTTGpu().c_str());
//BRISK
_ui->spinBox_BRISK_thresh->setObjectName(Parameters::kBRISKThresh().c_str());
@@ -1265,10 +1291,11 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->subpix_winSize->setObjectName(Parameters::kVisSubPixWinSize().c_str());
_ui->subpix_iterations->setObjectName(Parameters::kVisSubPixIterations().c_str());
_ui->subpix_eps->setObjectName(Parameters::kVisSubPixEps().c_str());
_ui->odom_flow_winSize_2->setObjectName(Parameters::kVisCorFlowWinSize().c_str());
_ui->odom_flow_maxLevel_2->setObjectName(Parameters::kVisCorFlowMaxLevel().c_str());
_ui->odom_flow_iterations_2->setObjectName(Parameters::kVisCorFlowIterations().c_str());
_ui->odom_flow_eps_2->setObjectName(Parameters::kVisCorFlowEps().c_str());
_ui->odom_flow_winSize->setObjectName(Parameters::kVisCorFlowWinSize().c_str());
_ui->odom_flow_maxLevel->setObjectName(Parameters::kVisCorFlowMaxLevel().c_str());
_ui->odom_flow_iterations->setObjectName(Parameters::kVisCorFlowIterations().c_str());
_ui->odom_flow_eps->setObjectName(Parameters::kVisCorFlowEps().c_str());
_ui->odom_flow_gpu->setObjectName(Parameters::kVisCorFlowGpu().c_str());
_ui->loopClosure_bundle->setObjectName(Parameters::kVisBundleAdjustment().c_str());
//RegistrationIcp
@@ -1585,6 +1612,8 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->stereo_ssd->setObjectName(Parameters::kStereoSSD().c_str());
_ui->stereo_flow_eps->setObjectName(Parameters::kStereoEps().c_str());
_ui->stereo_opticalFlow->setObjectName(Parameters::kStereoOpticalFlow().c_str());
_ui->stereo_flow_gpu->setObjectName(Parameters::kStereoGpu().c_str());
// Odometry Open3D
_ui->odom_open3d_method->setObjectName(Parameters::kOdomOpen3DMethod().c_str());
@@ -2200,7 +2229,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->spinBox_stereo_right_device->setValue(-1);
_ui->spinBox_stereousbcam_streamWidth->setValue(0);
_ui->spinBox_stereousbcam_streamHeight->setValue(0);
_ui->comboBox_stereoZed_resolution->setCurrentIndex(CameraStereoZed::sdkVersion()<4?3:6);
_ui->comboBox_stereoZed_resolution->setCurrentIndex(0);
_ui->comboBox_stereoZed_quality->setCurrentIndex(1);
_ui->checkbox_stereoZed_selfCalibration->setChecked(true);
_ui->comboBox_stereoZed_sensingMode->setCurrentIndex(0);
@@ -6764,7 +6793,7 @@ Camera * PreferencesDialog::createCamera(
{
camera = new CameraStereoZed(
device.isEmpty()?0:atoi(device.toStdString().c_str()),
_ui->comboBox_stereoZed_resolution->currentIndex(),
_ui->comboBox_stereoZed_resolution->currentIndex()-1,
// depth should be enabled for zed vo to work
_ui->comboBox_stereoZed_quality->currentIndex()==0&&odomOnly?1:_ui->comboBox_stereoZed_quality->currentIndex(),
_ui->comboBox_stereoZed_sensingMode->currentIndex(),