Go to the documentation of this file.00001
00063 #ifndef __TABLE_OBJECT_CLUSTER_H__
00064 #define __TABLE_OBJECT_CLUSTER_H__
00065
00066
00067 #include <pcl/point_types.h>
00068 #include <pcl/point_cloud.h>
00069 #include <Eigen/StdVector>
00070 #include <pcl/ModelCoefficients.h>
00071 #include <pcl/PointIndices.h>
00072
00073 struct BoundingBox
00074 {
00075 Eigen::Vector4f min_pt;
00076 Eigen::Vector4f max_pt;
00077 Eigen::Affine3f pose;
00078 };
00079
00080
00081 template<typename Point>
00082 class TableObjectCluster
00083 {
00084 public:
00085
00086 typedef typename pcl::PointCloud<Point>::Ptr PointCloudPtr;
00087 typedef typename pcl::PointCloud<Point>::ConstPtr PointCloudConstPtr;
00088
00089 TableObjectCluster()
00090 {
00091 height_min_ = -0.5;
00092 height_max_ = -0.03;
00093 min_cluster_size_ = 30;
00094 cluster_tolerance_ = 0.03;
00095
00096 };
00097 ~TableObjectCluster() {};
00098
00110 void
00111 extractTableRoi(PointCloudPtr& hull,
00112 pcl::PointIndices& pc_roi);
00113
00126 void
00127 extractTableRoi2(const PointCloudConstPtr& pc_in,
00128 PointCloudPtr& hull,
00129 Eigen::Vector4f& plane_coeffs,
00130 pcl::PointCloud<Point>& pc_roi);
00131
00143 void
00144 removeKnownObjects(const PointCloudConstPtr& pc_roi,
00145 std::vector<BoundingBox>& bounding_boxes,
00146 const PointCloudPtr& pc_roi_red);
00147
00148
00149 void
00150 calculateBoundingBox(const PointCloudPtr& cloud,
00151 const pcl::PointIndices& indices,
00152 const Eigen::Vector3f& plane_normal,
00153 const Eigen::Vector3f& plane_point,
00154 Eigen::Vector3f& position,
00155 Eigen::Quaternion<float>& orientation,
00156 Eigen::Vector3f& size);
00157
00158 void
00159 extractClusters(const pcl::PointIndices::Ptr& pc_roi,
00160 std::vector<PointCloudPtr>& object_clusters,
00161 std::vector<pcl::PointIndices>& object_cluster_indices);
00162
00174 void
00175 calculateBoundingBoxesOld(pcl::PointIndices::Ptr& pc_roi,
00176 std::vector<PointCloudPtr >& object_clusters,
00177 std::vector<pcl::PointCloud<pcl::PointXYZ> >& bounding_boxes);
00178
00179
00180 void
00181 setInputCloud(const PointCloudPtr& cloud) {input_ = cloud;}
00182
00193 void
00194 setPrismHeight(double height_min, double height_max)
00195 {
00196 height_min_ = height_min;
00197 height_max_ = height_max;
00198 }
00199
00210 void
00211 setClusterParams(int min_cluster_size, double cluster_tolerance)
00212 {
00213 min_cluster_size_ = min_cluster_size;
00214 cluster_tolerance_ = cluster_tolerance;
00215 }
00216
00217 protected:
00218 PointCloudPtr input_;
00219 double height_min_;
00220 double height_max_;
00221 int min_cluster_size_;
00222 double cluster_tolerance_;
00223
00224 };
00225
00226 #endif