KrisLibrary
1.0.0
|
A 3D point cloud class. More...
#include <PointCloud.h>
Public Member Functions | |
void | Clear () |
bool | LoadPCL (const char *fn) |
bool | SavePCL (const char *fn) const |
bool | LoadPCL (istream &in) |
bool | SavePCL (ostream &out) const |
void | FromDepthImage (int w, int h, float wfov, float hfov, const std::vector< float > &depths, const std::vector< unsigned int > &rgb, float invalidDepth=0.0) |
Converts a w x h depth image to a structured point cloud. The camera frame is x right, y down, z forward. More... | |
void | FromDepthImage (int w, int h, float wfov, float hfov, float depthscale, const std::vector< unsigned short > &depths, const std::vector< unsigned int > &rgb, unsigned short invalidDepth=0) |
Converts a w x h depth image to a structured point cloud. The camera frame is x right, y down, z forward. More... | |
void | GetAABB (Vector3 &bmin, Vector3 &bmax) const |
Returns the bounding box of the point set. | |
void | Transform (const Matrix4 &mat) |
Transforms all points and, if present, normals. | |
bool | IsStructured () const |
A structured point cloud has settings "width" and "height". Invalid points are marked as (0,0,0) (preferred) or (nan,nan,nan) | |
int | GetStructuredWidth () const |
int | GetStructuredHeight () const |
void | SetStructured (int w, int h) |
Vector3 | GetOrigin () const |
void | SetOrigin (const Vector3 &origin) |
RigidTransform | GetViewpoint () const |
void | SetViewpoint (const RigidTransform &T) |
int | PropertyIndex (const string &name) const |
bool | HasProperty (const string &name) const |
bool | GetProperty (const string &name, vector< Real > &items) const |
Returns a vector giving all of the points' values of the given property. More... | |
int | SetProperty (const string &name, const vector< Real > &items) |
Sets property from a vector giving all of the points' values of the given property. More... | |
void | RemoveProperty (const string &name) |
Removes a property and its channel. Relatively expensive (O(nm)). | |
void | GetSubCloud (const Vector3 &bmin, const Vector3 &bmax, PointCloud3D &subcloud) |
Extracts all points within the bounding box [bmin,bmax]. | |
void | GetSubCloud (const string &property, Real value, PointCloud3D &subcloud) |
Extracts all points with the named property = value. | |
void | GetSubCloud (const string &property, Real minValue, Real maxValue, PointCloud3D &subcloud) |
Extracts all points with the minValue <= named property <= maxValue. | |
bool | HasXYZAsProperties () const |
Some point clouds have properties x, y, and z rather than specifying points. | |
void | SetXYZAsProperties (bool) |
Convert to/from x, y, z as properties vs points. | |
bool | HasNormals () const |
bool | GetNormals (vector< Vector3 > &normals) const |
void | SetNormals (const vector< Vector3 > &normals) |
void | ComputeNormals (Real radius=0) |
bool | HasColor () const |
bool | HasOpacity () const |
bool | HasRGB () const |
bool | HasRGBA () const |
bool | UnpackColorChannels (bool alpha=false) |
Converts rgb or rgba packed color channels to r,g,b / r,g,b,a channels. Removes old channels. | |
bool | PackColorChannels (const char *fmt="rgba") |
Converts unpacked color channels into packed channel. fmt is the desired property, either "rgb" or "rgba". Removes old channels. | |
bool | GetColors (vector< Real > &r, vector< Real > &g, vector< Real > &b, vector< Real > &a) const |
bool | GetColors (vector< Vector4 > &rgba) const |
void | SetColors (const vector< Real > &r, const vector< Real > &g, const vector< Real > &b, bool includeAlpha=false) |
void | SetColors (const vector< Real > &r, const vector< Real > &g, const vector< Real > &b, const vector< Real > &a, bool includeAlpha=true) |
void | SetColors (const vector< Vector4 > &rgba, bool includeAlpha=true) |
bool | HasUV () const |
bool | GetUV (vector< Vector2 > &uvs) const |
void | SetUV (const vector< Vector2 > &uvs) |
Public Attributes | |
vector< Vector3 > | points |
vector< string > | propertyNames |
vector< Vector > | properties |
PropertyMap | settings |
A 3D point cloud class.
Points may have optional associated floating point properties like ID, color, normal, etc. These are named in propertyNames and each element of the properties vector is a Vector of length propertyNames.size(). A user needs to manually maintain properties.size()==points.size().
The point cloud itself may also have associated settings, as given by the settings map. Standard properties include:
Standard properties (adopted from PCL) include:
void Meshing::PointCloud3D::ComputeNormals | ( | Real | radius = 0 | ) |
Computes normals. Uses the structured point cloud (centered difference) or an unstructured point cloud. In the latter case, the given radius is used for normal estimation (locally weighted regression)
void PointCloud3D::FromDepthImage | ( | int | w, |
int | h, | ||
float | wfov, | ||
float | hfov, | ||
const std::vector< float > & | depths, | ||
const std::vector< unsigned int > & | rgb, | ||
float | invalidDepth = 0.0 |
||
) |
Converts a w x h depth image to a structured point cloud. The camera frame is x right, y down, z forward.
void PointCloud3D::FromDepthImage | ( | int | w, |
int | h, | ||
float | wfov, | ||
float | hfov, | ||
float | depthscale, | ||
const std::vector< unsigned short > & | depths, | ||
const std::vector< unsigned int > & | rgb, | ||
unsigned short | invalidDepth = 0 |
||
) |
Converts a w x h depth image to a structured point cloud. The camera frame is x right, y down, z forward.
bool PointCloud3D::GetProperty | ( | const string & | name, |
vector< Real > & | items | ||
) | const |
Returns a vector giving all of the points' values of the given property.
If the property doesn't exist, returns false.
Result has length points.size().
Referenced by GLDraw::GeometryAppearance::Refresh().
int PointCloud3D::SetProperty | ( | const string & | name, |
const vector< Real > & | items | ||
) |
Sets property from a vector giving all of the points' values of the given property.
If the property doesn't exist, then it will be added. The index of the given property is returned.
items must have size points.size().