PointCloudLibrary / pcl

Point Cloud Library (PCL)

Home Page:https://pointclouds.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[IntensityGradientEstimation] User Error 1001: argument to num_threads clause must be positive

GX8535 opened this issue · comments

Problem: I just open OpenMP in the Property Page ,but
User Error 1001: argument to num_threads clause must be positive .

Environment:
Operating system Windows 64 bits
PCL 1.14

Code:
#include
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>
#include <pcl/features/intensity_gradient.h>

using namespace pcl;
using namespace std;

int main()
{

string test_pcd_path = "E:/vs_project/wallb_Intensity.pcd";
pcl::PointCloud<pcl::PointXYZI>::Ptr cloud(new PointCloud<pcl::PointXYZI>);
pcl::io::loadPCDFile(test_pcd_path, *cloud);


pcl::NormalEstimation<pcl::PointXYZI, pcl::Normal> ne;
ne.setInputCloud(cloud);
pcl::search::KdTree<pcl::PointXYZI>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZI>);
ne.setSearchMethod(tree);
ne.setKSearch(25);
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
ne.compute(*normals);


pcl::IntensityGradientEstimation<pcl::PointXYZI, pcl::Normal, pcl::IntensityGradient, pcl::common::IntensityFieldAccessor<pcl::PointXYZI>> gradient_estimation;
gradient_estimation.setInputCloud(cloud);
gradient_estimation.setInputNormals(normals);
gradient_estimation.setKSearch(25);
pcl::PointCloud<pcl::IntensityGradient>::Ptr gradients(new pcl::PointCloud<pcl::IntensityGradient>);
gradient_estimation.compute(*gradients);

pcl::PointCloud<pcl::PointXYZI>::Ptr cloud_grad(new PointCloud<pcl::PointXYZI>);
pcl::copyPointCloud(*cloud,*cloud_grad);

for (int i = 0; i < gradients->size(); ++i)
{
	cloud_grad->points[i].intensity = sqrt(pow((*gradients)[i].gradient[0],2)+ 
		                                   pow((*gradients)[i].gradient[1],2)+
		                                   pow((*gradients)[i].gradient[2],2));
}

pcl::io::savePCDFileBinaryCompressed("E:/vs_project/wallb_gradient_25.pcd", *cloud_grad);
cout << "结束" << endl;

}

@GX8535 Try adding gradient_estimation.setNumberOfThreads(4); to use 4 threads (or a different number)

Thanks,it is right.