Skip to content

Commit a514125

Browse files
feat: add cropping capability to DFPointCloud
1 parent 3c90378 commit a514125

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/diffCheck/geometry/DFPointCloud.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ namespace diffCheck::geometry
216216
this->Normals.push_back(normal);
217217
}
218218

219+
void DFPointCloud::Crop(const Eigen::Vector3d &minBound, const Eigen::Vector3d &maxBound)
220+
{
221+
auto O3DPointCloud = this->Cvt2O3DPointCloud();
222+
auto O3DPointCloudCropped = O3DPointCloud->Crop(open3d::geometry::AxisAlignedBoundingBox(minBound, maxBound));
223+
this->Points.clear();
224+
for (auto &point : O3DPointCloudCropped->points_)
225+
this->Points.push_back(point);
226+
this->Colors.clear();
227+
for (auto &color : O3DPointCloudCropped->colors_)
228+
this->Colors.push_back(color);
229+
this->Normals.clear();
230+
for (auto &normal : O3DPointCloudCropped->normals_)
231+
this->Normals.push_back(normal);
232+
}
233+
219234
void DFPointCloud::UniformDownsample(int everyKPoints)
220235
{
221236
auto O3DPointCloud = this->Cvt2O3DPointCloud();

src/diffCheck/geometry/DFPointCloud.hh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ namespace diffCheck::geometry
8989
*/
9090
void RemoveStatisticalOutliers(int nbNeighbors, double stdRatio);
9191

92+
/**
93+
* @brief Crop the point cloud to a bounding box defined by the min and max bounds
94+
*
95+
* @param minBound the minimum bound of the bounding box as an Eigen::Vector3d
96+
* @param maxBound the maximum bound of the bounding box as an Eigen::Vector3d
97+
*/
98+
void Crop(const Eigen::Vector3d &minBound, const Eigen::Vector3d &maxBound);
99+
92100
public: ///< Downsamplers
93101
/**
94102
* @brief Downsample the point cloud with voxel grid

0 commit comments

Comments
 (0)