Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GreedyProjectionTriangulation class resulting grid normals are reversed #4847

Open
echo-ee opened this issue Jul 12, 2021 · 0 comments
Open
Labels
kind: bug Type of issue status: triage Labels incomplete

Comments

@echo-ee
Copy link

echo-ee commented Jul 12, 2021

When I used this class to generate grids, I found that some grids were found to be opposite, resulting in the display effect of exported STL file being different from that of PCL visual window. I would like to ask if there is any method to repair the normal line

And I found that when using the same method of normal estimation, neither Poisson nor moving cube will have the opposite situation of normal, only greedy projection method will

PCL visualization
image

STL file display
image

` std::cout << "Using mls method estimation..." << endl;;
pcl::PointCloudpcl::PointNormal mls_points1;
pcl::PointCloudpcl::PointNormal::Ptr mls_points(new pcl::PointCloudpcl::PointNormal());
pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;
cout << "MLS前点云数:" << cloudTranslated->points.size() << endl;
mls.setComputeNormals(true);
mls.setInputCloud(cloudTranslated);

    mls.setPolynomialOrder(true);
    // mls.setDilationIterations(10);
     //mls.setDilationVoxelSize(0.5);
     //mls.setSqrGaussParam(2.0);
     //mls.setUpsamplingRadius(5);
    mls.setPolynomialOrder (3); 
     //mls.setPointDensity(30);
    mls.setSearchMethod(kdtree_for_points);
    mls.setSearchRadius(3);
    mls.process(*mls_points);

    pcl::PointCloud<pcl::PointXYZ>::Ptr temp(new pcl::PointCloud<pcl::PointXYZ>());

    for (int i = 0; i < mls_points->points.size(); i++) {

        pcl::PointXYZ pt;
        pt.x = cloud->points[i].x;
        pt.y = cloud->points[i].y;
        pt.z = cloud->points[i].z;

        temp->points.push_back(pt);
    }

    cout << "MLS后点云数目 :" << mls_points->points.size() << endl;
    cout << "temp :" << temp->points.size() << endl;
    pcl::concatenateFields(*temp, *mls_points, *cloud_with_normals);
    std::cout << "移动最小二乘法线估计完成" << std::endl;
    cout << "最小二乘cloud_with_normals:" << cloud_with_normals->points.size() << endl;
   
    pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3;
    gp3.setSearchRadius(search_radius);//It was 0.025
    gp3.setMu(setMU); //It was 2.5
    gp3.setMaximumNearestNeighbors(maxiNearestNeighbors);    //It was 100
    gp3.setMaximumSurfaceAngle(M_PI/2); // 45 degrees    //it was 4
    gp3.setMinimumAngle(M_PI/4); // 10 degrees //It was 18
    gp3.setMaximumAngle(M_PI/1.2); // 120 degrees        //it was 1.5
    gp3.setNormalConsistency(false); //It was false
    gp3.setConsistentVertexOrdering(true);
    gp3.setInputCloud(cloud_with_normals);
    gp3.setSearchMethod(kdtree_for_normals);
    gp3.reconstruct(triangles);
std::string output_dir1 = "D://Program Files//CloudPoint//model_converted_pcd//dragon_mesh.stl";
		pcl::io::savePolygonFileSTL(output_dir1.c_str(), triangles, true);

`

@echo-ee echo-ee added kind: bug Type of issue status: triage Labels incomplete labels Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Type of issue status: triage Labels incomplete
Projects
None yet
Development

No branches or pull requests

1 participant