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);
A class to handle point information with an arbitrarily large number of attribute channels...
Datastructures for holding loaded data.
boost::shared_array< unsigned int > uintArr
static Timestamp timestamp
A global time stamp object for program runtime measurement.
static ModelPtr readModel(std::string filename)
void setMult(float std_dev_mult)
UCharChannel::Optional UCharChannelOptional
std::shared_ptr< PointBuffer > PointBufferPtr
int main(int argc, char **argv)
boost::shared_array< unsigned int > indexArray
boost::shared_array< float > floatArr
int getInliers(lvr2::indexArray &inliers)
void filter(lvr2::PointBufferPtr &cloud, lvr2::indexArray &inlier, size_t j)
UCharChannel::Ptr UCharChannelPtr
std::shared_ptr< Model > ModelPtr
FloatChannel::Ptr FloatChannelPtr
static void saveModel(ModelPtr m, std::string file)