polygon_filter.h
Go to the documentation of this file.
00001 #include <pcl/point_types.h>
00002 #include <pcl/point_cloud.h>
00003 
00005 template <class point_type1>
00006 pcl::PointCloud<point_type1> crop_by_polygon(const pcl::PointCloud<point_type1>& cropping_polygon, const pcl::PointCloud<point_type1>& cloud_to_crop, int x = 0, int y = 1, bool invert = false);
00007 
00011 template <class point_type1>
00012 bool point_inside_polygon(const pcl::PointCloud<point_type1>& cropping_polygon, const point_type1& query_point, int x, int y);
00013 
00014 template <class point_type1>
00015 pcl::PointCloud<point_type1> standardCroppingPolygon(float door_radius){
00016     pcl::PointCloud<point_type1>  polygon;
00017     point_type1 inside_vertex, outside_vertex;
00018     float inside_radius = 0.15; //inner radius as to not see the door frame
00019     float outside_radius = door_radius-0.05; //same, but closer, to not miss the handle
00020     float min_angle =  -5.0/180*3.142; 
00021     float max_angle = 100.0/180*3.142; 
00022     float offset = - 0.05; // set the "center" back as to get a little margin
00025     for(float angle = min_angle; angle < max_angle; angle += 10.0/180.0*3.142){
00026       inside_vertex.x  = inside_radius  * cos(angle) + offset;
00027       inside_vertex.y  = inside_radius  * sin(angle) + offset;
00028       polygon.points.insert(polygon.end(), inside_vertex);
00029 
00030       outside_vertex.x = outside_radius * cos(angle) + offset;
00031       outside_vertex.y = outside_radius * sin(angle) + offset;
00032       polygon.points.insert(polygon.begin(), outside_vertex); 
00033     }
00034     return polygon;
00035       
00036 }
00037 template <class point_type1>
00038 pcl::PointCloud<point_type1> standardCroppingPolygon2(float door_radius){
00039     pcl::PointCloud<point_type1> polygon;
00040     point_type1 vertex;
00041     float dr = door_radius-0.05; //margin to the door frame
00042     vertex.x =   0.20; vertex.y =   0.15; polygon.points.push_back(vertex);//a  d----------------c
00043     vertex.x =  -0.05; vertex.y =   0.15; polygon.points.push_back(vertex);//b  |               /
00044     vertex.x =  -0.50; vertex.y = door_radius; polygon.points.push_back(vertex);//c  |              /
00045     vertex.x = door_radius; vertex.y = door_radius; polygon.points.push_back(vertex);//d  |             /
00046     vertex.x = door_radius; vertex.y =  -0.10; polygon.points.push_back(vertex);//e  |         a--b
00047     vertex.x =   0.20; vertex.y =  -0.10; polygon.points.push_back(vertex);//f  e---------f
00048     return polygon;
00049 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


door_perception
Author(s): Felix Endres
autogenerated on Wed Dec 26 2012 16:03:53