liangheming / M_FASTLIVO

FAST-LIVO easy to read, esay to understand
MIT License
50 stars 7 forks source link

image_process.cpp中有一处小问题会导致运行越界 #2

Open SharkPeppero opened 2 months ago

SharkPeppero commented 2 months ago

ImageProcessor::ImageProcessor(Config &config, std::shared_ptr kf) : m_kf(kf), m_config(config) { m_camera = std::make_shared(m_config.cam_width, m_config.cam_height, m_config.cam_fx, m_config.cam_fy, m_config.cam_cx, m_config.cam_cy, m_config.cam_d[0], m_config.cam_d[1], m_config.cam_d[2], m_config.cam_d[3], m_config.cam_d[4]); m_frame_count = 0; m_grid_width = static_cast(std::ceil(m_camera->width() / static_cast(m_config.grid_size))); m_grid_height = static_cast(std::ceil(m_camera->height() / static_cast(m_config.grid_size))); m_grid_num = m_grid_height m_grid_height; m_patch_size = m_config.half_patch_size 2 + 1; cache_pixel_depth.resize(m_camera->width() * m_camera->height(), 0.0);

cache_flag.resize(m_grid_num, false);
cache_points.resize(m_grid_num, nullptr);
cache_score.resize(m_grid_num, 0.0);
cache_grid_depth.resize(m_grid_num, 10000.0);
cache_points_to_add.resize(m_grid_num, V3D::Zero());
m_cloud_filter.setLeafSize(m_config.selector_scan_resolution, m_config.selector_scan_resolution, m_config.selector_scan_resolution);

}

作者你好,你的image_process.cpp中初始化m_grid_num时,m_grid_num = m_grid_height m_grid_height; 是不是应该是widthheight,不然后续好像有越界问题

liangheming commented 2 months ago

有实际遇到这个越界问题么?这个是切分的网格大小,不是图像大小。

SharkPeppero commented 2 months ago

我把你的代码订阅部分修改成ROS2的版本,然后跑hku2这个数据包的时候,在开始后的3秒程序就崩溃,我用gdb调试显示在image_process.cpp select_reference函数这一块有越界的问题,然后我修改了这个grid_nums的大小,就可以跑了。 切分网格的操作,我看您上文已经对宽高进行划分了,应该是要进行宽高相乘吧

liangheming commented 2 months ago

可否帮忙定位一下越界代码的行数?稍后我看下,非常感谢!