mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
Added Aruco/MaxDepthError parameter
This commit is contained in:
@@ -49,6 +49,7 @@ private:
|
|||||||
#ifdef HAVE_OPENCV_ARUCO
|
#ifdef HAVE_OPENCV_ARUCO
|
||||||
cv::Ptr<cv::aruco::DetectorParameters> detectorParams_;
|
cv::Ptr<cv::aruco::DetectorParameters> detectorParams_;
|
||||||
float markerLength_;
|
float markerLength_;
|
||||||
|
float maxDepthError_;
|
||||||
int dictionaryId_;
|
int dictionaryId_;
|
||||||
cv::Ptr<cv::aruco::Dictionary> dictionary_;
|
cv::Ptr<cv::aruco::Dictionary> dictionary_;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -712,6 +712,7 @@ class RTABMAP_EXP Parameters
|
|||||||
|
|
||||||
RTABMAP_PARAM(Aruco, Dictionary, int, 0, "Dictionary to use: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2, DICT_4X4_1000=3, DICT_5X5_50=4, DICT_5X5_100=5, DICT_5X5_250=6, DICT_5X5_1000=7, DICT_6X6_50=8, DICT_6X6_100=9, DICT_6X6_250=10, DICT_6X6_1000=11, DICT_7X7_50=12, DICT_7X7_100=13, DICT_7X7_250=14, DICT_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16, DICT_APRILTAG_16h5=17, DICT_APRILTAG_25h9=18, DICT_APRILTAG_36h10=19, DICT_APRILTAG_36h11=20");
|
RTABMAP_PARAM(Aruco, Dictionary, int, 0, "Dictionary to use: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2, DICT_4X4_1000=3, DICT_5X5_50=4, DICT_5X5_100=5, DICT_5X5_250=6, DICT_5X5_1000=7, DICT_6X6_50=8, DICT_6X6_100=9, DICT_6X6_250=10, DICT_6X6_1000=11, DICT_7X7_50=12, DICT_7X7_100=13, DICT_7X7_250=14, DICT_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16, DICT_APRILTAG_16h5=17, DICT_APRILTAG_25h9=18, DICT_APRILTAG_36h10=19, DICT_APRILTAG_36h11=20");
|
||||||
RTABMAP_PARAM(Aruco, MarkerLength, float, 0, "The length (m) of the markers' side. 0 means automatic marker length estimation using the depth image (the camera should look at the marker perpendicularly for initialization).");
|
RTABMAP_PARAM(Aruco, MarkerLength, float, 0, "The length (m) of the markers' side. 0 means automatic marker length estimation using the depth image (the camera should look at the marker perpendicularly for initialization).");
|
||||||
|
RTABMAP_PARAM(Aruco, MaxDepthError, float, 0.01, uFormat("Maximum depth error between all corners of a marker when estimating the marker length (when %s is 0). The smaller it is, the more perpendicular the camera should be toward the marker to initialize the length.", kArucoMarkerLength().c_str()));
|
||||||
RTABMAP_PARAM(Aruco, VarianceLinear, float, 0.001, "Linear variance to set on marker detections.");
|
RTABMAP_PARAM(Aruco, VarianceLinear, float, 0.001, "Linear variance to set on marker detections.");
|
||||||
RTABMAP_PARAM(Aruco, VarianceAngular, float, 0.01, "Angular variance to set on marker detections. Set to >=9999 to use only position (xyz) constraint in graph optimization.");
|
RTABMAP_PARAM(Aruco, VarianceAngular, float, 0.01, "Angular variance to set on marker detections. Set to >=9999 to use only position (xyz) constraint in graph optimization.");
|
||||||
RTABMAP_PARAM(Aruco, CornerRefinementMethod, int, 0, "Corner refinement method (0: None, 1: Subpixel, 2:contour, 3: AprilTag 2). For OpenCV <3.3.0, this is \"doCornerRefinement\" parameter: set 0 for false and 1 for true.");
|
RTABMAP_PARAM(Aruco, CornerRefinementMethod, int, 0, "Corner refinement method (0: None, 1: Subpixel, 2:contour, 3: AprilTag 2). For OpenCV <3.3.0, this is \"doCornerRefinement\" parameter: set 0 for false and 1 for true.");
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ MarkerDetector::MarkerDetector(const ParametersMap & parameters)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_OPENCV_ARUCO
|
#ifdef HAVE_OPENCV_ARUCO
|
||||||
markerLength_ = Parameters::defaultArucoMarkerLength();
|
markerLength_ = Parameters::defaultArucoMarkerLength();
|
||||||
|
maxDepthError_ = Parameters::defaultArucoMaxDepthError();
|
||||||
dictionaryId_ = Parameters::defaultArucoDictionary();
|
dictionaryId_ = Parameters::defaultArucoDictionary();
|
||||||
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_MINOR_VERSION >=2)
|
#if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION == 3 && CV_MINOR_VERSION >=2)
|
||||||
detectorParams_ = cv::aruco::DetectorParameters::create();
|
detectorParams_ = cv::aruco::DetectorParameters::create();
|
||||||
@@ -85,6 +86,7 @@ void MarkerDetector::parseParameters(const ParametersMap & parameters)
|
|||||||
detectorParams_->errorCorrectionRate = 0.6;
|
detectorParams_->errorCorrectionRate = 0.6;
|
||||||
|
|
||||||
Parameters::parse(parameters, Parameters::kArucoMarkerLength(), markerLength_);
|
Parameters::parse(parameters, Parameters::kArucoMarkerLength(), markerLength_);
|
||||||
|
Parameters::parse(parameters, Parameters::kArucoMaxDepthError(), maxDepthError_);
|
||||||
Parameters::parse(parameters, Parameters::kArucoDictionary(), dictionaryId_);
|
Parameters::parse(parameters, Parameters::kArucoDictionary(), dictionaryId_);
|
||||||
#if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION <4 || (CV_MINOR_VERSION ==4 && CV_SUBMINOR_VERSION<2)))
|
#if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION <4 || (CV_MINOR_VERSION ==4 && CV_SUBMINOR_VERSION<2)))
|
||||||
if(dictionaryId_ >= 17)
|
if(dictionaryId_ >= 17)
|
||||||
@@ -152,9 +154,9 @@ std::map<int, Transform> MarkerDetector::detect(const cv::Mat & image, const Cam
|
|||||||
// best depth estimation)
|
// best depth estimation)
|
||||||
if(d1>0 && d2>0 && d3>0 && d4>0)
|
if(d1>0 && d2>0 && d3>0 && d4>0)
|
||||||
{
|
{
|
||||||
if( fabs(d1-d2) < 0.01f &&
|
if( fabs(d1-d2) < maxDepthError_ &&
|
||||||
fabs(d1-d3) < 0.01f &&
|
fabs(d1-d3) < maxDepthError_ &&
|
||||||
fabs(d1-d4) < 0.01f)
|
fabs(d1-d4) < maxDepthError_)
|
||||||
{
|
{
|
||||||
float depth = (d1+d2+d3+d4)/4.0f;
|
float depth = (d1+d2+d3+d4)/4.0f;
|
||||||
scales.push_back(depth/tvecs[i].val[2]);
|
scales.push_back(depth/tvecs[i].val[2]);
|
||||||
@@ -165,10 +167,11 @@ std::map<int, Transform> MarkerDetector::detect(const cv::Mat & image, const Cam
|
|||||||
{
|
{
|
||||||
UWARN("The four marker's corners should be "
|
UWARN("The four marker's corners should be "
|
||||||
"perpendicular to camera to estimate correctly "
|
"perpendicular to camera to estimate correctly "
|
||||||
"the marker's length. Errors: %f, %f, %f > 0.01m."
|
"the marker's length. Errors: %f, %f, %f > %fm (%s). Four corners: %f %f %f %f. "
|
||||||
"Parameter %s can be set to non-null to skip automatic "
|
"Parameter %s can be set to non-null to skip automatic "
|
||||||
"marker length estimation. Detections are ignored.",
|
"marker length estimation. Detections are ignored.",
|
||||||
fabs(d1-d2), fabs(d1-d3), fabs(d1-d4),
|
fabs(d1-d2), fabs(d1-d3), fabs(d1-d4), maxDepthError_, Parameters::kArucoMaxDepthError().c_str(),
|
||||||
|
d1, d2, d3, d4,
|
||||||
Parameters::kArucoMarkerLength().c_str());
|
Parameters::kArucoMarkerLength().c_str());
|
||||||
detections.clear();
|
detections.clear();
|
||||||
return detections;
|
return detections;
|
||||||
|
|||||||
@@ -1219,6 +1219,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
|||||||
// Aruco marker
|
// Aruco marker
|
||||||
_ui->ArucoDictionary->setObjectName(Parameters::kArucoDictionary().c_str());
|
_ui->ArucoDictionary->setObjectName(Parameters::kArucoDictionary().c_str());
|
||||||
_ui->ArucoMarkerLength->setObjectName(Parameters::kArucoMarkerLength().c_str());
|
_ui->ArucoMarkerLength->setObjectName(Parameters::kArucoMarkerLength().c_str());
|
||||||
|
_ui->ArucoMaxDepthError->setObjectName(Parameters::kArucoMaxDepthError().c_str());
|
||||||
_ui->ArucoVarianceLinear->setObjectName(Parameters::kArucoVarianceLinear().c_str());
|
_ui->ArucoVarianceLinear->setObjectName(Parameters::kArucoVarianceLinear().c_str());
|
||||||
_ui->ArucoVarianceAngular->setObjectName(Parameters::kArucoVarianceAngular().c_str());
|
_ui->ArucoVarianceAngular->setObjectName(Parameters::kArucoVarianceAngular().c_str());
|
||||||
_ui->ArucoCornerRefinementMethod->setObjectName(Parameters::kArucoCornerRefinementMethod().c_str());
|
_ui->ArucoCornerRefinementMethod->setObjectName(Parameters::kArucoCornerRefinementMethod().c_str());
|
||||||
|
|||||||
@@ -95,24 +95,15 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>680</width>
|
<width>673</width>
|
||||||
<height>3008</height>
|
<height>3038</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@@ -5173,16 +5164,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
|||||||
<string>Directory of images (optional settings)</string>
|
<string>Directory of images (optional settings)</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_93">
|
<layout class="QVBoxLayout" name="verticalLayout_93">
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@@ -11139,27 +11121,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_136">
|
<layout class="QVBoxLayout" name="verticalLayout_136">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_63" columnstretch="0,1">
|
<layout class="QGridLayout" name="gridLayout_63" columnstretch="0,1">
|
||||||
<item row="3" column="1">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_space2_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>Angular variance to set on marker detections. Set to >=9999 to use only position (xyz) constraint in graph optimization.</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="RGBDMarkerDetection">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QDoubleSpinBox" name="ArucoVarianceLinear">
|
<widget class="QDoubleSpinBox" name="ArucoVarianceLinear">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string/>
|
<string/>
|
||||||
@@ -11191,7 +11153,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_space2_6">
|
<widget class="QLabel" name="label_space2_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Linear variance to set on marker detections.</string>
|
<string>Linear variance to set on marker detections.</string>
|
||||||
@@ -11217,7 +11179,27 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="1">
|
||||||
|
<widget class="QLabel" name="label_space2_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Angular variance to set on marker detections. Set to >=9999 to use only position (xyz) constraint in graph optimization.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="RGBDMarkerDetection">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
<widget class="QDoubleSpinBox" name="ArucoVarianceAngular">
|
<widget class="QDoubleSpinBox" name="ArucoVarianceAngular">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string/>
|
<string/>
|
||||||
@@ -11258,6 +11240,38 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="label_space2_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Maximum depth error between all corners of a marker when estimating the marker length (when marker length above is 0). The smaller it is, the more perpendicular the camera should be toward the marker to initialize the length.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QDoubleSpinBox" name="ArucoMaxDepthError">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> m</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>0.000100000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.010000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -15819,16 +15833,7 @@ Lower the ratio -> higher the precision.</string>
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@@ -15908,16 +15913,7 @@ Lower the ratio -> higher the precision.</string>
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@@ -16029,16 +16025,7 @@ Lower the ratio -> higher the precision.</string>
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user