Go to the documentation of this file.00001
00059
00060
00061
00062
00063
00064
00065
00066
00067 #include <cob_3d_mapping_filters/intensity_filter.h>
00068
00069
00070 #include <pcl/point_types.h>
00071 #include <pcl/io/pcd_io.h>
00072 #include <cob_3d_mapping_common/point_types.h>
00073
00074
00075 #include <boost/timer.hpp>
00076 #include "cob_3d_mapping_common/stop_watch.h"
00077 #include <iostream>
00078 #include <fstream>
00079
00080
00081
00082 double
00083 TestProcessingTimeOnce (unsigned int cloud_size, unsigned int iterations)
00084 {
00085 cob_3d_mapping_filters::IntensityFilter<PointXYZI> filter;
00086 pcl::PointCloud<PointXYZI>::Ptr cloud (new pcl::PointCloud<PointXYZI> ());
00087 pcl::PointCloud<PointXYZI>::Ptr cloud_out (new pcl::PointCloud<PointXYZI> ());
00088
00089 cloud->points.resize (cloud_size);
00090 cloud->width = cloud_size;
00091 cloud->height = 1;
00092 for (unsigned int i = 0; i < cloud_size; i++)
00093 {
00094 PointXYZI pt;
00095 pt.x = pt.y = pt.z = pt.intensity = 1;
00096 cloud->points[i] = pt;
00097 }
00098 filter.setInputCloud (cloud);
00099
00100 double time = 0;
00101 for (unsigned int i = 0; i < iterations; i++)
00102 {
00103 PrecisionStopWatch sw;
00104 sw.precisionStart ();
00105 filter.filter (*cloud_out);
00106 time += sw.precisionStop ();
00107 }
00108 time /= iterations;
00109 std::cout << "Cloud size " << cloud_size << ": " << time << " s" << std::endl;
00110 return time;
00111 }
00112
00113 void
00114 TestProcessingTime ()
00115 {
00116 std::ofstream file;
00117 file.open ("/home/goa/tmp/intensity_filter_timing.dat");
00118 file << "#No. of points\ttime (s)\n";
00119 for (unsigned int cloud_size = 40000; cloud_size <= 400000; cloud_size += 40000)
00120 {
00121 double time = TestProcessingTimeOnce (cloud_size, 1000);
00122 file << cloud_size << "\t" << time << "\n";
00123 }
00124 file.close ();
00125 }
00126
00127 int
00128 main ()
00129 {
00130 TestProcessingTimeOnce (10000, 1);
00131 }
00132