mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-04 09:07:47 +08:00
fixed some quirks (camera viewer + tag working)
This commit is contained in:
@@ -77,6 +77,7 @@ private:
|
||||
QElapsedTimer fpsTimer_;
|
||||
double lastCapturePeriod_;
|
||||
double previousCaptureStamp_;
|
||||
std::map<int, float> _landmarksSize;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
@@ -84,7 +84,7 @@ CameraViewer::CameraViewer(QWidget * parent, const ParametersMap & parameters) :
|
||||
showScanCheckbox_->setChecked(true);
|
||||
|
||||
markerCheckbox_ = new QCheckBox("Detect markers", this);
|
||||
#ifdef HAVE_OPENCV_ARUCO
|
||||
#if defined(HAVE_OPENCV_ARUCO) || defined(RTABMAP_APRILTAG)
|
||||
markerCheckbox_->setEnabled(true);
|
||||
markerDetector_ = new MarkerDetector(parameters);
|
||||
#else
|
||||
@@ -165,12 +165,22 @@ void CameraViewer::showImage(const rtabmap::SensorData & data)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_landmarksSize.clear();
|
||||
}
|
||||
|
||||
if(!models.empty() && models[0].isValidForProjection())
|
||||
{
|
||||
cv::Mat imageWithDetections;
|
||||
detections = markerDetector_->detect(left, models, depthOrRight, std::map<int, float>(), &imageWithDetections);
|
||||
detections = markerDetector_->detect(left, models, depthOrRight, _landmarksSize, &imageWithDetections);
|
||||
imageView_->setImage(uCvMat2QImage(imageWithDetections));
|
||||
for(std::map<int, MarkerInfo>::iterator iter=detections.begin(); iter!=detections.end(); ++iter)
|
||||
{
|
||||
if(iter->second.length() > 0.0f) {
|
||||
_landmarksSize.insert(std::make_pair(iter->first, iter->second.length()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -236,7 +246,7 @@ void CameraViewer::showImage(const rtabmap::SensorData & data)
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 7, 2)
|
||||
cloudView_->addOrUpdateCoordinate(uFormat("landmark_%d", iter->first), iter->second.pose(), iter->second.length(), false);
|
||||
#endif
|
||||
std::string num = uNumber2Str(iter->first);
|
||||
std::string num = uFormat("%d (%.1f cm)", iter->first, iter->second.length()*100.0f);
|
||||
cloudView_->addOrUpdateText(
|
||||
std::string("landmark_str_") + num,
|
||||
num,
|
||||
|
||||
@@ -5640,6 +5640,17 @@ void PreferencesDialog::updateAvailableMarkerDictionaries()
|
||||
{
|
||||
_ui->MarkerDictionary->setCurrentIndex(Parameters::defaultMarkerDictionary());
|
||||
}
|
||||
#else
|
||||
if(_ui->MarkerDictionary->currentIndex() >=17 && _ui->MarkerDictionary->currentIndex() <= 20)
|
||||
{
|
||||
// If apriltag is selected, select apriltag refinement by default
|
||||
_ui->OpenCVCornerRefinementMethod->setCurrentIndex(3);
|
||||
}
|
||||
else if(_ui->OpenCVCornerRefinementMethod->currentIndex() == 3)
|
||||
{
|
||||
// If not apriltag dictionary selected, reset refinement to default.
|
||||
_ui->OpenCVCornerRefinementMethod->setCurrentIndex(Parameters::defaultMarkerOpenCVCornerRefinementMethod());
|
||||
}
|
||||
#endif
|
||||
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <8)
|
||||
// disable aruco MPI dictionary
|
||||
|
||||
@@ -15556,10 +15556,6 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDoubleSpinBox" name="MarkerLength">
|
||||
<property name="toolTip">
|
||||
<string>If 0, the length is estimated only on the first marker detected, then re-used for all next detections (i.e., this assumes that markers have all the same length).
|
||||
With <0, the length is estimated once for each unique marker, then re-used for next detections with the same marker ID.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
@@ -15627,8 +15623,12 @@ With <0, the length is estimated once for each unique marker, then re-used fo
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_space2_7">
|
||||
<property name="toolTip">
|
||||
<string>If 0, the length is estimated only on the first marker detected, then re-used for all next detections (i.e., this assumes that markers have all the same length).
|
||||
With <0, the length is estimated once for each unique marker, then re-used for next detections with the same marker ID.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Marker length. The length (m) of the markers' side. Value &lt;=0 means automatic marker length estimation using the depth image (the camera should look at the marker perpendicularly for initialization). Mouse over the spinbox to see the difference between negative and 0.</string>
|
||||
<string>Marker length. The length (m) of the markers' side. Value &lt;=0 means automatic marker length estimation using the depth image (the camera should look at the marker perpendicularly for initialization). Mouse over this label to see the difference between negative and 0.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@@ -16000,9 +16000,6 @@ With <0, the length is estimated once for each unique marker, then re-used fo
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLineEdit" name="MarkerLengths">
|
||||
<property name="toolTip">
|
||||
<string>For example, to detect markers 12 and 14 with lengths of 8 and 15 cm respectively, and all markers between 30 and 40 with a length of 10 cm, set "12 0.08|14 0.15|30:40 0.1"</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -16010,8 +16007,11 @@ With <0, the length is estimated once for each unique marker, then re-used fo
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_space2_25">
|
||||
<property name="toolTip">
|
||||
<string>For example, to detect markers 12 and 14 with lengths of 8 and 15 cm respectively, and all markers between 30 and 40 with a length of 10 cm, set "12 0.08|14 0.15|30:40 0.1"</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>List of markers to detect. Format is the marker's ID followed by its length (in meters), markers are separated by a vertical line ("id1 length|id2 length"). We can also define a range of markers with "id1:id2 length" (id2 included). If empty, all markers of the chosen dictionary can be detected and their length is set/estimated based on Marker Length. Mouse over text box for example.</string>
|
||||
<string>List of markers to detect. Format is the marker's ID followed by its length (in meters), markers are separated by a vertical line ("id1 length|id2 length"). We can also define a range of markers with "id1:id2 length" (id2 included). If empty, all markers of the chosen dictionary can be detected and their length is set/estimated based on Marker Length. Mouse over this label for example.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
||||
Reference in New Issue
Block a user