module documentation

Extract a 2D slice from a point cloud

For a given point cloud and cutting plane, a cross section can be extracted within a specified tolerance. The cross section is then converted to a binary image to facilitate analysis.

Function cloud_to_grid Returns the binary image of the cross section for a given cloud
Function extract_plane cutting plane
Function get_3d Recover 3D cloud scale and dimensionality from 2D image space
Function voxelize Voxelize a two dimensional point cloud projection to create a binary image
def cloud_to_grid(cloud, density, z_plane, tolerance, grid_dim):

Returns the binary image of the cross section for a given cloud

This wrapper function simplifies the point cloud extraction and image conversion process

Parameters
cloud:numpy.ndarrayArray of x,y,z points describing point cloud of the scene
density:floatNumber of pixels in image space per unit length in cloud space
z_plane:floatLocation of the cutting plane along the z-axis
tolerance:floatPoints that lie within this perpendicular distance from the cutting plane will be included in the cross-section
grid_dimUndocumented
Returns
numpy.ndarrayA (2,n) array giving a binary image of the cross-section
def extract_plane(scene, z_plane, tolerance):

Extract the portion of the scene point cloud that is near the
cutting plane

Parameters
sceneArray of x,y,z points describing point cloud of the scene
z_planeLocation of cutting plane along z axis. The plane is perpendicular to the z axis
toleranceperpendicular distance between the plane and scene points. Scene points may not fall exactly on the plane, so this sensitivity must be tuned by the user
Returns
numpy arraynarrow cross section of the scene
def get_3d(coords2d, density, z_plane):

Recover 3D cloud scale and dimensionality from 2D image space

Parameters
coords2d:numpy.ndarrayOrdered list of coordinates in image space with dimensions (n,2)
density:floatNumber of pixels in image space per unit length in cloud space
z_plane:floatLocation of the cutting plane along the z-axis
Returns
np.ndarray(float)Ordered list of coordinates in cloud space with dimensions (n,3)
def voxelize(slice, density, grid_dim):

Voxelize a two dimensional point cloud projection to create a binary image

Note: Input assumed to be projected onto an XY plane

Parameters
slice:numpy array2D point cloud projection
density:intGrid cells per unit distance in the cloud
grid_dimUndocumented
Returns
grid(numpy array)2D binary image (Y,X ordering)