资源简介
PCL最小包围盒完整代码,实现了2D/3D点云最小包围盒的实现.
PCL最小外接矩形完整代码,实现了2D/3D点云最小外接矩形的实现

代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef pcl::PointXYZ PointType;
typedef struct myPointType
{
double x; //mm world coordinate x
double y; //mm world coordinate y
double z; //mm world coordinate z
int num; //point num
};
// Get N bits of the string from back to front.
char* Substrend(char*strint n)
{
char *substr=(char*)malloc(n+1);
int length=strlen(str);
if (n>=length)
{
strcpy(substrstr);
return substr;
}
int k=0;
for (int i=length-n;i {
substr[k]=str[i];
k++;
}
substr[k]=‘\0‘;
return substr;
}
int main(int argc char **argv)
{
// create point cloud
pcl::PointCloud::Ptr cloud(new pcl::PointCloud());
// load data
char* fileType;
if (argc>1)
{
fileType = Substrend(argv[1]3);
}
if (!strcmp(fileType“pcd“))
{
// load pcd file
pcl::io::loadPCDFile(argv[1] *cloud);
}
else if(!strcmp(fileType“txt“))
{
// load txt data file
int number_Txt;
myPointType txtPoint;
vector points;
FILE *fp_txt;
fp_txt = fopen(argv[1] “r“);
if (fp_txt)
{
while (fscanf(fp_txt “%lf %lf %lf“ &txtPoint.x &txtPoint.y &txtPoint.z) != EOF)
{
points.push_back(txtPoint);
}
}
else
std::cout << “txt数据加载失败!“ << endl;
number_Txt = points.size();
cloud->width = number_Txt;
cloud->height = 1;
cloud->is_dense = false;
cloud->points.resize(cloud->width * cloud->height);
for (size_t i = 0; i < cloud->points.size(); ++i)
{
cloud->points[i].x = points[i].x;
cloud->points[i].y = points[i].y;
cloud->points[i].z = 0;
}
}
else
{
std::cout << “please input data file name“< return 0;
}
// start calculating time
pcl::StopWatch time;
Eigen::Vector4f pcaCentroid;
pcl::compute3DCentroid(*cloud pcaCentroid);
Eigen::Matrix3f covariance;
pcl::computeCovarianceMatrixNormalized(*cloud pcaCentroid covariance);
Eigen::SelfAdjointEigenSolver eigen_solver(covariance Eigen::ComputeEigenvectors);
Eigen::Matrix3f eigenVectorsPCA = eigen_solver.eigenvectors();
Eigen::Vector3f
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-09-21 03:16 Rectangular_Bounding_Box\
文件 6079 2018-09-20 07:41 Rectangular_Bounding_Box\scan.pcd
文件 6789 2018-09-20 07:37 Rectangular_Bounding_Box\scan.txt
文件 2547006 2018-04-03 16:17 Rectangular_Bounding_Box\milk_cartoon_all_small_clorox.pcd
文件 92940 2018-04-03 16:17 Rectangular_Bounding_Box\milk.pcd
文件 473 2018-09-20 07:04 Rectangular_Bounding_Box\CMakeLists.txt
文件 10344 2018-09-21 03:16 Rectangular_Bounding_Box\rectangular_bounding_box.cpp
目录 0 2018-09-21 07:32 Rectangular_Bounding_Box\build\
相关资源
- PB做的托盘程序(最小化后在左下角显
- 用矩阵类算法程序和最小二乘法
- 新旧坐标换算(采用最小二乘法利用
- prim和kruskal算法求最小生成树262629
- 数据结构-最小通信网问题
- PRIM算法,求最小生成树
- 最小SUSY SO10GUT中质子衰减与PMNS相之间
- 汉印A300 CPCL协议 android 热敏打印app(
- OPENGL实现世界上最小的3D游戏
- 非最小的CW膨胀,电弱对称破坏和75
- KLZ模型中介子的五维Lorentz违反非最小
- LHC以最小的U1扩展标准模型在LHC上产
- 非最小麦克斯韦耦合的高阶导数标量
- 解决方案-超过100帧/秒的速度从单色摄
- 超级场景清理器(SPCleaner)v1.0免费版
- 基于曲率的适应性移动最小二乘曲面
- TMS320F280049最小系统原理图
- 寻找最小的反向跷跷板实现
- 在最小左右对称模型中解开跷跷板机
- 最小逆跷跷板机制中的暗物质
- 最小预测跷跷板模型中的脂肪生成
- 中微子的最小μ跷跷板与复杂μ&t
- 轴突和中微子的最小模型
- 最小跷跷板模型中的中微子CP违反和重
- 最小刻录工具
- 在国家自然科学基金11505208、11661141
- httpclient4.3工具类
- 最小二乘法拟合曲线
- STM32F030051C8T6最小系统资料
- 最小NRF51822系统原理图+PCB版图+元器件
评论
共有 条评论