Thank you very much for open-sourcing your work. I encountered some issues while trying to reproduce it. Without modifying any part of the code, the system crashes at the beginning because there are no GS points. After repeated debugging, I found a few problems:
In sensor_.model.backProject(pixel_f, &ray_dir_C);, it seems that the camera intrinsics used in this function are somehow modified. As a last resort, I tried hard-coding them with constants for debugging, but it still didn’t work.
if (map_.template pointToVoxel<se::Safe::On>(ray_pos_W, voxel_coord)) — this condition is never satisfied. Moreover, the input point coordinate ray_pos_W has strange values: [ -6.2095e+07, -5.93713e+12, 1.75429e+13 ].
I suspect the root cause might be that voxel_keys.size is 0, which results in no GS points being generated.
Could you please advise me on how to fix these issues so that the program can run properly?
`
template<typename MapT, typename SensorT>
std::vectorse::OctantBase* RaycastCarver<MapT, SensorT>::operator()()
{
TICK("fetch-frustum")
// Fetch the currently allocated Blocks in the sensor frustum.
// i.e. the fetched blocks might contain blocks outside the current valid sensor range.
std::vectorse::OctantBase* fetched_block_ptrs = se::fetcher::frustum(map_, sensor_, T_WS_);
TOCK("fetch-frustum")
TICK("create-list")
se::OctantBase* root_ptr = octree_.getRoot();
const int num_steps = ceil(config_.band / (2 * map_.getRes()));
const Eigen::Vector3f t_WS = T_WS_.topRightCorner<3, 1>();
#pragma omp declare reduction(merge : std::set se::key_t : omp_out.insert(omp_in.begin(), omp_in.end()))
std::setse::key_t voxel_key_set;
// #pragma omp parallel for reduction(merge : voxel_key_set)
for (int x = 0; x < depth_img_.width(); ++x) {
for (int y = 0; y < depth_img_.height(); ++y) {
const Eigen::Vector2i pixel(x, y);
const float depth_value = depth_img_(pixel.x(), pixel.y());
// Only consider depth values inside the valid sensor range
if (depth_value < sensor_.near_plane || depth_value > (sensor_.far_plane + config_.band * 0.5f)) {
continue;
}
Eigen::Vector3f ray_dir_C;
const Eigen::Vector2f pixel_f = pixel.cast<float>();
// std::cout<<pixel_f<<std::endl;
sensor_.model.backProject(pixel_f, &ray_dir_C);
std::cout<<ray_dir_C<<std::endl;
std::cout<<((depth_value * ray_dir_C).homogeneous()).template head<3>()<<std::endl;
const Eigen::Vector3f point_W = (T_WS_ * (depth_value * ray_dir_C).homogeneous()).template head<3>();
const Eigen::Vector3f reverse_ray_dir_W = (t_WS - point_W).normalized();
const Eigen::Vector3f ray_origin_W = point_W - (config_.band * 0.5f) * reverse_ray_dir_W;
const Eigen::Vector3f step = (reverse_ray_dir_W * config_.band) / num_steps;
Eigen::Vector3f ray_pos_W = ray_origin_W;
for (int i = 0; i < num_steps; i++) {
Eigen::Vector3i voxel_coord;
if (map_.template pointToVoxel<se::Safe::On>(ray_pos_W, voxel_coord)) {
const se::OctantBase* octant_ptr = se::fetcher::block<typename MapT::OctreeType>(voxel_coord, root_ptr);
if (octant_ptr == nullptr) {
se::key_t voxel_key;
se::keyops::encode_key(voxel_coord, octree_.max_block_scale, voxel_key);
voxel_key_set.insert(voxel_key);
}
}
ray_pos_W += step;
}
}
}
// Allocate the Blocks and get pointers only to the newly-allocated Blocks.
std::vector<key_t> voxel_keys(voxel_key_set.begin(), voxel_key_set.end());
TOCK("create-list")
TICK("allocate-list")
std::vector<se::OctantBase*> allocated_block_ptrs = se::allocator::blocks(voxel_keys, octree_, octree_.getRoot(), true);
TOCK("allocate-list")
std::cout<<voxel_keys.size()<<std::endl;
TICK("combine-vectors")
// Merge the previously-allocated and newly-allocated Block pointers.
allocated_block_ptrs.reserve(allocated_block_ptrs.size() + fetched_block_ptrs.size());
allocated_block_ptrs.insert(allocated_block_ptrs.end(), fetched_block_ptrs.begin(), fetched_block_ptrs.end());
TOCK("combine-vectors")
return allocated_block_ptrs;
}`
Thank you very much for open-sourcing your work. I encountered some issues while trying to reproduce it. Without modifying any part of the code, the system crashes at the beginning because there are no GS points. After repeated debugging, I found a few problems:
In
sensor_.model.backProject(pixel_f, &ray_dir_C);,it seems that the camera intrinsics used in this function are somehow modified. As a last resort, I tried hard-coding them with constants for debugging, but it still didn’t work.if (map_.template pointToVoxel<se::Safe::On>(ray_pos_W, voxel_coord))— this condition is never satisfied. Moreover, the input point coordinate ray_pos_W has strange values: [ -6.2095e+07, -5.93713e+12, 1.75429e+13 ].I suspect the root cause might be that voxel_keys.size is 0, which results in no GS points being generated.
Could you please advise me on how to fix these issues so that the program can run properly?
`
template<typename MapT, typename SensorT>
std::vectorse::OctantBase* RaycastCarver<MapT, SensorT>::operator()()
{
TICK("fetch-frustum")
// Fetch the currently allocated Blocks in the sensor frustum.
// i.e. the fetched blocks might contain blocks outside the current valid sensor range.
std::vectorse::OctantBase* fetched_block_ptrs = se::fetcher::frustum(map_, sensor_, T_WS_);
TOCK("fetch-frustum")
#pragma omp declare reduction(merge : std::set se::key_t : omp_out.insert(omp_in.begin(), omp_in.end()))
std::setse::key_t voxel_key_set;
// #pragma omp parallel for reduction(merge : voxel_key_set)
for (int x = 0; x < depth_img_.width(); ++x) {
for (int y = 0; y < depth_img_.height(); ++y) {
const Eigen::Vector2i pixel(x, y);
const float depth_value = depth_img_(pixel.x(), pixel.y());
// Only consider depth values inside the valid sensor range
if (depth_value < sensor_.near_plane || depth_value > (sensor_.far_plane + config_.band * 0.5f)) {
continue;
}
}`