12 #include <initializer_list>
14 #include <unordered_map>
15 #include <unordered_set>
102 PointCloud(
const std::unordered_map<std::string, core::Tensor>
103 &map_keys_to_tensors);
308 bool relative =
true);
338 bool invert =
false)
const;
350 bool remove_duplicates =
false)
const;
357 const std::string &reduction =
"mean")
const;
382 const size_t start_index = 0)
const;
392 size_t nb_points,
double search_radius)
const;
402 size_t nb_neighbors,
double std_ratio)
const;
418 bool remove_nan =
true,
bool remove_infinite =
true)
const;
439 const core::Tensor &camera_location,
double radius)
const;
455 bool print_progress =
false)
const;
470 const double distance_threshold = 0.01,
471 const int ransac_n = 3,
472 const int num_iterations = 100,
473 const double probability = 0.99999999)
const;
504 double angle_threshold = 90.0)
const;
531 core::Tensor::Init<float>({0, 0, 1},
555 const double lambda = 0.0,
556 const double cos_alpha_tol = 1.0);
605 float depth_scale = 1000.0f,
606 float depth_max = 3.0f,
608 bool with_normals =
false);
636 const RGBDImage &rgbd_image,
640 float depth_scale = 1000.0f,
641 float depth_max = 3.0f,
643 bool with_normals =
false);
661 float depth_scale = 1000.0f,
662 float depth_max = 3.0f);
671 float depth_scale = 1000.0f,
672 float depth_max = 3.0f);
686 bool invert =
false)
const;
706 double translation = 0.0,
707 bool capping =
true)
const;
716 bool capping =
true)
const;
761 MetricParameters
params = MetricParameters())
const;
cmdLineReadable * params[]
#define AssertTensorShape(tensor,...)
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
A bounding box oriented along an arbitrary frame of reference.
std::string ToString() const
Returns string representation of device, e.g. "CPU:0", "CUDA:0".
int64_t GetLength() const
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
static Tensor Zeros(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with zeros.
Device GetDevice() const override
The Image class stores image with customizable width, height, num of channels and bytes per channel.
RGBDImage is for a pair of registered color and depth images,.
Mix-in class for geometry types that can be visualized.
A point cloud contains a list of 3D points.
void SetPointNormals(const core::Tensor &value)
Set the value of the "normals" attribute. Convenience function.
void OrientNormalsToAlignWithDirection(const core::Tensor &orientation_reference=core::Tensor::Init< float >({0, 0, 1}, core::Device("CPU:0")))
Function to orient the normals of a point cloud.
std::tuple< PointCloud, core::Tensor > RemoveNonFinitePoints(bool remove_nan=true, bool remove_infinite=true) const
Remove all points from the point cloud that have a nan entry, or infinite value. It also removes the ...
std::tuple< core::Tensor, core::Tensor > SegmentPlane(const double distance_threshold=0.01, const int ransac_n=3, const int num_iterations=100, const double probability=0.99999999) const
Segment PointCloud plane using the RANSAC algorithm. This is a wrapper for a CPU implementation and a...
void SetPoints(const core::Tensor &value)
core::Tensor GetCenter() const
Returns the center for point coordinates.
int GaussianSplatGetSHOrder() const
Returns the order of spherical harmonics used for Gaussian Splatting. Returns 0 if f_rest is not pres...
core::Tensor & GetPointAttr(const std::string &key)
const core::Tensor & GetPointColors() const
Get the value of the "colors" attribute. Convenience function.
PointCloud & NormalizeNormals()
Normalize point normals to length 1.
PointCloud & Rotate(const core::Tensor &R, const core::Tensor ¢er)
Rotates the PointPositions and PointNormals (if exists).
core::Tensor & GetPointNormals()
Get the value of the "normals" attribute. Convenience function.
PointCloud VoxelDownSample(double voxel_size, const std::string &reduction="mean") const
Downsamples a point cloud with a specified voxel size.
PointCloud Crop(const AxisAlignedBoundingBox &aabb, bool invert=false) const
Function to crop pointcloud into output pointcloud.
PointCloud operator+(const PointCloud &other) const
PointCloud FarthestPointDownSample(const size_t num_samples, const size_t start_index=0) const
Downsample a pointcloud into output pointcloud with a set of points has farthest distance.
bool HasPointPositions() const
void SetPointColors(const core::Tensor &value)
Set the value of the "colors" attribute. Convenience function.
bool HasPointAttr(const std::string &key) const
const core::Tensor & GetPointNormals() const
Get the value of the "normals" attribute. Convenience function.
bool IsGaussianSplat() const
PointCloud SelectByIndex(const core::Tensor &indices, bool invert=false, bool remove_duplicates=false) const
Select points from input pointcloud, based on indices list into output point cloud.
const core::Tensor & GetPointAttr(const std::string &key) const
core::Tensor GetMaxBound() const
Returns the max bound for point coordinates.
core::Tensor & GetPoints()
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
static PointCloud FromLegacy(const cloudViewer::geometry::PointCloud &pcd_legacy, core::Dtype dtype=core::Float32, const core::Device &device=core::Device("CPU:0"))
Create a PointCloud from a legacy CloudViewer PointCloud.
PointCloud RandomDownSample(double sampling_ratio) const
Downsample a pointcloud by selecting random index point and its attributes.
std::tuple< TriangleMesh, core::Tensor > HiddenPointRemoval(const core::Tensor &camera_location, double radius) const
This is an implementation of the Hidden Point Removal operator described in Katz et....
OrientedBoundingBox GetOrientedBoundingBox() const
Create an oriented bounding box from attribute "positions".
void EstimateNormals(const utility::optional< 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...
void SetPointPositions(const core::Tensor &value)
Set the value of the "positions" attribute. Convenience function.
const core::Tensor & GetPoints() const
Backward-compatible const getter for point positions.
TensorMap & GetPointAttr()
Getter for point_attr_ TensorMap.
core::Tensor GetMinBound() const
Returns the min bound for point coordinates.
int PCAPartition(int max_points)
std::string ToString() const
Text description.
core::Tensor & GetPointPositions()
Get the value of the "positions" attribute. Convenience function.
LineSet ExtrudeRotation(double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const
void OrientNormalsTowardsCameraLocation(const core::Tensor &camera_location=core::Tensor::Zeros({3}, core::Float32, core::Device("CPU:0")))
Function to orient the normals of a point cloud.
std::tuple< PointCloud, core::Tensor > RemoveStatisticalOutliers(size_t nb_neighbors, double std_ratio) const
Remove points that are further away from their nb_neighbor neighbors in average. This function is not...
bool IsEmpty() const override
Returns !HasPointPositions().
PointCloud To(const core::Device &device, bool copy=false) const
PointCloud SelectByMask(const core::Tensor &boolean_mask, bool invert=false) const
Select points from input pointcloud, based on boolean mask indices into output point cloud.
PointCloud UniformDownSample(size_t every_k_points) const
Downsamples a point cloud by selecting every kth index point and its attributes.
virtual ~PointCloud() override
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const
Create an axis-aligned bounding box from attribute "positions".
void EstimateColorGradients(const utility::optional< 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,...
PointCloud & PaintUniformColor(const core::Tensor &color)
Assigns uniform color to the point cloud.
cloudViewer::geometry::PointCloud ToLegacy() const
Convert to a legacy CloudViewer PointCloud.
core::Device GetDevice() const override
Returns the device attribute of this PointCloud.
PointCloud CPU() const
Backward-compatible convenience method to obtain a CPU-resident copy.
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.
LineSet ExtrudeLinear(const core::Tensor &vector, double scale=1.0, bool capping=true) const
const core::Tensor & GetPointPositions() const
Get the value of the "positions" attribute. Convenience function.
std::tuple< PointCloud, core::Tensor > ComputeBoundaryPoints(double radius, int max_nn=30, double angle_threshold=90.0) const
Compute the boundary points of a point cloud. The implementation is inspired by the PCL implementatio...
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.
void RemovePointAttr(const std::string &key)
PointCloud & Translate(const core::Tensor &translation, bool relative=true)
Translates the PointPositions of the PointCloud.
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.
bool HasPointNormals() const
PointCloud Clone() const
Returns copy of the point cloud on the same device.
std::tuple< PointCloud, core::Tensor > RemoveRadiusOutliers(size_t nb_points, double search_radius) const
Remove points that have less than nb_points neighbors in a sphere of a given radius.
std::tuple< PointCloud, core::Tensor > RemoveDuplicatedPoints() const
Remove duplicated points and there associated attributes.
const TensorMap & GetPointAttr() const
Getter for point_attr_ TensorMap. Used in Pybind.
core::Tensor ComputeMetrics(const PointCloud &pcd2, std::vector< Metric > metrics={Metric::ChamferDistance}, MetricParameters params=MetricParameters()) const
PointCloud & Scale(double scale, const core::Tensor ¢er)
Scales the PointPositions of the PointCloud.
PointCloud & Clear() override
Clear all data in the point cloud.
PointCloud Append(const PointCloud &other) const
void SetPointAttr(const std::string &key, const core::Tensor &value)
core::Tensor ClusterDBSCAN(double eps, size_t min_points, bool print_progress=false) const
Cluster PointCloud using the DBSCAN algorithm Ester et al., "A Density-Based Algorithm for Discoverin...
core::Tensor & GetPointColors()
Get the value of the "colors" attribute. Convenience function.
PointCloud(const core::Device &device=core::Device("CPU:0"))
PointCloud & Transform(const core::Tensor &transformation)
Transforms the PointPositions and PointNormals (if exist) of the PointCloud.
bool HasPointColors() const
void OrientNormalsConsistentTangentPlane(size_t k, const double lambda=0.0, const double cos_alpha_tol=1.0)
Function to consistently orient estimated normals based on consistent tangent planes as described in ...
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.
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,...
bool Contains(const std::string &key) const
A triangle mesh contains vertices and triangles.
@ ChamferDistance
Chamfer Distance.
constexpr nullopt_t nullopt
Generic file read and write utility for python interface.