pcl

pcl点云聚类方法

血红的双手。 提交于 2019-12-04 01:27:44
本节记录下 点云聚类 方法 1.欧式聚类分割方法 //为提取点云时使用的搜素对象利用输入点云cloud_filtered创建Kd树对象tree。 pcl ::search ::KdTree ::Ptr tree ( new pcl ::search ::KdTree ); tree -> setInputCloud (cloud_filtered); //创建点云索引向量,用于存储实际的点云信息 首先创建一个Kd树对象作为提取点云时所用的搜索方法,再创建一个点云索引向量cluster_indices,用于存储实际的点云索引信息,每个检测到的点云聚类被保存在这里。请注意: cluster_indices是一个向量,对每个检测到的聚类,它都包含一个索引点的实例,如cluster_indices[0]包含点云中第一个聚类包含的点集的所有索引。 std :: vector <pcl::PointIndices> cluster_indices; pcl::EuclideanClusterExtraction ec; ec.setClusterTolerance ( 0.02 ); //设置近邻搜索的搜索半径为2cm ec.setMinClusterSize ( 100 ); //设置一个聚类需要的最少点数目为100 ec.setMaxClusterSize ( 25000 ); /

pcl点云聚类后的点云索引提取与输出pcd聚类结果

坚强是说给别人听的谎言 提交于 2019-12-04 01:26:58
在完成PCL基于欧式聚类、区域增长、或者圆柱体分割等图像分割算法后,怎么样输出聚类,提取聚类 我的上一篇文章中,使用区域增长算法将兔子点云划分了22个区域 PCL下使用区域增长算法进行点云平面分割的实现 划分完后,怎样将这些聚类的点云分别输出不同的pcd文件呢,先参考了这篇文章 pcl点云聚类方法 这篇文章完全是抄的点云库pcl教程里的例子,而且没抄全,书里是用cmake做,而我这里不是,故代码也不太一样,然后参考了 PCL入门<六>使用Region growing进行平面分割 在PCL中实现欧氏聚类提取 这篇也写得不全,故决定自己写一段按照索引将点云聚类算法分割结果输出为不同的pcd文件 //迭代访问点云索引clusters,直到分割出所有聚类 int i= 0; for (std::vector<pcl::PointIndices>::const_iterator it = clusters.begin(); it != clusters.end(); ++it) { pcl::PointCloud<pcl::PointXYZ>::Ptr cluster(new pcl::PointCloud<pcl::PointXYZ>); //创建新的点云数据集cloud_cluster,将所有当前聚类写入到点云数据集中 for (std::vector<int>::const

HDL_Graph_slam骨头记(2)

删除回忆录丶 提交于 2019-12-03 23:38:49
#include <memory> #include <iostream> #include <ros/ros.h> #include <ros/time.h> #include <pcl_ros/point_cloud.h> #include <std_msgs/Time.h> #include <sensor_msgs/PointCloud2.h> #include <hdl_graph_slam/FloorCoeffs.h> #include <nodelet/nodelet.h> #include <pluginlib/class_list_macros.h> #include <pcl/common/transforms.h> #include <pcl/features/normal_3d.h> #include <pcl/search/impl/search.hpp> #include <pcl/filters/impl/plane_clipper3D.hpp> #include <pcl/filters/extract_indices.h> #include <pcl/sample_consensus/ransac.h> #include <pcl/sample_consensus/sac_model_plane.h> namespace hdl_graph

HDL_Graph_slam骨头记(3)

假如想象 提交于 2019-12-03 23:38:13
#include <memory> #include <iostream> #include <ros/ros.h> #include <ros/time.h> #include <ros/duration.h> #include <pcl_ros/point_cloud.h> #include <tf_conversions/tf_eigen.h> #include <tf/transform_broadcaster.h> #include <std_msgs/Time.h> #include <nav_msgs/Odometry.h> #include <sensor_msgs/PointCloud2.h> #include <nodelet/nodelet.h> #include <pluginlib/class_list_macros.h> #include <pcl/filters/voxel_grid.h> #include <pcl/filters/passthrough.h> #include <pcl/filters/approximate_voxel_grid.h> #include <hdl_graph_slam/ros_utils.hpp> #include <hdl_graph_slam/registrations.hpp> namespace hdl

