在用八叉数进行遍历两组点云求重叠部分的时候报错

问题遇到的现象和发生背景

在用八叉数进行遍历两组点云求重叠部分的时候报错,好像是死循环

问题相关代码,请勿粘贴截图
#include <iostream>
#include<pcl/io/pcd_io.h>
#include<pcl/point_cloud.h>
#include<pcl/point_types.h>
#include<pcl/octree/octree.h>

using point = pcl::PointXYZ;
using cloud = pcl::PointCloud<point>;
//八叉数求重叠
void getOverlappedCloud (const pcl::PointCloud<pcl::PointXYZ>& cloud1, const pcl::PointCloud<pcl::PointXYZ>& cloud2, pcl::PointCloud<pcl::PointXYZ>& overlapped_cloud2)
{
    double radius = 3.0;
    pcl::octree::OctreePointCloudSearch<point> octree(radius);
    octree.setInputCloud(cloud1.makeShared());
    octree.addPointsFromInputCloud();

    //pcl::PointCloud<point> overlapped_2;
    for (size_t i = 0; i < cloud2.size(); ++i)
    {
        std::vector<int> indices;
        octree.voxelSearch(cloud2.points[i], indices);
        pcl::PointCloud<point> cloud_out;
        if (indices.size())
        {
            overlapped_cloud2.push_back(cloud2.points[i]);
        }

    }
}
int main()
{
    //auto start = std::clock();
    for(int i = 1; i < 636; i++)
    {
        pcl::PointCloud<point> cloud1, cloud2;
        cloud overlapped1, overlapped2, overlapped3;
        //导入点云
           pcl::io::loadPCDFile<point>("/home/zsk/dense_pointcloud/pcl_transfer_left_data/"+ std::to_string(i) +".pcd", cloud1);
        pcl::io::loadPCDFile<point>("/home/zsk/dense_pointcloud/pcl_transfer_right_data/"+ std::to_string(i) +".pcd", cloud2);
           //一对点云在对方的重叠部分
        getOverlappedCloud(cloud1, cloud2, overlapped2);
        getOverlappedCloud(cloud2, cloud1, overlapped1);
        //相加
        overlapped3 = overlapped1 + overlapped2; 
        //存储
        pcl::io::savePCDFile("/home/zsk/dense_pointcloud/pcl_transfer_data/"+ std::to_string(i) +".pcd", overlapped3);
    }

    return 0;

}

运行结果及报错内容

test1: /build/pcl-OilVEB/pcl-1.8.1+dfsg1/octree/include/pcl/octree/impl/octree_pointcloud.hpp:688: void pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::genOctreeKeyforPoint(const PointT&, pcl::octree::OctreeKey&) const [with PointT = pcl::PointXYZ; LeafContainerT = pcl::octree::OctreeContainerPointIndices; BranchContainerT = pcl::octree::OctreeContainerEmpty; OctreeT = pcl::octree::OctreeBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty>]: Assertion `key_arg.x <= this->max_key_.x' failed.
已放弃 (核心已转储)

我的解答思路和尝试过的方法

希望有好的想法,感谢

我想要达到的结果