10 #include <boost/assign.hpp>
16 using namespace boost;
22 int main(
int argc,
char *argv[])
25 if (argc < 2 || argc > 3)
27 std::cerr <<
"USAGE: filterProfiler <path_to_input_cloud> <summarizationMethod (optional) 2 or 1 or 0>" << std::endl;
33 if (strcmp(argv[2],
"1") != 0 && strcmp(argv[2],
"0")) {
34 cerr <<
"param useCentroid must be 1 or 0" << endl;
38 useCentroid = argv[2];
48 std::shared_ptr<PM::DataPointsFilter> randomSample =
49 PM::get().DataPointsFilterRegistrar.create(
50 "RandomSamplingDataPointsFilter",
54 cout <<
"starting random sample filter" << endl;
55 clock_t time_a = clock();
56 randomSample->inPlaceFilter(in);
57 clock_t time_b = clock();
59 if (time_a == ((clock_t)-1) || time_b == ((clock_t)-1))
61 perror(
"Unable to calculate elapsed time");
66 cout <<
"Performed random sampling in " << (float)(time_b - time_a)/CLOCKS_PER_SEC <<
" seconds" << endl;
69 std::shared_ptr<PM::DataPointsFilter> voxelf =
70 PM::get().DataPointsFilterRegistrar.create(
71 "VoxelGridDataPointsFilter",
76 {
"useCentroid",useCentroid},
77 {
"averageExistingDescriptors",
"0"}
81 cout <<
"starting voxel grid sample filter, useCentroid: " << useCentroid << endl;
83 voxelf->inPlaceFilter(in);
86 if (time_a == ((clock_t)-1) || time_b == ((clock_t)-1))
88 perror(
"Unable to calculate elapsed time");
93 cout <<
"Performed voxel grid sampling in " << (float)(time_b - time_a)/CLOCKS_PER_SEC <<
" seconds" << endl;