当前位置:网站首页>PCL projection point cloud
PCL projection point cloud
2022-07-02 10:57:00 【AICVer】
Projection to XOY In the plane
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/ModelCoefficients.h>
#include <pcl/filters/project_inliers.h>
#include <pcl/visualization/pcl_visualizer.h>
using namespace std;
using namespace pcl;
void visualize(PointCloud<PointXYZ>::Ptr source, PointCloud<PointXYZ>::Ptr target)
{
visualization::PCLVisualizer viewer("Point Cloud Viewer");
// Create two display windows
int v1, v2;
viewer.createViewPort(0, 0.0, 0.5, 1.0, v1);
viewer.createViewPort(0.5, 0.0, 1.0, 1.0, v2);
// Set the background color
viewer.setBackgroundColor(255, 255, 255, v1);
viewer.setBackgroundColor(255, 255, 255, v2);
// Add color to point clouds
visualization::PointCloudColorHandlerCustom<PointXYZ> source_color(source, 0, 0, 255); // blue
visualization::PointCloudColorHandlerCustom<PointXYZ> target_color(target, 255, 0, 0); // red
// Add a point cloud to the display window
viewer.addPointCloud(source, source_color, "source cloud", v1);
viewer.addPointCloud(target, target_color, "target cloud", v2);
while (!viewer.wasStopped())
{
viewer.spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
}
int main(int argc, char** argv)
{
PointCloud<PointXYZ>::Ptr cloud(new pcl::PointCloud<PointXYZ>);
PointCloud<PointXYZ>::Ptr filtered_cloud(new pcl::PointCloud<PointXYZ>);
io::loadPCDFile("D:\\Data\\rabbit.pcd", *cloud);
// Output the number of points before filtering
cout << " Before filtering :" << cloud->points.size() << " A little bit " << endl;
// Set the coefficient of model parameters
ModelCoefficients::Ptr coefficients(new ModelCoefficients());
coefficients->values.resize(4);
coefficients->values[0] = 0;
coefficients->values[1] = 0;
coefficients->values[2] = 1.0;
coefficients->values[3] = 0;
// Instantiate the filter object
ProjectInliers<PointXYZ> proj;
proj.setModelType(SACMODEL_PLANE);
proj.setInputCloud(cloud);
proj.setModelCoefficients(coefficients);
proj.filter(*filtered_cloud);
cout << " Yes after filtering :" << filtered_cloud->points.size() << " A little bit " << endl;
visualize(cloud, filtered_cloud);
return 0;
}
Other models that can be projected
The projection models that can be used are as follows :
Plane model :SACMODEL_PLANE
Line model :SACMODEL_LINE
A two-dimensional circle on a plane :SACMODEL_CIRCLE2D
A three-dimensional circle on a plane :SACMODEL_CIRCLE3D
Sphere model :SACMODEL_SPHERE
Cylinder model :SACMODEL_CYLINDER
Conical model :SACMODEL_CONE
Torus model :SACMODEL_TORUS
A line model parallel to a given axis :SACMODEL_PARALLEL_LINE
Plane model perpendicular to the specified axis :SACMODEL_PERPENDICULAR_PLANE
3D bar segmentation model :SACMODEL_STICK
边栏推荐
- Stm32 et développement de moteurs (système supérieur)
- axis设备的rtsp setup头中的url不能带参
- MongoDB 学习整理(条件操作符,$type 操作符,limit()方法,skip() 方法 和 sort() 方法)
- Hdu1236 ranking (structure Sorting)
- Lunix reallocates root and home space memory
- js setTimeout()与面试题
- SQOOP 1.4.6 INSTALL
- Retrofit's callback hell is really vulnerable in kotlin synergy mode!
- PCL 投影点云
- Analysis of hot spots in AI technology industry
猜你喜欢
LeetCode+ 76 - 80 暴搜专题
Jsp webshell Free from killing - The Foundation of JSP
使用华为性能管理服务,按需配置采样率
"Matching" is true love, a new attitude for young people to make friends
Kustomize使用手册
Rapid prototyping
Session cookies and tokens
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
The URL in the RTSP setup header of the axis device cannot take a parameter
Ks009 implement pet management system based on SSH
随机推荐
2. Hacking lab script off [detailed writeup]
Operator-1初识Operator
【付费推广】常见问题合集,推荐榜单FAQ
Ks009 implement pet management system based on SSH
UVM learning - build a simple UVM verification platform
集成学习概览
What are the popular frameworks for swoole in 2022?
使用Windbg静态分析dump文件(实战经验总结)
Flink submitter
[visual studio] visual studio 2019 community version cmake development environment installation (download | install relevant components | create compilation execution project | error handling)
Leetcode+ 76 - 80 storm search topic
【AGC】构建服务3-认证服务示例
MySQL数据库远程访问权限设置
Shell programming 01_ Shell foundation
Set the playback speed during the playback of UOB equipment
从MediaRecord录像中读取H264参数
华为快应用中如何实现同时传递事件对象和自定义参数
转换YV12到RGB565图像转换,附YUV转RGB测试
(5) Gear control setting of APA scene construction
2022-06-17