PCL1.8.1 获取点云中的最大和最小的xyz值

人盡茶涼 提交于 2019-12-03 18:29:17
getMinMax3D 该函数输入点云数据,将所有x y z中最小的值和x y z中最大的值输出到pcl::PointXYZ中。 #include <pcl/common/common.h> int main() { pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); // Fill in the cloud data cloud->width = 15; cloud->height = 1; cloud->points.resize(cloud->width * cloud->height); // Generate the data for (std::size_t i = 0; i < cloud->points.size(); ++i) { cloud->points[i].x = 1024 * rand() / (RAND_MAX + 1.0f); cloud->points[i].y = 1024 * rand() / (RAND_MAX + 1.0f); cloud->points[i].z = rand(); } for (std::size_t i = 0; i < cloud->points.size(); ++i) { std::cout << " " <

ROS, opencv3 and CMake - unable to remove the library

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Working environment: Kubuntu 14.04 LTS 64bit ROS Indigo (up-to-date, full desktop install) OpenCV 2.4.8 For some unknown reason I decided to install the ros-indigo-opencv3 package which I regretted almost immediately due to the fact I also have the default version that comes with Ubuntu 14.04 - OpenCV 2.4.8. At first I noticed that QtCreator was warning me of possible incompatibility between 2.4.8 and 3.0.0 when I was building my CMake project (you can see the CMakeLists.txt at the end of this post) using only find_package(OpenCV REQUIRED)

Error for .NETStandard1.6 PCL: “Your project is not referencing the ”.NETPlatform,Version=v5.0“ framework”

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: To help reproduce the problem, the following steps are taken to create a .NETStandard1.6 PCL in Visual Studio 2015: Create a new Class Library(Portable for iOS, Android and Windows). In its Properties page, click "Target .NET Platform Standard". Change .NETStandard form .NETStandard1.1 to .NETStandard1.6 Build this empty project. The following error occurs: >C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETPlatform,Version=v5.0" framework. Add a reference to "

Generating project with PCL (Point Cloud Library) on Mac OS X

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed all the dependencies and the pre-compiled PCL library as it suggested on their site . After I installed everything I wanted to generate a project following this tutorial. After executing the 'make' command I get several warnings and the following two errors: 37 warnings generated. Linking CXX executable pcd_write_test Undefined symbols for architecture x86_64: "pcl::PCDWriter::writeASCII(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sensor_msgs::PointCloud2 const&, Eigen::Matrix

RANSAC plane fitting coefficients

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to fit a plane to a set of point cloud. I tried using Point Cloud Library (PCL) & it works well. What I need to know is that how can I obtain the coefficients a,b,c of the fitted plane (ax+by+cz+1=0). Is there any straightforward way? I got some insights from here: 3D Least Squares Plane 回答1: See the following planar segmentation tutorial: http://pointclouds.org/documentation/tutorials/planar_segmentation.php Note in particular the use of the pcl::ModelCoefficients data structure. Allocation: pcl::ModelCoefficients::Ptr

How to convert cv::Mat to pcl::pointcloud

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to get from a opencv Mat pointcloud to a pcl::pointcloud? The color is not important for me only the points itself. 回答1: you can do this like: pcl::PointCloud<pcl::PointXYZ>::Ptr SimpleOpenNIViewer::MatToPoinXYZ(cv::Mat OpencVPointCloud) { /* * Function: Get from a Mat to pcl pointcloud datatype * In: cv::Mat * Out: pcl::PointCloud */ //char pr=100, pg=100, pb=100; pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_ptr(new pcl::PointCloud<pcl::PointXYZ>);//(new pcl::pointcloud<pcl::pointXYZ>); for(int i=0;i<OpencVPointCloud.cols;i++) { /