pcl_utils.h
Go to the documentation of this file.
00001 /*
00002  * pcl_utils.h
00003  *
00004  *  Created on: Sep 26, 2012
00005  *      Author: kidson
00006  */
00007 
00008 #ifndef PCL_UTILS_H_
00009 #define PCL_UTILS_H_
00010 
00011 #include "rgbd_registration/typedefs.h"
00012 #include <pcl/kdtree/kdtree_flann.h>
00013 
00014 void calculatePointCloudNormals (const PointCloudConstPtr input_cloud_ptr,
00015     PointCloudNormalsPtr output_cloud_ptr);
00016 
00017 void removePointNormalsWithNaNs (const PointCloudNormalsPtr input_cloud_ptr);
00018 
00019 void checkforNaNs (const PointCloudNormalsConstPtr input_cloud_ptr);
00020 
00021 void writePCDToFile (const std::string& fileName, const PointCloudConstPtr cloud_ptr);
00022 
00023 void writePCDToFile (const std::string& fileName, const PointCloudConstPtr cloud_ptr,
00024     const std::vector<int>& indices);
00025 void transformAndWriteToFile (const PointCloudConstPtr cloud_in, const Eigen::Matrix4f& trafo);
00026 
00027 void transformAndWriteToFile (const PointCloudConstPtr cloud_in, const std::vector<int>& indices,
00028     const Eigen::Matrix4f& trafo);
00029 
00030 // ----------- TODO: Template ---------------------------------
00031 void writePCDToFile (const std::string& fileName, const PointCloudNormalsConstPtr cloud_ptr);
00032 
00033 void writePCDToFile (const std::string& fileName, const PointCloudNormalsConstPtr cloud_ptr,
00034     const std::vector<int>& indices);
00035 void transformAndWriteToFile (const PointCloudNormalsConstPtr cloud_in,
00036     const Eigen::Matrix4f& trafo);
00037 
00038 void transformAndWriteToFile (const PointCloudNormalsConstPtr cloud_in,
00039     const std::vector<int>& indices, const Eigen::Matrix4f& trafo);
00040 
00041 template<class pointT>
00042 inline void getIndicesFromMatches (
00043     typename pcl::PointCloud<pointT>::Ptr cloud_ptr,
00044     const std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> >& point_locations,
00045     std::vector<int>& indices)
00046 {
00047   pcl::KdTreeFLANN<pointT> kdtreeNN;
00048   std::vector<int> pointIdxNKNSearch (1);
00049   std::vector<float> pointNKNSquaredDistance (1);
00050   kdtreeNN.setInputCloud (cloud_ptr);
00051   indices.clear ();
00052   for (size_t idx = 0; idx < point_locations.size (); idx++)
00053   {
00054     pointT test_point;
00055     test_point.x = point_locations[idx][0];
00056     test_point.y = point_locations[idx][1];
00057     test_point.z = point_locations[idx][2];
00058     kdtreeNN.nearestKSearch (test_point, 1, pointIdxNKNSearch, pointNKNSquaredDistance);
00059     indices.push_back (pointIdxNKNSearch[0]);
00060   }
00061 }
00062 
00063 #endif /* PCL_UTILS_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


rgbd_registration
Author(s): Ross Kidson
autogenerated on Thu May 23 2013 15:36:53