slambook2
slambook2 copied to clipboard
ch13 运行时提示 "Segmentation fault (core dumpted)"。
在运行时提示错误"Segmentation fault (core dumpted)"
经过一行行输出,发现问题出现在"visual_odometry.cpp"中:bool VisualOdometry::Init()
中的dataset_=Dataset::Ptr(new Dataset(Config::Get<std::string>("dataset_dir")));
不确定和 issue #18 是否相同。
但下面提供的解决方法能够解决:
https://blog.csdn.net/sinat_39720504/article/details/102481421
即,将Config::SetParameterFile
函数中
config_->file_ = cv::FileStorage(filename.c_str(), cv::FileStorage::READ);
修改为
static cv::FileStorage file1( filename.c_str(), cv::FileStorage::READ ); config_->file_ = file1;
c++水平不高,也搞不清楚原理。放到这里希望对其他人有所帮助。
That works for me, many thx!
I encountered the similar question "terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.2.0) ../modules/core/src/persistence.cpp:1730: error: (-215:Assertion failed) blockIdx < fs_data_ptrs.size() in function 'getNodePtr'". This solution works as well.