Go to the documentation of this file.
14 py::class_<DataPoints> pyDataPoints(p_class,
"DataPoints");
16 pyDataPoints.doc() = R
"pbdoc(
19 For every point, it has features and, optionally, descriptors.
20 Features are typically the coordinates of the point in the space.
21 Descriptors contain information attached to the point, such as its color, its normal vector, etc.
22 In both features and descriptors, every point can have multiple channels.
23 Every channel has a dimension and a name.
24 For instance, a typical 3D cloud might have the channels \c x, \c y, \c z, \c w of dimension 1 as features (using homogeneous coordinates), and the channel \c normal of size 3 as descriptor.
25 There are no sub-channels, such as \c normal.x, for the sake of simplicity.
26 Moreover, the position of the points is in homogeneous coordinates because they need both translation and rotation, while the normals need only rotation.
27 All channels contain scalar values of type ScalarType.)pbdoc";
29 py::class_<Label>(pyDataPoints, "Label").def_readwrite(
"text", &
Label::text,
"name of the label")
30 .def_readwrite(
"span", &
Label::span,
"number of data dimensions the label spans")
32 .def(py::init<const std::string&, const size_t>(), py::arg(
"text") =
"", py::arg(
"span") = 0)
33 .def(
"__eq__", &Label::operator==, py::arg(
"that"));
35 py::bind_vector<Labels>(pyDataPoints,
"Labels",
"A vector of Label")
36 .def(py::init<>(),
"Construct empty Labels")
37 .def(py::init<const Label&>(), py::arg(
"label"),
"Construct Labels with a single Label in it")
39 .def(
"contains", &
Labels::contains, py::arg(
"text"),
"Return whether there is a label named text")
40 .def(
"totalDim", &
Labels::totalDim,
"Return the sum of the spans of each label")
41 .def(
"__str__", [](
const Labels&
self)
43 std::ostringstream oss;
49 py::register_exception<InvalidField>(pyDataPoints,
"InvalidField");
55 .def(py::init<const Labels&, const Labels&, const size_t>(), py::arg(
"featureLabels"), py::arg(
"descriptorLabels"), py::arg(
"pointCount"))
57 .def(py::init<const Labels&, const Labels&, const Labels&, const size_t>(), py::arg(
"featureLabels"), py::arg(
"descriptorLabels"), py::arg(
"timeLabels"), py::arg(
"pointCount"))
60 .def(py::init<const DataPoints&>())
63 .def(py::init<const Matrix&, const Labels&>(), py::arg(
"features"), py::arg(
"featureLabels"))
65 .def(py::init<const Matrix&, const Labels&, const Matrix&, const Labels&>(), py::arg(
"features"), py::arg(
"featureLabels"), py::arg(
"descriptors"), py::arg(
"descriptorLabels"))
67 .def(py::init<const Matrix&, const Labels&, const Matrix&, const Labels&, const PM::Int64Matrix&, const Labels&>(), py::arg(
"features"), py::arg(
"featureLabels"), py::arg(
"descriptors"), py::arg(
"descriptorLabels"), py::arg(
"times"), py::arg(
"timeLabels"))
69 .def(
"__eq__", &DataPoints::operator==, py::arg(
"that"))
76 .def(
"save", &
DataPoints::save, py::arg(
"fileName"), py::arg(
"binary") =
false, py::arg(
"precision") = 6)
167 .def_readwrite(
"times", &
DataPoints::times,
"time associated to each points, might be empty")
bool timeExists(const std::string &name) const
Look if a time with a given name exist.
unsigned getNbGroupedDescriptors() const
Return the number of grouped descriptors (e.g., normals can have 3 components but would count as only...
Labels descriptorLabels
labels of descriptors
void swapCols(Index iCol, Index jCol)
Swap column i and j in the point cloud, swap also features and descriptors if any....
std::string text
name of the label
unsigned getEuclideanDim() const
Return the dimension of the point cloud.
void addTime(const std::string &name, const Int64Matrix &newTime)
Add a time by name, remove first if already exists.
void assertDescriptorConsistency() const
Assert if descriptors are not consistent with features.
void removeFeature(const std::string &name)
Remove a feature 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...
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...
void allocateDescriptor(const std::string &name, const unsigned dim)
Makes sure a descriptor of a given name exists, if present, check its dimensions.
bool descriptorExists(const std::string &name) const
Look if a descriptor with a given name exist.
void addDescriptor(const std::string &name, const Matrix &newDescriptor)
Add a descriptor by name, remove first if already exists.
Matrix getDescriptorCopyByName(const std::string &name) const
Get descriptor by name, return a matrix containing a copy of the requested descriptor.
unsigned getTimeDim() const
Return the total number of times.
Int64Matrix getTimeCopyByName(const std::string &name) const
Get time by name, return a matrix containing a copy of the requested time.
void allocateFeatures(const Labels &newLabels)
Make sure a vector of features of given names exist.
unsigned getDescriptorStartingRow(const std::string &name) const
Return the starting row of a descriptor with a given name. Return 0 if the name is not found.
unsigned getHomogeneousDim() const
Return the dimension of the point cloud in homogeneous coordinates (one more than Euclidean dimension...
Labels timeLabels
labels of times.
unsigned getTimeDimension(const std::string &name) const
Return the dimension of a time with a given name. Return 0 if the name is not found.
unsigned getFeatureDimension(const std::string &name) const
Return the dimension of a feature with a given name. Return 0 if the name is not found.
const typedef Eigen::Block< const Int64Matrix > TimeConstView
a view on a const time
An exception thrown when one tries to access features or descriptors unexisting or of wrong dimension...
ConstView getFeatureViewByName(const std::string &name) const
Get a const view on a feature by name, throw an exception if it does not exist.
bool featureExists(const std::string &name) const
Look if a feature with a given name exist.
void allocateTime(const std::string &name, const unsigned dim)
Makes sure a time of a given name exists, if present, check its dimensions.
void allocateFeature(const std::string &name, const unsigned dim)
Makes sure a feature of a given name exists, if present, check its dimensions.
Labels featureLabels
labels of features
void setColFrom(Index thisCol, const DataPoints &that, Index thatCol)
Set column thisCol equal to column thatCol of that, copy features and descriptors if any....
DataPoints createSimilarEmpty() const
Create an empty DataPoints of similar dimensions and labels for features, descriptors and times.
Matrix descriptors
descriptors of points in the cloud, might be empty
Eigen::Block< Int64Matrix > TimeView
A view on a time.
ConstView getFeatureRowViewByName(const std::string &name, const unsigned row) const
Get a const view on a feature row by name and number, throw an exception if it does not exist.
TimeConstView getTimeViewByName(const std::string &name) const
Get a const view on a time by name, throw an exception if it does not exist.
void assertTimesConsistency() const
Assert if times are not consistent with features.
unsigned getNbPoints() const
Return the number of points contained in the point cloud.
Matrix features
features of points in the cloud
const typedef Eigen::Block< const Matrix > ConstView
A view on a const feature or const descriptor.
Matrix::Index Index
An index to a row or a column.
void pybindDataPoints(py::class_< PM > &p_class)
bool contains(const std::string &text) const
Return whether there is a label named text.
Int64Matrix times
time associated to each points, might be empty
void allocateTimes(const Labels &newLabels)
Make sure a vector of time of given names exist.
void removeTime(const std::string &name)
Remove a descriptor by name, the whole matrix will be copied.
void removeDescriptor(const std::string &name)
Remove a descriptor by name, the whole matrix will be copied.
void save(const std::string &fileName, bool binary=false, unsigned precision=7) const
Save a point cloud to a file, determine format from extension.
unsigned getTimeStartingRow(const std::string &name) const
Return the starting row of a time with a given name. Return 0 if the name is not found.
size_t span
number of data dimensions the label spans
unsigned getDescriptorDimension(const std::string &name) const
Return the dimension of a descriptor with a given name. Return 0 if the name is not found.
unsigned getDescriptorDim() const
Return the total number of descriptors.
Eigen::Block< Matrix > View
A view on a feature or descriptor.
void conservativeResize(Index pointCount)
Resize the cloud to pointCount points, conserving existing ones.
ConstView getDescriptorRowViewByName(const std::string &name, const unsigned row) const
Get a const view on a descriptor row by name and number, throw an exception if it does not exist.
size_t totalDim() const
Return the sum of the spans of each label.
TimeConstView getTimeRowViewByName(const std::string &name, const unsigned row) const
Get a const view on a time row by name and number, throw an exception if it does not exist.
static DataPoints load(const std::string &fileName)
Load a point cloud from a file, determine format from extension.
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 getFeatureStartingRow(const std::string &name) const
Return the starting row of a feature with a given name. Return 0 if the name is not found.
Matrix getFeatureCopyByName(const std::string &name) const
Get feature by name, return a matrix containing a copy of the requested feature.
void allocateDescriptors(const Labels &newLabels)
Make sure a vector of descriptors of given names exist.