CVBpy 14.0
SparsePointCloud Class Reference

A sparse Cartesian 3D point cloud object. More...

Inherits PointCloud.

Public Member Functions

cvb.SparsePointCloud crop (self, cvb.Cuboid clip_box)
 Creates a new point cloud which only consists of the points inside the clip box. More...
 
cvb.SparsePointCloud from_dense_point_cloud (cvb.DensePointCloud dense_point_cloud)
 Creates a sparse point cloud from a dense point cloud with confidence plane. More...
 
cvb.SparsePointCloud frustum_crop (self, cvb.Cuboid clip_box, cvb.Angle theta, cvb.Angle phi)
 Creates a new point cloud which only consists of the points inside the clip box. More...
 
cvb.SparsePointCloud plane_crop (self, cvb.Plane3D plane, cvb.NumberRange range, int crop_range)
 Creates a new point cloud where points within or outside a range parallel to given plane are cropped. More...
 
Tuple[cvb.DensePointCloud, int] to_dense_point_cloud (self, int conversion_mode=cvb.ConversionMode.Automatic)
 Creates a dense point cloud from a sparse point cloud. More...
 
- Public Member Functions inherited from PointCloud
cvb.Cuboid calculate_bounding_box (self)
 Calculates the minimum and maximum extent of the point cloud. More...
 
cvb.Point3D calculate_center_of_gravity (self)
 Gets the center of gravity of the point cloud. More...
 
cvb.Matrix3D calculate_covariance_matrix (self)
 Get the covariance matrix of the point cloud. More...
 
