You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying pcl::gpu::NormalEstimation() and found that the normal vectors act weird (point horizontally to the surface) under certain range of radius. I also ran pcl::NormalEstimationOMP() with the same searching radius and it went well.
Context
Generate normal surface using pcl::gpu::NormalEstimation().
Current Behavior
Part of the normal vectors point horizontally to the surface when running pcl::gpu::NormalEstimation(), while pcl::NormalEstimationOMP() works well with the same searching radius. Pictures are shown in the following section.
#defineSEARCH_RADIUS (1)
inttest_gpu(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr cloud_normals)
{
printf("Test with GPU\n");
// Getinfo();typedef pcl::gpu::DeviceArray<pcl::PointXYZ> g_PointXYZ;
typedef pcl::gpu::DeviceArray<pcl::Normal> g_Normal;
g_PointXYZ dev_cloud(cloud->size());
dev_cloud.upload(cloud->points.data(), cloud->size());
printf("Normal Estimation...\n");
pcl::gpu::NormalEstimation gne;
gne.setInputCloud(dev_cloud);
gne.setRadiusSearch(SEARCH_RADIUS * 100, 500); // setRadiusSearch(float radius, int max_results); What is max_results??
gne.setViewPoint(-5, 5, 5);
pcl::gpu::NormalEstimation::Normals dev_normals;
gne.compute(dev_normals);
std::vector<pcl::PointXYZ> normals;
dev_normals.download(normals);
//pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);
cloud_normals->resize(normals.size());
for (size_t i = 0; i < normals.size(); ++i)
{
cloud_normals->points[i].normal_x = normals[i].x;
cloud_normals->points[i].normal_y = normals[i].y;
cloud_normals->points[i].normal_z = normals[i].z;
cloud_normals->points[i].curvature = 0; // Curvature is not estimated in the GPU-based method
}
printf("Cloud Normal Size: %lu data points.\n", cloud_normals->size());
return0;
}
Snippet 2 - pcl::NormalEstimationOOP()
inttest_pcl(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr cloud_normals)
{
printf("Test with CPU\n");
// ==============================// Normal Estimation// ==============================
pcl::NormalEstimationOMP<pcl::PointXYZ, pcl::Normal> ne;
ne.setInputCloud(cloud);
// KdTree to search K nearest
pcl::search::KdTree<pcl::PointXYZ>::Ptrtree (new pcl::search::KdTree<pcl::PointXYZ> ());
ne.setSearchMethod (tree);
// parameters
ne.setRadiusSearch(SEARCH_RADIUS); // Consider all the points within the radius//ne.setKSearch(K_NEIGHBOR); // mutex with setRadiusSearch
ne.setViewPoint(-5, 5, 5);
// place to store normal
ne.compute(*cloud_normals);
printf("Cloud Normal Size: %lu data points.\n", cloud_normals->size());
return EXIT_SUCCESS;
}
Your Environment (please complete the following information):
OS: Ubuntu 20.04
Compiler: GCC 9.4.0
PCL Version: 1.13.1
CUDA Version: 12.1
The text was updated successfully, but these errors were encountered:
@yu-sheng-vincent Sorry for the late response. I tried to reproduce the problem, but the results I get seem correct. Could you share your whole code? Especially how you save the cloud normals to a file? You use meshlab to visualize the cloud and normals, is that correct?
Describe the bug
I was trying pcl::gpu::NormalEstimation() and found that the normal vectors act weird (point horizontally to the surface) under certain range of radius. I also ran pcl::NormalEstimationOMP() with the same searching radius and it went well.
Context
Generate normal surface using pcl::gpu::NormalEstimation().
Current Behavior
Part of the normal vectors point horizontally to the surface when running pcl::gpu::NormalEstimation(), while pcl::NormalEstimationOMP() works well with the same searching radius. Pictures are shown in the following section.
To Reproduce
To showcase the issue, I use this cutting blade object from Artec3D:
https://www.artec3d.com/3d-models/metal-cutting-blade
Screenshots/Code snippets
Snippet 1 - Using pcl::gpu::NormalEstimation()
Snippet 2 - pcl::NormalEstimationOOP()
Your Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: