Vis: fixed assert when doing bundle adjustment with SignatureTo having no 3d words

This commit is contained in:
matlabbe
2019-01-16 19:29:57 -05:00
parent 479fb6cbca
commit d45b77c0b7

View File

@@ -1565,9 +1565,12 @@ Transform RegistrationVis::computeTransformationImpl(
}
if(toSignature.getWords().size() && cameraModelTo.isValidForProjection())
{
float depthTo = util3d::transformPoint(toSignature.getWords3().find(wordId)->second, invLocalTransformTo).z;
float depthTo = 0.0f;
if(toSignature.getWords3().find(wordId) != toSignature.getWords3().end())
{
depthTo = util3d::transformPoint(toSignature.getWords3().find(wordId)->second, invLocalTransformTo).z;
}
const cv::KeyPoint & kpt = toSignature.getWords().find(wordId)->second;
UASSERT(toSignature.getWords3().find(wordId) != toSignature.getWords3().end());
ptMap.insert(std::make_pair(2,FeatureBA(kpt, depthTo)));
}