Stereo: min and max disparity parameters are now float. ImageView: adjusted background color of info boxes.

This commit is contained in:
matlabbe
2017-11-14 11:36:37 -05:00
parent 10c5cb3721
commit b820e98bdc
8 changed files with 50 additions and 122 deletions

View File

@@ -535,8 +535,8 @@ class RTABMAP_EXP Parameters
RTABMAP_PARAM(Stereo, WinHeight, int, 3, "Window height."); RTABMAP_PARAM(Stereo, WinHeight, int, 3, "Window height.");
RTABMAP_PARAM(Stereo, Iterations, int, 30, "Maximum iterations."); RTABMAP_PARAM(Stereo, Iterations, int, 30, "Maximum iterations.");
RTABMAP_PARAM(Stereo, MaxLevel, int, 3, "Maximum pyramid level."); RTABMAP_PARAM(Stereo, MaxLevel, int, 3, "Maximum pyramid level.");
RTABMAP_PARAM(Stereo, MinDisparity, int, 1, "Minimum disparity."); RTABMAP_PARAM(Stereo, MinDisparity, float, 1.0, "Minimum disparity.");
RTABMAP_PARAM(Stereo, MaxDisparity, int, 128, "Maximum disparity."); RTABMAP_PARAM(Stereo, MaxDisparity, float, 128.0, "Maximum disparity.");
RTABMAP_PARAM(Stereo, OpticalFlow, bool, true, "Use optical flow to find stereo correspondences, otherwise a simple block matching approach is used."); RTABMAP_PARAM(Stereo, OpticalFlow, bool, true, "Use optical flow to find stereo correspondences, otherwise a simple block matching approach is used.");
RTABMAP_PARAM(Stereo, SSD, bool, true, uFormat("[%s=false] Use Sum of Squared Differences (SSD) window, otherwise Sum of Absolute Differences (SAD) window is used.", kStereoOpticalFlow().c_str())); RTABMAP_PARAM(Stereo, SSD, bool, true, uFormat("[%s=false] Use Sum of Squared Differences (SSD) window, otherwise Sum of Absolute Differences (SAD) window is used.", kStereoOpticalFlow().c_str()));
RTABMAP_PARAM(Stereo, Eps, double, 0.01, uFormat("[%s=true] Epsilon stop criterion.", kStereoOpticalFlow().c_str())); RTABMAP_PARAM(Stereo, Eps, double, 0.01, uFormat("[%s=true] Epsilon stop criterion.", kStereoOpticalFlow().c_str()));

View File

@@ -53,8 +53,8 @@ public:
cv::Size winSize() const {return cv::Size(winWidth_, winHeight_);} cv::Size winSize() const {return cv::Size(winWidth_, winHeight_);}
int iterations() const {return iterations_;} int iterations() const {return iterations_;}
int maxLevel() const {return maxLevel_;} int maxLevel() const {return maxLevel_;}
int minDisparity() const {return minDisparity_;} float minDisparity() const {return minDisparity_;}
int maxDisparity() const {return maxDisparity_;} float maxDisparity() const {return maxDisparity_;}
bool winSSD() const {return winSSD_;} bool winSSD() const {return winSSD_;}
private: private:
@@ -62,8 +62,8 @@ private:
int winHeight_; int winHeight_;
int iterations_; int iterations_;
int maxLevel_; int maxLevel_;
int minDisparity_; float minDisparity_;
int maxDisparity_; float maxDisparity_;
bool winSSD_; bool winSSD_;
}; };

View File

@@ -54,8 +54,8 @@ std::vector<cv::Point2f> RTABMAP_EXP calcStereoCorrespondences(
cv::Size winSize = cv::Size(6,3), cv::Size winSize = cv::Size(6,3),
int maxLevel = 3, int maxLevel = 3,
int iterations = 5, int iterations = 5,
int minDisparity = 0, float minDisparity = 0.0f,
int maxDisparity = 64, float maxDisparity = 64.0f,
bool ssdApproach = true); // SSD by default, otherwise it is SAD bool ssdApproach = true); // SSD by default, otherwise it is SAD
// exactly as cv::calcOpticalFlowPyrLK but it should be called with pyramid (from cv::buildOpticalFlowPyramid()) and delta drops the y error. // exactly as cv::calcOpticalFlowPyrLK but it should be called with pyramid (from cv::buildOpticalFlowPyramid()) and delta drops the y error.

View File

@@ -135,7 +135,7 @@ std::vector<cv::Point2f> StereoOpticalFlow::computeCorrespondences(
if(status[i]!=0) if(status[i]!=0)
{ {
float disparity = leftCorners[i].x - rightCorners[i].x; float disparity = leftCorners[i].x - rightCorners[i].x;
if(disparity < float(this->minDisparity()) || disparity > float(this->maxDisparity())) if(disparity <= this->minDisparity() || disparity > this->maxDisparity())
{ {
status[i] = 0; status[i] = 0;
++countDisparityRejected; ++countDisparityRejected;

View File

@@ -126,14 +126,14 @@ std::vector<cv::Point2f> calcStereoCorrespondences(
cv::Size winSize, cv::Size winSize,
int maxLevel, int maxLevel,
int iterations, int iterations,
int minDisparity, float minDisparityF,
int maxDisparity, float maxDisparityF,
bool ssdApproach) bool ssdApproach)
{ {
UDEBUG("winSize=(%d,%d)", winSize.width, winSize.height); UDEBUG("winSize=(%d,%d)", winSize.width, winSize.height);
UDEBUG("maxLevel=%d", maxLevel); UDEBUG("maxLevel=%d", maxLevel);
UDEBUG("minDisparity=%d", minDisparity); UDEBUG("minDisparity=%f", minDisparityF);
UDEBUG("maxDisparity=%d", maxDisparity); UDEBUG("maxDisparity=%f", maxDisparityF);
UDEBUG("iterations=%d", iterations); UDEBUG("iterations=%d", iterations);
UDEBUG("ssdApproach=%d", ssdApproach?1:0); UDEBUG("ssdApproach=%d", ssdApproach?1:0);
@@ -164,6 +164,8 @@ std::vector<cv::Point2f> calcStereoCorrespondences(
int totalIterations = 0; int totalIterations = 0;
int noSubPixel = 0; int noSubPixel = 0;
int added = 0; int added = 0;
int minDisparity = std::floor(minDisparityF);
int maxDisparity = std::floor(maxDisparityF);
for(unsigned int i=0; i<leftCorners.size(); ++i) for(unsigned int i=0; i<leftCorners.size(); ++i)
{ {
int oi=0; int oi=0;
@@ -316,7 +318,8 @@ std::vector<cv::Point2f> calcStereoCorrespondences(
cache.insert(std::make_pair(previousXc, previousVc)); cache.insert(std::make_pair(previousXc, previousVc));
} }
if(xc < leftCorners[i].x+float(d)-1.0f || xc > leftCorners[i].x+float(d)+1.0f) if(/*xc < leftCorners[i].x+float(d)-1.0f || xc > leftCorners[i].x+float(d)+1.0f ||*/
float(leftCorners[i].x - xc) <= minDisparityF)
{ {
reject = true; reject = true;
break; break;

View File

@@ -111,7 +111,14 @@ private:
{ {
_placeHolder = new QGraphicsRectItem (this); _placeHolder = new QGraphicsRectItem (this);
_placeHolder->setVisible(false); _placeHolder->setVisible(false);
_placeHolder->setBrush(QBrush(QColor ( 0, 0, 0, 170 ))); // Black transparent background if(qGray(pen().color().rgb() > 255/2))
{
_placeHolder->setBrush(QBrush(QColor ( 0,0,0, 170 )));
}
else
{
_placeHolder->setBrush(QBrush(QColor ( 255, 255, 255, 170 )));
}
QGraphicsTextItem * text = new QGraphicsTextItem(_placeHolder); QGraphicsTextItem * text = new QGraphicsTextItem(_placeHolder);
text->setDefaultTextColor(this->pen().color().rgb()); text->setDefaultTextColor(this->pen().color().rgb());
text->setPlainText(_text); text->setPlainText(_text);

View File

@@ -67,7 +67,14 @@ void KeypointItem::showDescription()
{ {
_placeHolder = new QGraphicsRectItem (this); _placeHolder = new QGraphicsRectItem (this);
_placeHolder->setVisible(false); _placeHolder->setVisible(false);
_placeHolder->setBrush(QBrush(QColor ( 0, 0, 0, 170 ))); // Black transparent background if(qGray(pen().color().rgb() > 255/2))
{
_placeHolder->setBrush(QBrush(QColor ( 0,0,0, 170 )));
}
else
{
_placeHolder->setBrush(QBrush(QColor ( 255, 255, 255, 170 )));
}
QGraphicsTextItem * text = new QGraphicsTextItem(_placeHolder); QGraphicsTextItem * text = new QGraphicsTextItem(_placeHolder);
text->setDefaultTextColor(this->pen().color().rgb()); text->setDefaultTextColor(this->pen().color().rgb());
if(_depth <= 0) if(_depth <= 0)

View File

@@ -63,25 +63,16 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-319</y> <y>0</y>
<width>678</width> <width>673</width>
<height>2739</height> <height>2749</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>
@@ -95,7 +86,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>7</number> <number>23</number>
</property> </property>
<widget class="QWidget" name="page_22"> <widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1"> <layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
@@ -4709,16 +4700,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>
@@ -12887,16 +12869,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
</property> </property>
<widget class="QWidget" name="page_54"> <widget class="QWidget" name="page_54">
<layout class="QVBoxLayout" name="verticalLayout_85"> <layout class="QVBoxLayout" name="verticalLayout_85">
<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>
@@ -13036,16 +13009,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</widget> </widget>
<widget class="QWidget" name="page_55"> <widget class="QWidget" name="page_55">
<layout class="QVBoxLayout" name="verticalLayout_86"> <layout class="QVBoxLayout" name="verticalLayout_86">
<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>
@@ -13203,16 +13167,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
<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>
@@ -13292,16 +13247,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
<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>
@@ -13413,16 +13359,7 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
<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>
@@ -14715,22 +14652,6 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QSpinBox" name="stereo_minDisparity">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QLabel" name="label_206"> <widget class="QLabel" name="label_206">
<property name="text"> <property name="text">
@@ -14883,22 +14804,6 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0">
<widget class="QSpinBox" name="stereo_maxDisparity">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item row="7" column="0"> <item row="7" column="0">
<widget class="QCheckBox" name="stereo_opticalFlow"> <widget class="QCheckBox" name="stereo_opticalFlow">
<property name="text"> <property name="text">
@@ -14906,6 +14811,12 @@ Lower the ratio -&gt; higher the precision. 0 means disabled, matching the neare
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QDoubleSpinBox" name="stereo_minDisparity"/>
</item>
<item row="6" column="0">
<widget class="QDoubleSpinBox" name="stereo_maxDisparity"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>