Merge pull request #69 from andre-nguyen/master
fix relocalization segfault
This commit is contained in:
@@ -240,6 +240,11 @@ FrameHandlerMono::UpdateResult FrameHandlerMono::relocalizeFrame(
|
|||||||
FramePtr ref_keyframe)
|
FramePtr ref_keyframe)
|
||||||
{
|
{
|
||||||
SVO_WARN_STREAM_THROTTLE(1.0, "Relocalizing frame");
|
SVO_WARN_STREAM_THROTTLE(1.0, "Relocalizing frame");
|
||||||
|
if(ref_keyframe == nullptr)
|
||||||
|
{
|
||||||
|
SVO_INFO_STREAM("Relocalization successful.");
|
||||||
|
return RESULT_FAILURE;
|
||||||
|
}
|
||||||
SparseImgAlign img_align(Config::kltMaxLevel(), Config::kltMinLevel(),
|
SparseImgAlign img_align(Config::kltMaxLevel(), Config::kltMinLevel(),
|
||||||
30, SparseImgAlign::GaussNewton, false, false);
|
30, SparseImgAlign::GaussNewton, false, false);
|
||||||
size_t img_align_n_tracked = img_align.run(ref_keyframe, new_frame_);
|
size_t img_align_n_tracked = img_align.run(ref_keyframe, new_frame_);
|
||||||
|
|||||||
@@ -130,6 +130,11 @@ FramePtr Map::getClosestKeyframe(const FramePtr& frame) const
|
|||||||
{
|
{
|
||||||
list< pair<FramePtr,double> > close_kfs;
|
list< pair<FramePtr,double> > close_kfs;
|
||||||
getCloseKeyframes(frame, close_kfs);
|
getCloseKeyframes(frame, close_kfs);
|
||||||
|
if(close_kfs.empty())
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Sort KFs with overlap according to their closeness
|
// Sort KFs with overlap according to their closeness
|
||||||
close_kfs.sort(boost::bind(&std::pair<FramePtr, double>::second, _1) <
|
close_kfs.sort(boost::bind(&std::pair<FramePtr, double>::second, _1) <
|
||||||
|
|||||||
Reference in New Issue
Block a user