CropBoxFilter.cpp
Go to the documentation of this file.
1 
21 
22 #include <vector>
23 #include <set>
24 
25 namespace next_best_view {
26 
27  CropBoxFilter::CropBoxFilter(const std::string &xml_path) : GeneralFilter() {
29  }
30 
32 
33  ObjectPointCloudPtr inputObjectPointCloudPtr = this->getInputCloud();
34  ObjectPointCloudPtr processingPointCloudPtr = nullptr;
35 
36  if (getIndices() == nullptr) {
37  processingPointCloudPtr = inputObjectPointCloudPtr;
38  } else {
39  processingPointCloudPtr = ObjectPointCloudPtr(new ObjectPointCloud(*inputObjectPointCloudPtr, *getIndices()));
40  }
41 
42  //Filter the point cloud
43  auto result = boost::make_shared<std::set<int>>();
44  for (CropBoxWrapperPtr cropBoxWrapper : *mCropBoxPtrList) {
45  IndicesPtr filteredObjectIndices = IndicesPtr(new Indices());
46  CropBoxPtr cropBoxPtr = cropBoxWrapper->getCropBox();
47  cropBoxPtr->setInputCloud(processingPointCloudPtr);
48  cropBoxPtr->filter(*filteredObjectIndices);
49  // put all filtered objects into the result set
50  result->insert(filteredObjectIndices->begin(), filteredObjectIndices->end());
51  }
52 
53  // put result set into indicesPtr vector
54  std::copy(result->begin(), result->end(), std::back_inserter(*indicesPtr));
55  }
56 
58  return mCropBoxPtrList;
59  }
60 }
boost::shared_ptr< std::vector< CropBoxWrapperPtr > > getCropBoxWrapperPtrList()
getCropBoxPtrList
static boost::shared_ptr< std::vector< CropBoxWrapperPtr > > readCropBoxDataFromXMLFile(const std::string &xml_path)
readCropBoxDataFromXMLFile reads the given xml file and returns a list of CropBoxWrapper.
pcl::PointCloud< ObjectPoint > ObjectPointCloud
Definition: typedef.hpp:85
void doFiltering(IndicesPtr &indicesPtr)
doFiltering Does the actual filtering. setInputCloud(...) must be called before.
CropBoxFilter(const std::string &xml_path)
CropBoxFilter.
virtual ObjectPointCloudPtr & getInputCloud()
Definition: CommonClass.cpp:31
std::vector< int > Indices
Definition: typedef.hpp:117
this namespace contains all generally usable classes.
boost::shared_ptr< std::vector< CropBoxWrapperPtr > > mCropBoxPtrList
CropBox::Ptr CropBoxPtr
Definition: typedef.hpp:106
boost::shared_ptr< Indices > IndicesPtr
Definition: typedef.hpp:118
virtual IndicesPtr & getIndices()
Definition: CommonClass.cpp:39
ObjectPointCloud::Ptr ObjectPointCloudPtr
Definition: typedef.hpp:86


asr_next_best_view
Author(s): Aumann Florian, Borella Jocelyn, Heller Florian, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij
autogenerated on Thu Jan 9 2020 07:20:18