30 #include <unordered_map>
31 #include <unordered_set>
115 PointCloud(
const std::unordered_map<std::string, core::Tensor>
116 &map_keys_to_tensors);
297 bool relative =
true);
332 const int max_nn = 30,
343 const int max_nn = 30,
376 float depth_scale = 1000.0f,
377 float depth_max = 3.0f,
379 bool with_normals =
false);
411 float depth_scale = 1000.0f,
412 float depth_max = 3.0f,
414 bool with_normals =
false);
432 float depth_scale = 1000.0f,
433 float depth_max = 3.0f);
442 float depth_scale = 1000.0f,
443 float depth_max = 3.0f);
#define LogError(...)
Definition: Logging.h:67
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:77
size_t stride
Definition: TriangleMeshBuffers.cpp:184
std::string ToString() const
Definition: Device.h:75
int64_t GetLength() const
Definition: Tensor.h:1089
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:392
Device GetDevice() const
Definition: Tensor.cpp:1365
A point cloud consists of point coordinates, and optionally point colors and point normals.
Definition: PointCloud.h:55
Mix-in class for geometry types that can be visualized.
Definition: DrawableGeometry.h:38
The base geometry class.
Definition: Geometry.h:38
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:48
A point cloud contains a list of 3D points.
Definition: PointCloud.h:95
core::Tensor & GetPointAttr(const std::string &key)
Definition: PointCloud.h:129
bool HasPointAttr(const std::string &key) const
Definition: PointCloud.h:199
PointCloud & Clear() override
Clear all data in the point cloud.
Definition: PointCloud.h:240
PointCloud & Rotate(const core::Tensor &R, const core::Tensor ¢er)
Rotates the PointPositions and PointNormals (if exists).
Definition: PointCloud.cpp:202
const core::Tensor & GetPointPositions() const
Get the value of the "positions" attribute. Convenience function.
Definition: PointCloud.h:150
geometry::RGBDImage ProjectToRGBDImage(int width, int height, const core::Tensor &intrinsics, const core::Tensor &extrinsics=core::Tensor::Eye(4, core::Float32, core::Device("CPU:0")), float depth_scale=1000.0f, float depth_max=3.0f)
Project a point cloud to an RGBD image.
Definition: PointCloud.cpp:552
bool HasPointPositions() const
Definition: PointCloud.h:212
bool HasPointColors() const
Definition: PointCloud.h:219
PointCloud & Scale(double scale, const core::Tensor ¢er)
Scales the PointPositions of the PointCloud.
Definition: PointCloud.cpp:192
const core::Tensor & GetPointAttr(const std::string &key) const
Definition: PointCloud.h:145
core::Tensor & GetPointNormals()
Get the value of the "normals" attribute. Convenience function.
Definition: PointCloud.h:140
core::Device device_
Definition: PointCloud.h:446
core::Device GetDevice() const
Returns the device attribute of this PointCloud.
Definition: PointCloud.h:321
PointCloud To(const core::Device &device, bool copy=false) const
Definition: PointCloud.cpp:108
geometry::Image ProjectToDepthImage(int width, int height, const core::Tensor &intrinsics, const core::Tensor &extrinsics=core::Tensor::Eye(4, core::Float32, core::Device("CPU:0")), float depth_scale=1000.0f, float depth_max=3.0f)
Project a point cloud to a depth image.
Definition: PointCloud.cpp:535
void SetPointPositions(const core::Tensor &value)
Set the value of the "positions" attribute. Convenience function.
Definition: PointCloud.h:178
void SetPointColors(const core::Tensor &value)
Set the value of the "colors" attribute. Convenience function.
Definition: PointCloud.h:184
TensorMap point_attr_
Definition: PointCloud.h:447
void EstimateColorGradients(const int max_nn=30, const utility::optional< double > radius=utility::nullopt)
Function to compute point color gradients. If radius is provided, then HybridSearch is used,...
Definition: PointCloud.cpp:320
const core::Tensor & GetPointColors() const
Get the value of the "colors" attribute. Convenience function.
Definition: PointCloud.h:155
bool IsEmpty() const override
Returns !HasPointPositions().
Definition: PointCloud.h:246
PointCloud VoxelDownSample(double voxel_size, const core::HashBackendType &backend=core::HashBackendType::Default) const
Downsamples a point cloud with a specified voxel size.
Definition: PointCloud.cpp:215
open3d::geometry::PointCloud ToLegacy() const
Convert to a legacy Open3D PointCloud.
Definition: PointCloud.cpp:607
core::Tensor & GetPointColors()
Get the value of the "colors" attribute. Convenience function.
Definition: PointCloud.h:137
PointCloud Append(const PointCloud &other) const
Definition: PointCloud.cpp:121
const core::Tensor & GetPointNormals() const
Get the value of the "normals" attribute. Convenience function.
Definition: PointCloud.h:160
core::Tensor GetMinBound() const
Returns the min bound for point coordinates.
Definition: PointCloud.cpp:96
static PointCloud CreateFromRGBDImage(const RGBDImage &rgbd_image, const core::Tensor &intrinsics, const core::Tensor &extrinsics=core::Tensor::Eye(4, core::Float32, core::Device("CPU:0")), float depth_scale=1000.0f, float depth_max=3.0f, int stride=1, bool with_normals=false)
Factory function to create a point cloud from an RGB-D image and a camera model.
Definition: PointCloud.cpp:508
static PointCloud CreateFromDepthImage(const Image &depth, const core::Tensor &intrinsics, const core::Tensor &extrinsics=core::Tensor::Eye(4, core::Float32, core::Device("CPU:0")), float depth_scale=1000.0f, float depth_max=3.0f, int stride=1, bool with_normals=false)
Factory function to create a point cloud from a depth image and a camera model.
Definition: PointCloud.cpp:478
void EstimateNormals(const int max_nn=30, const utility::optional< double > radius=utility::nullopt)
Function to estimate point normals. If the point cloud normals exist, the estimated normals are orien...
Definition: PointCloud.cpp:244
virtual ~PointCloud() override
Definition: PointCloud.h:118
PointCloud Clone() const
Returns copy of the point cloud on the same device.
Definition: PointCloud.cpp:119
void RemovePointAttr(const std::string &key)
Definition: PointCloud.h:208
core::Tensor & GetPointPositions()
Get the value of the "positions" attribute. Convenience function.
Definition: PointCloud.h:134
PointCloud & Transform(const core::Tensor &transformation)
Transforms the PointPositions and PointNormals (if exist) of the PointCloud.
Definition: PointCloud.cpp:167
std::string ToString() const
Text description.
Definition: PointCloud.cpp:75
PointCloud(const core::Device &device=core::Device("CPU:0"))
Definition: PointCloud.cpp:50
core::Tensor GetCenter() const
Returns the center for point coordinates.
Definition: PointCloud.cpp:104
static PointCloud FromLegacy(const open3d::geometry::PointCloud &pcd_legacy, core::Dtype dtype=core::Float32, const core::Device &device=core::Device("CPU:0"))
Create a PointCloud from a legacy Open3D PointCloud.
Definition: PointCloud.cpp:584
PointCloud operator+(const PointCloud &other) const
Definition: PointCloud.h:266
const TensorMap & GetPointAttr() const
Getter for point_attr_ TensorMap. Used in Pybind.
Definition: PointCloud.h:124
core::Tensor GetMaxBound() const
Returns the max bound for point coordinates.
Definition: PointCloud.cpp:100
void SetPointAttr(const std::string &key, const core::Tensor &value)
Definition: PointCloud.h:169
void SetPointNormals(const core::Tensor &value)
Set the value of the "normals" attribute. Convenience function.
Definition: PointCloud.h:190
bool HasPointNormals() const
Definition: PointCloud.h:226
PointCloud & Translate(const core::Tensor &translation, bool relative=true)
Translates the PointPositions of the PointCloud.
Definition: PointCloud.cpp:178
RGBDImage A pair of color and depth images.
Definition: RGBDImage.h:40
Definition: TensorMap.h:49
std::size_t Erase(const std::string key)
Erase elements for the TensorMap by key value, if the key exists. If the key does not exists,...
Definition: TensorMap.h:100
bool Contains(const std::string &key) const
Definition: TensorMap.h:134
Definition: Optional.h:278
HashBackendType
Definition: HashMap.h:38
const Dtype Float32
Definition: Dtype.cpp:61
constexpr nullopt_t nullopt
Definition: Optional.h:171
Definition: PinholeCameraIntrinsic.cpp:35