granis
granis

Reputation: 21

Why does PCL's Poisson reconstruction return the weird result?

I want to load a ply file like bunny and then do poisson reconstruction. And I use the following code to do it:

#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/point_representation.h>
#include <pcl/io/pcd_io.h>
#include <iostream>
#include <pcl/io/obj_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/surface/poisson.h>
#include <pcl/features/normal_3d_omp.h>
#include <pcl/features/normal_3d.h>
#include <pcl/visualization/pcl_visualizer.h>

using namespace pcl;
using namespace std;

int testRecon()
{
    
    string plyfile = R"(E:\bunny2.obj)";
    PointCloud<PointNormal>::Ptr cloud_in(new PointCloud<PointNormal>());
    int ret = pcl::io::loadOBJFile(plyfile, *cloud_in);
    std::cout << "Ret: " << ret;

    Poisson<PointNormal> poisson;
    poisson.setDepth(8);
    poisson.setInputCloud(cloud_in);
    PolygonMesh mesh;
    poisson.reconstruct(mesh);

    string file_all = R"(E:\mesh.ply)";
    pcl::io::savePLYFile(file_all, mesh, true);

    std::cout << "done\n";
}

The mesh of the poisson reconstruction

bunny obj file

And then the mesh like above, it seems that only loading ply file likes this. What happened?

Upvotes: 1

Views: 47

Answers (0)

Related Questions