Open3D (C++ API)  0.11.0
Public Member Functions | Static Public Member Functions | Protected Attributes
open3d::t::geometry::PointCloud Class Reference

A pointcloud contains a set of 3D points. More...

#include <PointCloud.h>

Inheritance diagram for open3d::t::geometry::PointCloud:
open3d::t::geometry::Geometry

Public Member Functions

 PointCloud (core::Dtype dtype=core::Dtype::Float32, const core::Device &device=core::Device("CPU:0"))
 Construct an empty pointcloud. More...
 
 PointCloud (const core::TensorList &points)
 
 PointCloud (const std::unordered_map< std::string, core::TensorList > &map_keys_to_tensorlists)
 
virtual ~PointCloud () override
 
const TensorListMapGetPointAttrPybind () const
 Getter for point_attr_ TensorListMap. Used in Pybind. More...
 
void SetPointAttrPybind (const TensorListMap &point_attr)
 Setter for point_attr_ TensorListMap. Used in Pybind. More...
 
core::TensorListGetPointAttr (const std::string &key)
 
core::TensorListGetPoints ()
 Get the value of the "points" attribute. Convenience function. More...
 
core::TensorListGetPointColors ()
 Get the value of the "colors" attribute. Convenience function. More...
 
core::TensorListGetPointNormals ()
 Get the value of the "normals" attribute. Convenience function. More...
 
const core::TensorListGetPointAttr (const std::string &key) const
 
const core::TensorListGetPoints () const
 Get the value of the "points" attribute. Convenience function. More...
 
const core::TensorListGetPointColors () const
 Get the value of the "colors" attribute. Convenience function. More...
 
const core::TensorListGetPointNormals () const
 Get the value of the "normals" attribute. Convenience function. More...
 
void SetPointAttr (const std::string &key, const core::TensorList &value)
 
void SetPoints (const core::TensorList &value)
 Set the value of the "points" attribute. Convenience function. More...
 
void SetPointColors (const core::TensorList &value)
 Set the value of the "colors" attribute. Convenience function. More...
 
void SetPointNormals (const core::TensorList &value)
 Set the value of the "normals" attribute. Convenience function. More...
 
bool HasPointAttr (const std::string &key) const
 
bool HasPoints () const
 
bool HasPointColors () const
 
bool HasPointNormals () const
 
void SynchronizedPushBack (const std::unordered_map< std::string, core::Tensor > &map_keys_to_tensors)
 
PointCloudClear () override
 Clear all data in the pointcloud. More...
 
bool IsEmpty () const override
 Returns !HasPoints(). More...
 
core::Tensor GetMinBound () const
 Returns the min bound for point coordinates. More...
 
core::Tensor GetMaxBound () const
 Returns the max bound for point coordinates. More...
 
core::Tensor GetCenter () const
 Returns the center for point coordinates. More...
 
PointCloudTransform (const core::Tensor &transformation)
 Transforms the points and normals (if exist). More...
 
PointCloudTranslate (const core::Tensor &translation, bool relative=true)
 Translates points. More...
 
PointCloudScale (double scale, const core::Tensor &center)
 Scale points. More...
 
PointCloudRotate (const core::Tensor &R, const core::Tensor &center)
 Rotate points and normals (if exist). More...
 
core::Device GetDevice () const
 
open3d::geometry::PointCloud ToLegacyPointCloud () const
 Convert to a legacy Open3D PointCloud. More...
 
- Public Member Functions inherited from open3d::t::geometry::Geometry
virtual ~Geometry ()
 
GeometryType GetGeometryType () const
 Returns one of registered geometry types. More...
 
int Dimension () const
 Returns whether the geometry is 2D or 3D. More...
 

Static Public Member Functions

static geometry::PointCloud FromLegacyPointCloud (const open3d::geometry::PointCloud &pcd_legacy, core::Dtype dtype=core::Dtype::Float32, const core::Device &device=core::Device("CPU:0"))
 Create a PointCloud from a legacy Open3D PointCloud. More...
 

Protected Attributes

core::Device device_ = core::Device("CPU:0")
 
TensorListMap point_attr_
 

Additional Inherited Members

- Public Types inherited from open3d::t::geometry::Geometry
enum  GeometryType {
  GeometryType::Unspecified = 0, GeometryType::PointCloud = 1, GeometryType::VoxelGrid = 2, GeometryType::Octree = 3,
  GeometryType::LineSet = 4, GeometryType::MeshBase = 5, GeometryType::TriangleMesh = 6, GeometryType::HalfEdgeTriangleMesh = 7,
  GeometryType::Image = 8, GeometryType::RGBDImage = 9, GeometryType::TetraMesh = 10, GeometryType::OrientedBoundingBox = 11,
  GeometryType::AxisAlignedBoundingBox = 12
}
 Specifies possible geometry types. More...
 
