koide3 / fast_gicp

A collection of GICP-based fast point cloud registration algorithms
BSD 3-Clause "New" or "Revised" License
1.29k stars 319 forks source link

Too large memory required? #96

Open whu-lyh opened 2 years ago

whu-lyh commented 2 years ago

Hi, koide, thanks for your works. I tried your registration method, specifically fast voxel boosted gicp, on a more dense point clouds. I found that the memory required is too big for correspondence searching, as the following code shows

void FastVGICP<PointSource, PointTarget>::update_correspondences(const Eigen::Isometry3d& trans) {
        voxel_correspondences_.clear();
        auto offsets = neighbor_offsets(search_method_);
        unsigned int scaled_pts_num = input_->size() * offsets.size();
        std::vector<std::vector<std::pair<int, GaussianVoxel::Ptr>>> corrs(num_threads_);
        for (auto& c : corrs) {
            c.reserve(scaled_pts_num / num_threads_);
        }
                ...
        voxel_correspondences_.reserve(scaled_pts_num);
                ...
}

or more details at https://github.com/SMRT-AIST/fast_gicp/blob/2e9fd0b342b02b65e92142e9971f2e342f40a20a/include/fast_gicp/gicp/impl/fast_vgicp_impl.hpp#L96

and at https://github.com/SMRT-AIST/fast_gicp/blob/2e9fd0b342b02b65e92142e9971f2e342f40a20a/include/fast_gicp/gicp/impl/fast_vgicp_impl.hpp#L102

My question is if there are large amount of pts inside a voxel, the memory cost is too large for a simple 7nn neighbor. Although i know this operation is used for fast query neighborhood pts, but memory cost is still quite large? My laptop doesn't have enough memory for such a large memory cost operation.