points.size()>0.20*nr\u点) { //从剩余云分割最大的平面组件 seg.setInputCloud(云过滤); 分段(*内联线,*系数); 如果(inliers->index.size()==0) { std::cerr,pointers,while-loop,save,point-cloud-library,Pointers,While Loop,Save,Point Cloud Library" /> points.size()>0.20*nr\u点) { //从剩余云分割最大的平面组件 seg.setInputCloud(云过滤); 分段(*内联线,*系数); 如果(inliers->index.size()==0) { std::cerr,pointers,while-loop,save,point-cloud-library,Pointers,While Loop,Save,Point Cloud Library" />

Pointers 点云库和While循环 我是C++和PCL的新手。我希望在while循环中保存指针的值,并希望显示保存的值。这是我的部分代码。请指导每次循环运行时如何在数组中保存“系数->值[0]、系数->值[1]、系数->值[2]、系数->值[3]”的值 // While 20% of the original cloud is still there while (cloud_filtered->points.size () > 0.20 * nr_points) { // Segment the largest planar component from the remaining cloud seg.setInputCloud (cloud_filtered); seg.segment (*inliers, *coefficients); if (inliers->indices.size () == 0) { std::cerr << "Could not estimate a planar model for the given dataset." << std::endl; break; } std::cerr << "Model coefficients: " << coefficients->values[0] << " " << coefficients->values[1] << " " << coefficients->values[2] << " " << coefficients->values[3] << std::endl; } //当20%的原始云仍然存在时 而(云过滤->points.size()>0.20*nr\u点) { //从剩余云分割最大的平面组件 seg.setInputCloud(云过滤); 分段(*内联线,*系数); 如果(inliers->index.size()==0) { std::cerr

Pointers 点云库和While循环 我是C++和PCL的新手。我希望在while循环中保存指针的值,并希望显示保存的值。这是我的部分代码。请指导每次循环运行时如何在数组中保存“系数->值[0]、系数->值[1]、系数->值[2]、系数->值[3]”的值 // While 20% of the original cloud is still there while (cloud_filtered->points.size () > 0.20 * nr_points) { // Segment the largest planar component from the remaining cloud seg.setInputCloud (cloud_filtered); seg.segment (*inliers, *coefficients); if (inliers->indices.size () == 0) { std::cerr << "Could not estimate a planar model for the given dataset." << std::endl; break; } std::cerr << "Model coefficients: " << coefficients->values[0] << " " << coefficients->values[1] << " " << coefficients->values[2] << " " << coefficients->values[3] << std::endl; } //当20%的原始云仍然存在时 而(云过滤->points.size()>0.20*nr\u点) { //从剩余云分割最大的平面组件 seg.setInputCloud(云过滤); 分段(*内联线,*系数); 如果(inliers->index.size()==0) { std::cerr,pointers,while-loop,save,point-cloud-library,Pointers,While Loop,Save,Point Cloud Library,我假设您正在遵循示例代码,因为您在问题中添加的代码片段几乎相同。如果是这种情况,那么您可以在while循环之前声明一个std::vector,并将系数推到类似的位置 std::vector<pcl::ModelCoefficients> coeffs; while(...){ ... coeffs.push_back(*coefficients); } std::向量系数; 而(…){ ... 后推系数(*系数); } 还要检查文档中的pcl::ModelCoef

我假设您正在遵循示例代码,因为您在问题中添加的代码片段几乎相同。如果是这种情况,那么您可以在while循环之前声明一个
std::vector
,并将系数推到类似的位置

std::vector<pcl::ModelCoefficients> coeffs;
while(...){
    ...
    coeffs.push_back(*coefficients);
}
std::向量系数;
而(…){
...
后推系数(*系数);
}

还要检查文档中的
pcl::ModelCoefficients
,它只不过是一个头和一个浮点向量。请注意,将
coefs
定义为共享指针向量并将指针推送到系数在这种情况下将不起作用,因为先前推送的系数将被
seg.segment覆盖(*inlines,*coverties);

我假设您正在遵循示例代码,因为您在问题中添加的代码片段几乎相同。如果是这种情况,那么您可以在while循环之前声明一个
std::vector
,并将系数推到类似的位置

std::vector<pcl::ModelCoefficients> coeffs;
while(...){
    ...
    coeffs.push_back(*coefficients);
}
std::向量系数;
而(…){
...
后推系数(*系数);
}

还要检查文档中的
pcl::ModelCoefficients
,它只不过是一个头和一个浮点向量。请注意,将
coefs
定义为共享指针向量并将指针推送到系数在这种情况下将不起作用,因为先前推送的系数将被
seg.segment覆盖(*内联,*系数);

非常感谢您的回复。我的问题是我想要所有系数,正如您所说的“以前推送的系数将被覆盖”。是否有任何方法可以将所有系数保存在某个变量中?他编写的内容不会覆盖,因为他使用ModelConferences对象而不是共享指针定义了向量。他正在解释为什么代码段中的指针“系数”需要取消引用“*”在push_内部,为了不覆盖过去的条目。非常感谢您的回复。我的问题是我想要所有的系数,正如您所说的“以前推送的系数将被覆盖”。是否有任何方法可以将所有系数保存在某个变量中?他编写的内容不会覆盖,因为他使用ModelConferences对象而不是共享指针定义了向量。他正在解释为什么代码段中的指针“系数”需要取消引用“*”为了不覆盖过去的条目,请在内部向后推。