mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Added OpenCV 3 support
This commit is contained in:
@@ -42,6 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <set>
|
||||
|
||||
#include <pcl/visualization/mouse_event.h>
|
||||
#include <pcl/PCLPointCloud2.h>
|
||||
|
||||
@@ -736,12 +736,27 @@ void CalibrationDialog::calibrate()
|
||||
objectPoints.resize(stereoImagePoints_[0].size(), objectPoints[0]);
|
||||
|
||||
// calibrate extrinsic
|
||||
double rms = cv::stereoCalibrate(objectPoints, stereoImagePoints_[0], stereoImagePoints_[1],
|
||||
models_[0].K(), models_[0].D(),
|
||||
models_[1].K(), models_[1].D(),
|
||||
imageSize, R, T, E, F,
|
||||
cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS, 100, 1e-5),
|
||||
cv::CALIB_FIX_INTRINSIC);
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
double rms = cv::stereoCalibrate(
|
||||
objectPoints,
|
||||
stereoImagePoints_[0],
|
||||
stereoImagePoints_[1],
|
||||
models_[0].K(), models_[0].D(),
|
||||
models_[1].K(), models_[1].D(),
|
||||
imageSize, R, T, E, F,
|
||||
cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS, 100, 1e-5),
|
||||
cv::CALIB_FIX_INTRINSIC);
|
||||
#else
|
||||
double rms = cv::stereoCalibrate(
|
||||
objectPoints,
|
||||
stereoImagePoints_[0],
|
||||
stereoImagePoints_[1],
|
||||
models_[0].K(), models_[0].D(),
|
||||
models_[1].K(), models_[1].D(),
|
||||
imageSize, R, T, E, F,
|
||||
cv::CALIB_FIX_INTRINSIC,
|
||||
cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS, 100, 1e-5));
|
||||
#endif
|
||||
UINFO("stereo calibration... done with RMS error=%f", rms);
|
||||
|
||||
double err = 0;
|
||||
|
||||
@@ -70,7 +70,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/utilite/UEventsManager.h>
|
||||
#include "utilite/UPlot.h"
|
||||
|
||||
#include <opencv2/gpu/gpu.hpp>
|
||||
#include <opencv2/opencv_modules.hpp>
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
#include <opencv2/gpu/gpu.hpp>
|
||||
#else
|
||||
#include <opencv2/core/cuda.hpp>
|
||||
#endif
|
||||
|
||||
using namespace rtabmap;
|
||||
|
||||
@@ -91,7 +96,16 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
_ui = new Ui_preferencesDialog();
|
||||
_ui->setupUi(this);
|
||||
|
||||
if(cv::gpu::getCudaEnabledDeviceCount() == 0)
|
||||
bool haveCuda = false;
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
haveCuda = cv::gpu::getCudaEnabledDeviceCount() != 0;
|
||||
#else
|
||||
haveCuda = cv::cuda::getCudaEnabledDeviceCount() != 0;
|
||||
#ifndef HAVE_OPENCV_CUDAFEATURES2D
|
||||
haveCuda = false;
|
||||
#endif
|
||||
#endif
|
||||
if(!haveCuda)
|
||||
{
|
||||
_ui->surf_checkBox_gpuVersion->setChecked(false);
|
||||
_ui->surf_checkBox_gpuVersion->setEnabled(false);
|
||||
@@ -133,6 +147,27 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
||||
_ui->comboBox_dictionary_strategy->setItemData(1, 0, Qt::UserRole - 1);
|
||||
_ui->reextract_nn->setItemData(1, 0, Qt::UserRole - 1);
|
||||
_ui->odom_bin_nn->setItemData(1, 0, Qt::UserRole - 1);
|
||||
|
||||
#if CV_MAJOR_VERSION == 3
|
||||
_ui->comboBox_detector_strategy->setItemData(0, 0, Qt::UserRole - 1);
|
||||
_ui->comboBox_detector_strategy->setItemData(1, 0, Qt::UserRole - 1);
|
||||
_ui->comboBox_detector_strategy->setItemData(3, 0, Qt::UserRole - 1);
|
||||
_ui->comboBox_detector_strategy->setItemData(4, 0, Qt::UserRole - 1);
|
||||
_ui->comboBox_detector_strategy->setItemData(5, 0, Qt::UserRole - 1);
|
||||
_ui->comboBox_detector_strategy->setItemData(6, 0, Qt::UserRole - 1);
|
||||
_ui->reextract_type->setItemData(0, 0, Qt::UserRole - 1);
|
||||
_ui->reextract_type->setItemData(1, 0, Qt::UserRole - 1);
|
||||
_ui->reextract_type->setItemData(3, 0, Qt::UserRole - 1);
|
||||
_ui->reextract_type->setItemData(4, 0, Qt::UserRole - 1);
|
||||
_ui->reextract_type->setItemData(5, 0, Qt::UserRole - 1);
|
||||
_ui->reextract_type->setItemData(6, 0, Qt::UserRole - 1);
|
||||
_ui->odom_type->setItemData(0, 0, Qt::UserRole - 1);
|
||||
_ui->odom_type->setItemData(1, 0, Qt::UserRole - 1);
|
||||
_ui->odom_type->setItemData(3, 0, Qt::UserRole - 1);
|
||||
_ui->odom_type->setItemData(4, 0, Qt::UserRole - 1);
|
||||
_ui->odom_type->setItemData(5, 0, Qt::UserRole - 1);
|
||||
_ui->odom_type->setItemData(6, 0, Qt::UserRole - 1);
|
||||
#endif
|
||||
}
|
||||
if(!graph::G2OOptimizer::available())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user