profile_fee.cpp
Go to the documentation of this file.
00001 
00059 #include <pcl/point_types.h>
00060 #include <pcl/io/pcd_io.h>
00061 #include <pcl/features/integral_image_normal.h>
00062 #include <pcl/visualization/pcl_visualizer.h>
00063 #include <pcl/visualization/point_cloud_handlers.h>
00064 
00065 #include "cob_3d_mapping_common/stop_watch.h"
00066 #include "cob_3d_mapping_common/point_types.h"
00067 #include "cob_3d_features/fast_edge_estimation_3d.h"
00068 
00069 using namespace pcl;
00070 typedef visualization::PointCloudColorHandlerRGBField<PointXYZRGB> ColorHdlRGB;
00071 
00072 int main(int argc, char** argv)
00073 {
00074   PointCloud<PointXYZRGB>::Ptr p(new PointCloud<PointXYZRGB>);
00075   PointCloud<Normal>::Ptr n(new PointCloud<Normal>);
00076   PointCloud<InterestPoint>::Ptr ip(new PointCloud<InterestPoint>);
00077   PrecisionStopWatch t;
00078   std::string file_ = "/home/goa/pcl_daten/corner/office_corner.pcd";
00079   PCDReader r;
00080   if (r.read(file_, *p) == -1) return(0);
00081 
00082   IntegralImageNormalEstimation<PointXYZRGB,Normal> ne;
00083   ne.setNormalEstimationMethod (ne.COVARIANCE_MATRIX);
00084   ne.setMaxDepthChangeFactor(0.02f);
00085   ne.setNormalSmoothingSize(10.0f);
00086   ne.setDepthDependentSmoothing(true);
00087   ne.setInputCloud(p);
00088   ne.compute(*n);
00089 
00090   t.precisionStart();
00091   cob_3d_features::FastEdgeEstimation3D<PointXYZRGB, Normal, InterestPoint> ee3d;
00092   ee3d.setPixelSearchRadius(16,2,4);
00093   ee3d.setInputCloud(p);
00094   ee3d.setInputNormals(n);
00095   ee3d.compute(*ip);
00096   std::cout << t.precisionStop() << "s\t for 3D edge estimation" << std::endl;
00097 
00098   for (size_t i = 0; i < ip->points.size(); i++)
00099   {
00100     int col = (ip->points[i].strength) * 255;
00101     if (col > 255)
00102     {
00103       p->points[i].r = 0;
00104       p->points[i].g = 255;
00105       p->points[i].b = 0;
00106     }
00107     else if (col < 0)
00108     {
00109       p->points[i].r = 255;
00110       p->points[i].g = 0;
00111       p->points[i].b = 0;
00112     }
00113     else
00114     {
00115       p->points[i].r = col;
00116       p->points[i].g = col;
00117       p->points[i].b = col;
00118     }
00119   }
00120 
00121   visualization::PCLVisualizer v("fast");
00122   ColorHdlRGB col_hdl(p);
00123   v.setBackgroundColor(0,127,127);
00124   v.addPointCloud<PointXYZRGB>(p,col_hdl, "segmented1");
00125 
00126   while(!v.wasStopped())
00127   {
00128     v.spinOnce(100);
00129     usleep(100000);
00130   }
00131 
00132   return 0;
00133 }


cob_3d_features
Author(s): Georg Arbeiter
autogenerated on Wed Aug 26 2015 11:02:26