10 TEST(PointCloudTest, CopyConstructor2D)
21 TEST(PointCloudTest, FeatureConstructor2D)
31 TEST(PointCloudTest, FeatureConstructor3D)
80 TEST(PointCloudTest, ConstructorWithData)
82 const int nbPoints = 100;
83 const int dimFeatures = 4;
84 const int dimDescriptors = 3;
85 const int dimTime = 2;
87 PM::Matrix randFeat = PM::Matrix::Random(dimFeatures, nbPoints);
92 featLabels.push_back(
DP::Label(
"pad", 1));
94 PM::Matrix randDesc = PM::Matrix::Random(dimDescriptors, nbPoints);
96 descLabels.push_back(
DP::Label(
"dummyDesc", 3));
100 timeLabels.push_back(
DP::Label(
"dummyTime", 2));
103 DP pointCloud =
DP(randFeat, featLabels, randDesc, descLabels, randTimes, timeLabels);
116 TEST(PointCloudTest, ConcatenateFeatures2D)
132 TEST(PointCloudTest, ConcatenateFeatures3D)
148 TEST(PointCloudTest, ConcatenateDescSame)
158 PM::Matrix::Random(5, leftPoints),
159 Labels(Label(
"Desc5D", 5))
164 PM::Matrix::Random(5, rightPoints),
165 Labels(Label(
"Desc5D", 5))
169 EXPECT_TRUE(lefts.descriptors.cols() == lefts.features.cols());
172 TEST(PointCloudTest, ConcatenateDescSame2)
180 const int leftPoints(ref3DCopy.
features.cols() / 2);
181 const int rightPoints(ref3DCopy.
features.cols() - leftPoints);
183 ref3DCopy.
features.leftCols(leftPoints),
189 ref3DCopy.
features.rightCols(rightPoints),
198 TEST(PointCloudTest, ConcatenateDescDiffName)
208 PM::Matrix::Random(5, leftPoints),
209 Labels(Label(
"MyDesc5D", 5))
214 PM::Matrix::Random(5, rightPoints),
215 Labels(Label(
"YourDesc5D", 5))
222 TEST(PointCloudTest, ConcatenateDescDiffSize)
232 PM::Matrix::Random(3, leftPoints),
233 Labels(Label(
"DescND", 3))
238 PM::Matrix::Random(5, rightPoints),
239 Labels(Label(
"DescND", 5))
244 TEST(PointCloudTest, AssertConsistency)
252 PM::DataPoints::Labels labels;
253 labels.push_back(PM::DataPoints::Label(
"FakeDesc", 2));
259 PM::Matrix descriptors = PM::Matrix::Random(2, 10);
265 descriptors = PM::Matrix::Random(1, ref2DCopy.
getNbPoints());
292 TEST(PointCloudTest, AddRemove)
295 const int testedValue = 9;
309 EXPECT_EQ(newFeatureView(0,0), testedValue);
319 const int testedValue2 = 88;
332 EXPECT_EQ(newDescriptor4DView(0,0), testedValue);
334 EXPECT_EQ(newDescriptor2DView(0,0), testedValue2);
TEST(PointCloudTest, CopyConstructor2D)
#define EXPECT_THROW(statement, expected_exception)
Matrix descriptors
descriptors of points in the cloud, might be empty
void assertDescriptorConsistency() const
Assert if descriptors are not consistent with features.
ConstView getDescriptorViewByName(const std::string &name) const
Get a const view on a descriptor by name, throw an exception if it does not exist.
unsigned getNbPoints() const
Return the number of points contained in the point cloud.
unsigned getNbGroupedDescriptors() const
Return the number of grouped descriptors (e.g., normals can have 3 components but would count as only...
Labels featureLabels
labels of features
The name for a certain number of dim.
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dense matrix over ScalarType.
unsigned getHomogeneousDim() const
Return the dimension of the point cloud in homogeneous coordinates (one more than Euclidean dimension...
Functions and classes that are not dependant on scalar type are defined in this namespace.
void removeDescriptor(const std::string &name)
Remove a descriptor by name, the whole matrix will be copied.
void concatenate(const DataPoints &dp)
Add another point cloud after the current one. Faster merge will be achieved if all descriptor and ti...
Eigen::Matrix< std::int64_t, Eigen::Dynamic, Eigen::Dynamic > Int64Matrix
A dense signed 64-bits matrix.
#define EXPECT_EQ(expected, actual)
void addFeature(const std::string &name, const Matrix &newFeature)
Add a feature by name, remove first if already exists. The 'pad' field will stay at the end for homog...
Eigen::Block< Matrix > View
A view on a feature or descriptor.
An exception thrown when one tries to access features or descriptors unexisting or of wrong dimension...
Int64Matrix times
time associated to each points, might be empty
#define EXPECT_TRUE(condition)
#define EXPECT_NO_THROW(statement)
Matrix features
features of points in the cloud
unsigned getDescriptorDim() const
Return the total number of descriptors.
#define EXPECT_FALSE(condition)
void addDescriptor(const std::string &name, const Matrix &newDescriptor)
Add a descriptor by name, remove first if already exists.
unsigned getEuclideanDim() const
Return the dimension of the point cloud.
void removeFeature(const std::string &name)
Remove a feature by name, the whole matrix will be copied.
Labels descriptorLabels
labels of descriptors
ConstView getFeatureViewByName(const std::string &name) const
Get a const view on a feature by name, throw an exception if it does not exist.