Go to the documentation of this file.00001
00064 #ifndef TABLE_EXTRACTION_H_
00065 #define TABLE_EXTRACTION_H_
00066
00067
00068
00069
00070
00071 #include <iostream>
00072 #include <fstream>
00073 #include <sstream>
00074 #include <string>
00075 #include <vector>
00076 #include <math.h>
00077
00078
00079 #include "pcl/point_types.h"
00080 #include "pcl/common/centroid.h"
00081 #include "pcl/common/eigen.h"
00082
00083
00084 #include <Eigen/Core>
00085 #include <boost/shared_ptr.hpp>
00086 #include <boost/thread/mutex.hpp>
00087
00088 #include <cob_3d_mapping_common/polygon.h>
00089
00090 using namespace cob_3d_mapping;
00091
00095 class TableExtraction
00096 {
00097
00098 public:
00099
00103 TableExtraction () :
00104 norm_x_min_ (-0.1), norm_x_max_ (0.1), norm_y_min_ (-0.1), norm_y_max_ (0.1), norm_z_min_ (-0.99), norm_z_max_ (
00105 0.99), height_min_ (0.4), height_max_ (1), area_min_ (1), area_max_ (3)
00106 {
00108 }
00109
00113 ~TableExtraction ()
00114 {
00115
00117 }
00118
00124 void
00125 setNormalBounds (double tilt_angle)
00126 {
00127 static const double PI = 3.1415926;
00128 double ang_rad = tilt_angle * (PI / 180.0);
00129 double norm = cos ((PI / 2) - ang_rad);
00130 norm_x_min_ = -norm;
00131 norm_x_max_ = norm;
00132 norm_y_min_ = -norm;
00133 norm_y_max_ = norm;
00134 norm_z_min_ = -cos (ang_rad);
00135 norm_z_max_ = cos (ang_rad);
00136 }
00137
00144 void
00145 setHeightMin (double height_min)
00146 {
00147 height_min_ = height_min;
00148 }
00149
00156 void
00157 setHeightMax (double height_max)
00158 {
00159 height_max_ = height_max;
00160 }
00161
00168 void
00169 setAreaMin (double area_min)
00170 {
00171 area_min_ = area_min;
00172 }
00173
00180 void
00181 setAreaMax (double area_max)
00182 {
00183 area_max_ = area_max;
00184 }
00185
00192 void
00193 setInputPolygon (Polygon::Ptr poly_ptr)
00194 {
00195 poly_ptr_ = poly_ptr;
00196 }
00197
00203 bool
00204 isTable ();
00205
00206 protected:
00207
00214 bool
00215 isHorizontal ();
00216
00223 bool
00224 isHeightOk ();
00225
00231 bool
00232 isSizeOk ();
00233
00234 double norm_x_min_;
00235 double norm_x_max_;
00236 double norm_y_min_;
00237 double norm_y_max_;
00238 double norm_z_min_;
00239 double norm_z_max_;
00240
00241 double height_min_;
00242 double height_max_;
00243
00244 double area_min_;
00245 double area_max_;
00246
00247 Polygon::Ptr poly_ptr_;
00248
00249 };
00250
00251 #endif