MarkerDetection: added automatic marker's length estimation when depth image is provided (and when Aruco/MarkerLength is 0).

This commit is contained in:
matlabbe
2019-02-22 20:01:09 -05:00
parent e635f35cf1
commit d089e95e5a
6 changed files with 111 additions and 12 deletions

View File

@@ -2656,7 +2656,7 @@ void MainWindow::updateMapCloud(
for(std::map<int, Transform>::const_iterator iter=posesIn.begin(); iter!=posesIn.end() && iter->first<0; ++iter)
{
#if PCL_VERSION_COMPARE(>=, 1, 7, 2)
_cloudViewer->addOrUpdateCoordinate(uFormat("landmark_%d", -iter->first), iter->second, _preferencesDialog->getMarkerLength()/2.0, false);
_cloudViewer->addOrUpdateCoordinate(uFormat("landmark_%d", -iter->first), iter->second, _preferencesDialog->getMarkerLength()<=0?0.1:_preferencesDialog->getMarkerLength()/2.0, false);
#endif
if(_preferencesDialog->isLabelsShown())
{
@@ -4361,11 +4361,11 @@ void MainWindow::drawLandmarks(cv::Mat & image, const Signature & signature)
t.rotationMatrix().convertTo(R, CV_64F);
cv::Rodrigues(R, rvec);
//cv::aruco::drawAxis(image, model.K(), model.D(), rvec, tvec, _preferencesDialog->getMarkerLength() * 0.5f);
//cv::aruco::drawAxis(image, model.K(), model.D(), rvec, tvec, _preferencesDialog->getMarkerLength()<=0?0.1:_preferencesDialog->getMarkerLength() * 0.5f);
// project axis points
std::vector< cv::Point3f > axisPoints;
float length = _preferencesDialog->getMarkerLength() * 0.5f;
float length = _preferencesDialog->getMarkerLength()<=0?0.1:_preferencesDialog->getMarkerLength() * 0.5f;
axisPoints.push_back(cv::Point3f(0, 0, 0));
axisPoints.push_back(cv::Point3f(length, 0, 0));
axisPoints.push_back(cv::Point3f(0, length, 0));

View File

@@ -96,7 +96,7 @@
<x>0</x>
<y>0</y>
<width>680</width>
<height>2986</height>
<height>3008</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -11207,7 +11207,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
<item row="1" column="1">
<widget class="QLabel" name="label_space2_7">
<property name="text">
<string>Marker length. The length (m) of the markers' side.</string>
<string>Marker length. 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).</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -11248,7 +11248,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
<double>0.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>