28 #include <boost/filesystem.hpp>
44 std::map<std::string, lvr2::Channel<float> > floatChannels;
45 type = cloud->getAllChannelsOfType<
float>(floatChannels);
47 std::vector<lvr2::FloatChannelPtr> channels;
48 for(
auto channelPair: floatChannels)
50 std::string name = channelPair.first;
51 auto channel2 = channelPair.second;
53 channels.push_back(filtered);
54 for(
size_t i = 0; i < j; ++i)
56 size_t index = inlier[i];
57 for(
size_t k = 0; k < channel2.width(); ++k)
59 (*filtered)[i][k] = channel2[index][k];
63 cloud_filtered->addFloatChannel(filtered, name);
67 std::vector<lvr2::UCharChannelPtr> channels_uchar;
68 std::map<std::string, lvr2::Channel<unsigned char> > uCharChannels;
69 int ucharType = cloud->getAllChannelsOfType<
unsigned char>(uCharChannels);
70 for(
auto channelPair: uCharChannels)
72 std::string name = channelPair.first;
73 auto channel2 = channelPair.second;
75 channels_uchar.push_back(filtered);
76 for(
size_t i = 0; i < j; ++i)
78 size_t index = inlier[i];
79 for(
size_t k = 0; k < channel2.width(); ++k)
81 (*filtered)[i][k] = channel2[index][k];
85 cloud_filtered->addUCharChannel(filtered, name);
88 cloud = cloud_filtered;
123 if (model && model->m_pointCloud )
125 num_points = model->m_pointCloud->numPoints();
126 points = model->m_pointCloud->getPointArray();
127 cout <<
timestamp <<
"Read " << num_points <<
" points from " <<
argv[1] << endl;
131 cout <<
timestamp <<
"Warning: No point cloud data found in " <<
argv[1] << endl;
137 cout <<
timestamp <<
"Constructing kd-tree..." << endl;
138 ClSOR sor(points, num_points, 20);
139 cout <<
timestamp <<
"Finished kd-tree construction." << endl;
143 cout <<
timestamp <<
"Got Nearest Neighbors" << std::endl;
145 cout <<
timestamp <<
"Got Statistics" << std::endl;
150 std::cout <<
timestamp <<
"outliers " << num_points - j << std::endl;
151 std::cout <<
timestamp <<
"inliers " << j << std::endl;
153 filter(model->m_pointCloud, inlier, j);