基于PCL的曲面重建代码
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-07-05 11:03 1.PossionReconstruction
目录 0 2016-07-05 13:03 1.PossionReconstructionPointCloudView
目录 0 2016-07-05 11:27 1.PossionReconstructionPointCloudViewDebug
文件 547840 2016-07-05 11:12 1.PossionReconstructionPointCloudViewDebugPointCloudView.exe
文件 2360096 2016-07-05 11:12 1.PossionReconstructionPointCloudViewDebugPointCloudView.ilk
文件 46189568 2016-07-05 11:12 1.PossionReconstructionPointCloudViewDebugPointCloudView.pdb
文件 1489079 2016-05-22 11:23 1.PossionReconstructionPointCloudViewDebugoption-0000.ply
文件 958480 2016-05-22 11:35 1.PossionReconstructionPointCloudViewDebug
abbit0.pcd
文件 1926687 2016-07-05 11:27 1.PossionReconstructionPointCloudViewDebug
esult.ply
目录 0 2016-07-05 11:03 1.PossionReconstructionPointCloudViewPointCloudView
目录 0 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebug
文件 649026 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugCL.read.1.tlog
文件 1120 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugCL.write.1.tlog
文件 1603 2016-05-24 10:33 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.Build.CppClean.log
文件 406 2016-05-24 10:41 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.exe.embed.manifest
文件 472 2016-07-05 11:10 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.exe.embed.manifest.res
文件 381 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.exe.intermediate.manifest
文件 142 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.lastbuildstate
文件 29145 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.log
文件 0 2016-05-24 10:33 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.write.1.tlog
文件 218 2016-05-24 10:34 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView_manifest.rc
文件 1598 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugcl.command.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink-cvtres.read.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink-cvtres.write.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink.11072-cvtres.read.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink.11072-cvtres.write.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink.11072.read.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink.11072.write.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink.11416-cvtres.read.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink.11416-cvtres.write.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebuglink.11416.read.1.tlog
............此处省略37个文件信息
/********************************************
功能:曲面重建(泊松重建)
*********************************************/
//点的类型的头文件
#include
//点云文件IO(pcd文件和ply文件)
#include
#include
//kd树
#include
//特征提取
#include
#include
//重构
#include
#include
//可视化
#include
//多线程
#include
#include
#include
#include
#include
int main(int argc char** argv)
{
// 确定文件格式
char tmpStr[100];
strcpy(tmpStrargv[1]);
char* pext = strrchr(tmpStr ‘.‘);
std::string extply(“ply“);
std::string extpcd(“pcd“);
if(pext)
{
*pext=‘ ‘;
pext++;
}
std::string ext(pext);
//如果不支持文件格式,退出程序
if (!((ext == extply)||(ext == extpcd)))
{
std::cout << “文件格式不支持!“ << std::endl;
std::cout << “支持文件格式:*.pcd和*.ply!“ << std::endl;
return(-1);
}
//创建点云对象指针,用于存储输入
pcl::PointCloud::Ptr cloud(new pcl::PointCloud) ;
if (ext == extply)
{
if (pcl::io::loadPLYFile(argv[1] *cloud) == -1){
PCL_ERROR(“Could not read ply file!
“) ;
return -1;
}
}
else
{
if (pcl::io::loadPCDFile(argv[1] *cloud) == -1){
PCL_ERROR(“Could not read pcd file!
“) ;
return -1;
}
}
// 计算法向量
pcl::PointCloud::Ptr cloud_with_normals(new pcl::PointCloud); //法向量点云对象指针
pcl::NormalEstimation n ;//法线估计对象
pcl::PointCloud::Ptr normals(new pcl::PointCloud) ;//存储估计的法线的指针
pcl::search::KdTree::Ptr tree(new pcl::search::KdTree) ;
tree->setInputCloud(cloud) ;
n.setInputCloud(cloud) ;
n.setSearchMethod(tree) ;
n.setKSearch(20);
n.compute(*normals); //计算法线,结果存储在normals中
//将点云和法线放到一起
pcl::concatenateFields(*cloud *normals *cloud_with_normals) ;
//创建搜索树
pcl::search::KdTree::Ptr tree2(new pcl::search::KdTree) ;
tree2->setInputCloud(cloud_with_normals) ;
//创建Poisson对象,并设置参数
pcl::Poisson pn ;
pn.setConfidence(false); //是否使用法向量的大小作为置信信息。如果false,所有法向量均归一化。
pn.setDegree(2); //设置参数degree[15]值越大越精细,耗时越久。
pn.setDepth(8); //树的最大深度,求解2^d x 2^d x 2^d立方体元。由于八叉树自适应采样密度,指定值仅为最大深度。
pn.setIsoDivide(8); //用于提取ISO等值面的算法的深度
pn.setManifold(false); //是否添加多边形的重心,当多边形三角化时。 设置流行标志,如果设置为true,则对多边形进行细分三角话时添加重心,设置false则不添加
pn.setOutputPolygons(false); //是否输出多边形网格(而不是三角化移动立方体的结果)
pn.setSamplesPerNode(3.0); //设置落入一个八叉树结点中的样本点的最小数量。无噪声,[1.0-5.0]有噪声[15.-20.]平滑
pn.setScale(1.25); //设置用于重构的立方体直径和样本边界立方体直径的比率。
pn.setSolverDivide(8); //设置求解线性方程组的Gauss-Seidel迭代方法的深度
//pn.setIndices();
//设置搜索方法和输入点云
pn.setSearchMethod(tree2);
pn.setInputCloud(cloud_with_normals);
//创建多变形网格,用于存储结果
pcl::PolygonMesh
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-07-05 11:03 1.PossionReconstruction
目录 0 2016-07-05 13:03 1.PossionReconstructionPointCloudView
目录 0 2016-07-05 11:27 1.PossionReconstructionPointCloudViewDebug
文件 547840 2016-07-05 11:12 1.PossionReconstructionPointCloudViewDebugPointCloudView.exe
文件 2360096 2016-07-05 11:12 1.PossionReconstructionPointCloudViewDebugPointCloudView.ilk
文件 46189568 2016-07-05 11:12 1.PossionReconstructionPointCloudViewDebugPointCloudView.pdb
文件 1489079 2016-05-22 11:23 1.PossionReconstructionPointCloudViewDebugoption-0000.ply
文件 958480 2016-05-22 11:35 1.PossionReconstructionPointCloudViewDebug
abbit0.pcd
文件 1926687 2016-07-05 11:27 1.PossionReconstructionPointCloudViewDebug
esult.ply
目录 0 2016-07-05 11:03 1.PossionReconstructionPointCloudViewPointCloudView
目录 0 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebug
文件 649026 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugCL.read.1.tlog
文件 1120 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugCL.write.1.tlog
文件 1603 2016-05-24 10:33 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.Build.CppClean.log
文件 406 2016-05-24 10:41 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.exe.em
文件 472 2016-07-05 11:10 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.exe.em
文件 381 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.exe.intermediate.manifest
文件 142 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.lastbuildstate
文件 29145 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.log
文件 0 2016-05-24 10:33 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView.write.1.tlog
文件 218 2016-05-24 10:34 1.PossionReconstructionPointCloudViewPointCloudViewDebugPointCloudView_manifest.rc
文件 1598 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugcl.command.1.tlog
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
文件 2 2016-07-05 11:12 1.PossionReconstructionPointCloudViewPointCloudViewDebugli
............此处省略37个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)