Skip to content

Commit fa5937e

Browse files
authored
Merge pull request #58 from davidcaron/fix-downsampling-with-attribs
Fix downsampling with attributes
2 parents cf0c166 + 9139fe1 commit fa5937e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/sample_point_cloud.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ struct AccumulatedPoint {
3838
void AddPoint(const PointT& point, const AttribVecT& attrib) {
3939
point_ += point;
4040
if (attrib.cols() > 0) {
41+
if (attrib_.cols() == 0) {
42+
attrib_.resize(1, attrib.cols());
43+
}
4144
attrib_ += attrib;
4245
}
4346
num_of_points_ += 1;

tests/test_examples.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def test_downsample_point_cloud_on_voxel_grid(self):
106106
self.assertEqual(nms.shape, pts.shape)
107107
self.assertGreater(pts.shape[0], 0)
108108
self.assertEqual(pts.shape[1], 3)
109+
self.assertGreater(abs(nms[0, 0]), 1e-7)
109110

110111
# With RBG colors
111112
c = np.random.rand(v.shape[0], 3)

0 commit comments

Comments
 (0)