solve segmentation fault error

This commit is contained in:
gfuse
2021-09-02 11:59:11 +02:00
parent f3fdd5c0b1
commit a3aebd038c
4 changed files with 5 additions and 5 deletions
+2 -4
View File
@@ -145,14 +145,12 @@ void Frame::removeKeyPoint(Feature* ftr)
bool Frame::isVisible(const Vector3d& xyz_w) const bool Frame::isVisible(const Vector3d& xyz_w) const
{ {
if(!id_)return false; if(!id_)return false;
std::cerr<<"148is\t"; usleep(1000);
SE3 tem=this->se3(); SE3 tem=this->se3();
std::cerr<<"150is\t"; assert(!xyz_w.hasNaN());
Vector3d xyz_f = tem*xyz_w; Vector3d xyz_f = tem*xyz_w;
std::cerr<<"152is\t";
if(xyz_f.z() < 0.0) if(xyz_f.z() < 0.0)
return false; // point is behind the camera return false; // point is behind the camera
std::cerr<<"153is\t";
Vector2d px = f2c(xyz_f); Vector2d px = f2c(xyz_f);
if(px[0] >= 0.0 && px[1] >= 0.0 && px[0] < cam_->width() && px[1] < cam_->height()) if(px[0] >= 0.0 && px[1] >= 0.0 && px[0] < cam_->width() && px[1] < cam_->height())
return true; return true;
+1 -1
View File
@@ -168,7 +168,7 @@ FrameHandlerBase::UpdateResult FrameHandlerMono::processFrame()
new_frame_->Cov_ = init_f.first; new_frame_->Cov_ = init_f.first;
// sparse image align // sparse image align
SparseImgAlignGpu img_align(Config::kltMaxLevel(), Config::kltMinLevel(),30, SparseImgAlignGpu::GaussNewton, false,gpu_fast_); SparseImgAlignGpu img_align(Config::kltMaxLevel(), Config::kltMinLevel(),30, SparseImgAlignGpu::GaussNewton, false,gpu_fast_);
img_align.run(last_frame_, new_frame_); if(!img_align.run(last_frame_, new_frame_))new_frame_->T_f_w_=init_f.second;
reprojector_.reprojectMap2(new_frame_, last_frame_,overlap_kfs_); reprojector_.reprojectMap2(new_frame_, last_frame_,overlap_kfs_);
//assert (false); //assert (false);
int n_point=0; int n_point=0;
+1
View File
@@ -120,6 +120,7 @@ void Map::getCloseKeyframes(
{ {
if(keypoint == nullptr) if(keypoint == nullptr)
continue; continue;
if(keypoint->point==NULL)continue;
if(frame->isVisible(keypoint->point->pos_)) if(frame->isVisible(keypoint->point->pos_))
{ {
close_kfs.push_back( close_kfs.push_back(
+1
View File
@@ -124,6 +124,7 @@ namespace vio {
FramePtr frame, FramePtr frame,
FramePtr last_frame, FramePtr last_frame,
std::vector<std::pair<FramePtr, std::size_t> > &overlap_kfs) { std::vector<std::pair<FramePtr, std::size_t> > &overlap_kfs) {
if(frame->id_<1)return;
resetGrid(); resetGrid();
cv::Mat descriptors_cur; cv::Mat descriptors_cur;
std::vector<cv::KeyPoint> keypoints_cur; std::vector<cv::KeyPoint> keypoints_cur;