对完成初始配对的std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> 进行可视化

1. 数据填充

std::vector::Ptr> pure_static_landmarks_underk;

std::vector::Ptr> pure_static_landmarks_k;

vector> matched_indices;

对数据pure_static_landmarks_underk和pure_static_landmarks_k进行填充

对数据matched_indices进行填充

2. 可视化(非函数,直接用)

                pcl::visualization::PCLVisualizer viewer("Matched Point Clouds Visualization");
                for (size_t i = 0; i < matched_indices.size(); ++i) {
                    int idx_k = matched_indices[i][0];
                    int idx_underk = matched_indices[i][1];
                    // 确保索引有效
                    if (idx_k >= pure_static_landmarks_k.size() || idx_underk >= pure_static_landmarks_underk.size()) {
                        continue;
                    }

                    // 为这对点云生成唯一的ID
                    std::string id_k = "cloud_k_" + std::to_string(i);
                    std::string id_underk = "cloud_underk_" + std::to_string(i);

                    // 添加点云到可视化器
                    viewer.addPointCloud(pure_static_landmarks_k[idx_k], id_k);
                    viewer.addPointCloud(pure_static_landmarks_underk[idx_underk], id_underk);

                    // 可以选择设置点大小
                    viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, id_k);
                    viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, id_underk);
                }
                // 循环直到视窗关闭
                while (!viewer.wasStopped()) {
                    viewer.spinOnce();
                }

对完成初始配对的std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> 进行可视化_第1张图片

你可能感兴趣的:(PCL,PointXYZRGB)