- Protected Member Functions inherited from open3d::t::geometry::Geometry
 Geometry (GeometryType type, int dimension)
 Parameterized Constructor. More...
 

Detailed Description

A pointcloud contains a set of 3D points.

The PointCloud class stores the attribute data in key-value pairs for flexibility, where the key is a string representing the attribute name and value is a TensorList containing the attribute data. In most cases, the length of an attribute should be equal to the length of the "points", the pointcloud class provides helper functions to check and facilitates this consistency.

Although the attributes are all stored in a key-value pair dictionary, the attributes have different levels:

Note that the level 0 and level 1 convenience functions can also be achieved via the generalized helper functions:

Constructor & Destructor Documentation

◆ PointCloud() [1/3]

open3d::t::geometry::PointCloud::PointCloud ( core::Dtype  dtype = core::Dtype::Float32,
const core::Device device = core::Device("CPU:0") 
)

Construct an empty pointcloud.

◆ PointCloud() [2/3]

open3d::t::geometry::PointCloud::PointCloud ( const core::TensorList points)

Construct a pointcloud from points.

Parameters
pointsA tensorlist with element shape (3,).
  • The resulting pointcloud will have the same dtype and device as the tensorlist.
  • If the tensorlist is created in-place from a pre-allocated buffer, the tensorlist has a fixed size and thus the resulting pointcloud will have a fixed size and calling to functions like SynchronizedPushBack will raise an exception.

◆ PointCloud() [3/3]

open3d::t::geometry::PointCloud::PointCloud ( const std::unordered_map< std::string, core::TensorList > &  map_keys_to_tensorlists)

Construct from points and other attributes of the points.

Parameters
map_keys_to_tensorlistsA map of string to TensorList containing points and their attributes. point_dict must contain at least the "points" key.

◆ ~PointCloud()

virtual open3d::t::geometry::PointCloud::~PointCloud ( )
inlineoverridevirtual

Member Function Documentation

◆ Clear()

PointCloud& open3d::t::geometry::PointCloud::Clear ( )
inlineoverridevirtual

Clear all data in the pointcloud.

Implements open3d::t::geometry::Geometry.

◆ FromLegacyPointCloud()

geometry::PointCloud open3d::t::geometry::PointCloud::FromLegacyPointCloud ( const open3d::geometry::PointCloud pcd_legacy,
core::Dtype  dtype = core::Dtype::Float32,
const core::Device device = core::Device("CPU:0") 
)
static

Create a PointCloud from a legacy Open3D PointCloud.

◆ GetCenter()

core::Tensor open3d::t::geometry::PointCloud::GetCenter ( ) const

Returns the center for point coordinates.

◆ GetDevice()

core::Device open3d::t::geometry::PointCloud::GetDevice ( ) const
inline

◆ GetMaxBound()

core::Tensor open3d::t::geometry::PointCloud::GetMaxBound ( ) const

Returns the max bound for point coordinates.

◆ GetMinBound()

core::Tensor open3d::t::geometry::PointCloud::GetMinBound ( ) const

Returns the min bound for point coordinates.

◆ GetPointAttr() [1/2]

core::TensorList& open3d::t::geometry::PointCloud::GetPointAttr ( const std::string &  key)
inline

Get attributes. Throws exception if the attribute does not exist.

Parameters
keyAttribute name.

◆ GetPointAttr() [2/2]

const core::TensorList& open3d::t::geometry::PointCloud::GetPointAttr ( const std::string &  key) const
inline

Get attributes. Throws exception if the attribute does not exist.

Parameters
keyAttribute name.

◆ GetPointAttrPybind()

const TensorListMap& open3d::t::geometry::PointCloud::GetPointAttrPybind ( ) const
inline

Getter for point_attr_ TensorListMap. Used in Pybind.

◆ GetPointColors() [1/2]

core::TensorList& open3d::t::geometry::PointCloud::GetPointColors ( )
inline

Get the value of the "colors" attribute. Convenience function.

◆ GetPointColors() [2/2]

const core::TensorList& open3d::t::geometry::PointCloud::GetPointColors ( ) const
inline

Get the value of the "colors" attribute. Convenience function.

◆ GetPointNormals() [1/2]

