RegistraitonVis: generate always 3D keypoints if possible

This commit is contained in:
matlabbe
2016-02-29 16:41:37 -05:00
parent 6d06b66496
commit e6e9c61c38
3 changed files with 4 additions and 5 deletions

View File

@@ -228,7 +228,7 @@ Transform OdometryF2M::computeTransform(
std::multimap<int, cv::Mat> mapDescriptors = map_->getWordsDescriptors();
Transform t = this->getPose()*output;
UASSERT(mapPoints.size() == mapDescriptors.size());
UASSERT(lastFrame_->getWordsDescriptors().size() == lastFrame_->getWords3().size());
UASSERT_MSG(lastFrame_->getWordsDescriptors().size() == lastFrame_->getWords3().size(), uFormat("%d vs %d", lastFrame_->getWordsDescriptors().size(), lastFrame_->getWords3().size()).c_str());
std::list<int> newIds = uUniqueKeys(lastFrame_->getWordsDescriptors());
for(std::list<int>::iterator iter=newIds.begin(); iter!=newIds.end(); ++iter)
{

View File

@@ -518,9 +518,7 @@ Transform RegistrationVis::computeTransformationImpl(
{
kptsFrom3D = uValues(fromSignature.getWords3());
}
if((_estimationType == 0 || (_estimationType == 1 && !varianceFromInliersCount()) || !_forwardEstimateOnly) &&
toSignature.getWords3().empty() &&
!toSignature.sensorData().imageRaw().empty())
if(toSignature.getWords3().empty())
{
kptsTo3D = detector->generateKeypoints3D(toSignature.sensorData(), kptsTo);
}

View File

@@ -2109,7 +2109,8 @@ bool Rtabmap::process(
}
else if(_memory->isIncremental() && // FIXME: not tested in localization mode, so do it only in mapping mode
_optimizationMaxLinearError > 0.0f &&
loopClosureLinksAdded.size())
loopClosureLinksAdded.size() &&
optimizationIterations > 0)
{
const Link * maxLinearLink = 0;
for(std::multimap<int, Link>::iterator iter=constraints.begin(); iter!=constraints.end(); ++iter)