Union[cvb.DensePointCloud, cvb.SparsePointCloudconvert (self, int flags)
 Creates a new point cloud, which is a copy from this point cloud, but with possibly different data type and number of components. More...
 
Union[cvb.DensePointCloud, cvb.SparsePointClouddown_sample (self, int mode, int value)
 Creates a new point cloud which has several points being removed dependent on the down sample mode and value. More...
 
Union[cvb.DensePointCloud, cvb.SparsePointCloudduplicate (self)
 Creates a new point cloud which is a copy from this point cloud. More...
 
cvb.Plane3D fit_plane (self, Optional[cvb.Cuboid] aoi)
 Fits a plane in the points of the point cloud. More...
 
Union[cvb.DensePointCloud, cvb.SparsePointCloudfrom_composite (cvb.Composite composite)
 Creates a point cloud from a composite. More...
 
Union[cvb.DensePointCloud, cvb.SparsePointCloudmatrix_transform (self, cvb.Matrix3DH matrix)
 Creates a new point cloud with all points being transformed by the given transformation. More...
 
cvb.Image range_map (self, cvb.NumberRange x_range, cvb.NumberRange y_range, cvb.Size2D size, float background)
 Creates a new range map image via linear projection in negative z-direction. More...
 
None save (self, str file_name, Optional[int] flags)
 Saves the given point cloud to the file with the given file_name. More...
 
Union[cvb.DensePointCloud, cvb.SparsePointCloudscale (self, Union[cvb.Factors3D, List[float]] factors)
 Creates a new point cloud with all points being scaled by the given factors. More...
 
Union[cvb.DensePointCloud, cvb.SparsePointCloudtransform (self, cvb.AffineMatrix3D transformation)
 Creates a new point cloud with all points being transformed by the given transformation. More...
 

Additional Inherited Members

- Properties inherited from PointCloud
 data_type = property
 cvb.DataType: Gets the DataType of the x, y, z(, w) components of the given PointCloud.
 
 layout = property
 int: Gets the layout of the available buffers / planes of the given point cloud (see cvb.PointCloudLayout).
 
 num_points = property
 int: Gets the number of x, y, z(, w) points in the given point cloud.
 
 plane_count = property
 int: Gets the number of planes enumerated by this object.
 
 planes = property
 List[cvb.Plane]: Gets all available planes enumerated by this object.
 

Detailed Description

A sparse Cartesian 3D point cloud object.

A sparse point cloud is logically seen an array of 3D points. There is no order or neighboring information between the single points. It has less memory than a dense point cloud. Conversion to a dense point cloud is difficult, as the grid thus neighbor information is missing.

Member Function Documentation

◆ crop()

cvb.SparsePointCloud crop (   self,
cvb.Cuboid  clip_box 
)

Creates a new point cloud which only consists of the points inside the clip box.

Parameters

clip_box : cvb.Cuboid Cuboid defining the bounds for the points to be copied (min/max are inclusive).

Returns

cvb.SparsePointCloud The new point cloud.

◆ from_dense_point_cloud()

cvb.SparsePointCloud from_dense_point_cloud ( cvb.DensePointCloud  dense_point_cloud)

Creates a sparse point cloud from a dense point cloud with confidence plane.

Non-confident points will be removed and the confidence plane is not kept. The new sparse point cloud has the same planes as the dense point cloud(except confidence).

Parameters

dense_point_cloud : cvb.DensePointCloud Dense point cloud create sparse point cloud from.

Returns

cvb.SparsePointCloud Converted sparse point cloud.

◆ frustum_crop()

cvb.SparsePointCloud frustum_crop (   self,
cvb.Cuboid  clip_box,
cvb.Angle  theta,
cvb.Angle  phi 
)

Creates a new point cloud which only consists of the points inside the clip box.

The orientation of the two boundary planes Z=Zmin and Z=Zmax can be modified by angles theta and phi. For theta, phi = 0,0 the function will give the same result as crop(). Angle theta tilts the two Z - boundary planes towards the(positive) Y - axis. Additionally, phi rotates the tilted Z - boundary planes around the Z - axis(for theta = 0, phi will have no effect, because it is then just an inplane - rotation). The two Z - boundary planes will stay parallel, but no longer necessarily orthogonal to the lateral boundary planes. Note, that only the Z - boundaries are tilted and not the whole bounding box, i.e.X - and Y - boundaries will stay the same.

Parameters

clip_box : cvb.Cuboid Cuboid defining the bounds for the points to be copied(min / max are inclusive).

theta : cvb.Angle Tilt angle of the two Z-boundary planes Z=Zmin and Z=Zmax towards the positive Y - axis.

phi : cvb.Angle Rotation angle of the tilted Z-boundary planes around the Z - axis.If Theta = 0, Phi will have no effect.

Returns

cvb.SparsePointCloud

◆ plane_crop()

cvb.SparsePointCloud plane_crop (   self,
cvb.Plane3D  plane,
cvb.NumberRange  range,
int  crop_range 
)

Creates a new point cloud where points within or outside a range parallel to given plane are cropped.

The plane is defined by the hessian normal form. Points are cropped within or outside a range parallel to the given plane. The range is defined by range. Note, that Range.Max and Range.Min are applied along normal direction. In order to define a range around the plane, maximum and minimum range have to be positiveand negative respectively. If the input point cloud is dense, cropped points are set non - confident.Lines and columns at the borders containing only non-confident points are removed. If the input point cloud is dense and does not contain a confidence plane, a confidence plane will be added to the cropped point cloud.

Parameters

plane : cvb.Plane3D Points parallel to this plane will be cropped.

range : cvb.NumberRange Points within or outside this range will be cropped.

crop_range : int Indicates whether points should be cropped within or outside the range.

Returns

cvb.SparsePointCloud Cropped point cloud.

The plane is defined by the hessian normal form. Above plane means all points with z values greater than the plane are cropped.It makes no difference in which direction the given normal points. The normal is always converted, so that it points up (positive z value). Note, if Normal.Z equals 0, 'below' and 'above' is undefined and thus no cropping is done. Instead the input point cloud will be duplicated. If the input point cloud is dense, points beyond the plane are set non-confident.Lines and columns at the borders containing only non-confident points are removed.If the input point cloud is dense and does not contain a confidence plane, a confidence plane will be added to the cropped point cloud.

Parameters

plane : cvb.Plane3D Points beyond this plane will be cropped.

threshold : float Points below plane plus this value and points above plane minus this value are cropped respectively. This threshold should be set, if plane is calculated via fit_plane(). It ensures, that all points beyond this plane plus noise are cropped.

crop_below_above : Optional[int] Indicates if points should either be cropped below or above plane(optional, default value: cvb.CropDirection.Below).

Returns

cvb.SparsePointCloud Cropped point cloud.

◆ to_dense_point_cloud()

Tuple[cvb.DensePointCloud, int] to_dense_point_cloud (   self,
int   conversion_mode = cvb.ConversionMode.Automatic 
)

Creates a dense point cloud from a sparse point cloud.

This function maps the points of a sparse point cloud into a newly created dense point cloud. First, a resolution is determined that minimizes the points lost by the conversion.

If multiple points map onto the same x, y position in the dense cloud, the one with the larger z value is retained. The output cloud always has a confidence plane, which is set to 0 if no point of the sparse cloud matched the location. It is set to 1 if a point of the sparse cloud could be mapped to that location.

If the sparse cloud has a w component, it is replicated as well.

Parameters

conversion_mode : int Mode used in conversion to dense point cloud. Currently Automatic is the only option (see cvb.ConversionMode).

Returns

Tuple[cvb.DensePointCloud, int] A tuple of the converted dense point cloud and the number of dropped points that overlapped in x and y and thus got dropped.