core::TensorList& open3d::t::geometry::PointCloud::GetPointNormals ( )
inline

Get the value of the "normals" attribute. Convenience function.

◆ GetPointNormals() [2/2]

const core::TensorList& open3d::t::geometry::PointCloud::GetPointNormals ( ) const
inline

Get the value of the "normals" attribute. Convenience function.

◆ GetPoints() [1/2]

core::TensorList& open3d::t::geometry::PointCloud::GetPoints ( )
inline

Get the value of the "points" attribute. Convenience function.

◆ GetPoints() [2/2]

const core::TensorList& open3d::t::geometry::PointCloud::GetPoints ( ) const
inline

Get the value of the "points" attribute. Convenience function.

◆ HasPointAttr()

bool open3d::t::geometry::PointCloud::HasPointAttr ( const std::string &  key) const
inline

Returns true if all of the followings are true: 1) attribute key exist 2) attribute's length as points' length 3) attribute's length > 0

◆ HasPointColors()

bool open3d::t::geometry::PointCloud::HasPointColors ( ) const
inline

Returns true if all of the followings are true: 1) attribute "colors" exist 2) attribute "colors"'s length as points' length 3) attribute "colors"'s length > 0 This is a convenience function.

◆ HasPointNormals()

bool open3d::t::geometry::PointCloud::HasPointNormals ( ) const
inline

Returns true if all of the followings are true: 1) attribute "normals" exist 2) attribute "normals"'s length as points' length 3) attribute "normals"'s length > 0 This is a convenience function.

◆ HasPoints()

bool open3d::t::geometry::PointCloud::HasPoints ( ) const
inline

Check if the "points" attribute's value has length > 0. This is a convenience function.

◆ IsEmpty()

bool open3d::t::geometry::PointCloud::IsEmpty ( ) const
inlineoverridevirtual

Returns !HasPoints().

Implements open3d::t::geometry::Geometry.

◆ Rotate()

PointCloud & open3d::t::geometry::PointCloud::Rotate ( const core::Tensor R,
const core::Tensor center 
)

Rotate points and normals (if exist).

◆ Scale()

PointCloud & open3d::t::geometry::PointCloud::Scale ( double  scale,
const core::Tensor center 
)

Scale points.

◆ SetPointAttr()

void open3d::t::geometry::PointCloud::SetPointAttr ( const std::string &  key,
const core::TensorList value 
)
inline

Set attributes. If the attribute key already exists, its value will be overwritten, otherwise, the new key will be created.

Parameters
keyAttribute name.
valueA tensorlist.

◆ SetPointAttrPybind()

void open3d::t::geometry::PointCloud::SetPointAttrPybind ( const TensorListMap point_attr)
inline

Setter for point_attr_ TensorListMap. Used in Pybind.

◆ SetPointColors()

void open3d::t::geometry::PointCloud::SetPointColors ( const core::TensorList value)
inline

Set the value of the "colors" attribute. Convenience function.

◆ SetPointNormals()

void open3d::t::geometry::PointCloud::SetPointNormals ( const core::TensorList value)
inline

Set the value of the "normals" attribute. Convenience function.

◆ SetPoints()

void open3d::t::geometry::PointCloud::SetPoints ( const core::TensorList value)
inline

Set the value of the "points" attribute. Convenience function.

◆ SynchronizedPushBack()

void open3d::t::geometry::PointCloud::SynchronizedPushBack ( const std::unordered_map< std::string, core::Tensor > &  map_keys_to_tensors)
inline

Synchronized push back, data will be copied. Before push back, all existing tensorlists must have the same length.

Parameters
map_keys_to_tensorsThe keys and values to be pushed back. It must contain the same keys and each corresponding tensor must have the same dtype and device.

◆ ToLegacyPointCloud()

open3d::geometry::PointCloud open3d::t::geometry::PointCloud::ToLegacyPointCloud ( ) const

Convert to a legacy Open3D PointCloud.

◆ Transform()

PointCloud & open3d::t::geometry::PointCloud::Transform ( const core::Tensor transformation)

Transforms the points and normals (if exist).

◆ Translate()

PointCloud & open3d::t::geometry::PointCloud::Translate ( const core::Tensor translation,
bool  relative = true 
)

Translates points.

Field Documentation

◆ device_

core::Device open3d::t::geometry::PointCloud::device_ = core::Device("CPU:0")
protected

◆ point_attr_

TensorListMap open3d::t::geometry::PointCloud::point_attr_
protected

The documentation for this class was generated from the following files: