select Select a subset of points. ------------------------------------------------------------------------------ DESCRIPTION/NOTES The property 'act' of the point cloud object, i.e. obj.act, is a n-by-1 logical vector defining for each point if it is active (true) or not active (false). Several selection strategies are provided in this function. All methods (except 'All') select a subset of the active points, i.e. not active points don't change their status. The available selection strategies are: 1 'All' -> Select all points. 2 'None' -> Deactivate all points. 3 'RandomSampling' -> Random sampling of points. 4 'IntervalSampling' -> Select each n-th point, e.g. each 10-th point. 5 'UniformSampling' -> Uniform sampling of points in space. 6 'MaxLeverageSampling' -> Selection of points based on their 'leverages'. 7 'NormalSampling' -> Selection of points based on the normal vector. 8 'Attribute' -> Selection of points based on an attribute. 9 'Limits' -> Selection of points based on coordinate limits. 10 'InPolygon' -> Selection of points inside a 2d polygonal region. 11 'InVoxelHull' -> Selection of points included in a voxel hull. 12 'RangeSearch' -> Selection of points within the range of another point cloud. 13 'KnnSearch' -> Selection of K nearest neighbors for each point of another point cloud. 14 'GeoTiff' -> Selection of points based on a GeoTiff file. 15 'Profile' -> Selection of points in a vertical profile. 16 'ByIDs' -> Selection of points by point IDs. ------------------------------------------------------------------------------ 1 'All' DESCRIPTION Select all points. No further inputs required. EXAMPLE pc = pointCloud('Lion.xyz'); pc.select('All'); ------------------------------------------------------------------------------ 2 'None' DESCRIPTION Deactivate all points. No further inputs required. EXAMPLE pc = pointCloud('Lion.xyz'); pc.select('None'); ------------------------------------------------------------------------------ 3 'RandomSampling' DESCRIPTION Random sampling of a percentage of points. INPUT [percentPoi] Percentage of points to select. EXAMPLE Select 5 percent of all points. pc = pointCloud('Lion.xyz'); pc.select('RandomSampling', 5); pc.plot; ------------------------------------------------------------------------------ 4 'IntervalSampling' DESCRIPTION Select each n-th point based upon ordering of points in obj.X. INPUT [nthPoi] Defintion of interval in which points are selected. EXAMPLE Select each 50-th point. pc = pointCloud('Lion.xyz'); pc.select('IntervalSampling', 50); pc.plot; ------------------------------------------------------------------------------ 5 'UniformSampling' DESCRIPTION Uniform sampling of points in space. This gives a homogeneous distribution of the selected points. For this strategy a voxel structure is derived from the point cloud and the points closest to each voxel center are selected. Consequently, the mean sampling distance corresponds to the edge length of the voxels. INPUT [voxelSize] Edge lenght of voxels used for the selection of points. Equal to mean sampling distance in each coordinate direction. EXAMPLE Select points with a mean sampling distance of 3mm. pc = pointCloud('Lion.xyz'); pc.select('UniformSampling', 3); pc.plot('MarkerSize', 5); ------------------------------------------------------------------------------ 6 'MaxLeverageSampling' DESCRIPTION This special selection strategy is only relevant if points are used for the estimation of transformation parameters (e.g. for the Iterative Closest Point algorithm). For details upon this selection strategy see [1]. The normal vectors are required for this option. INPUT [percentPoi] Percentage of points to select. EXAMPLE Select geometrically stable points. pc = pointCloud('Lion.xyz'); pc.select('UniformSampling', 2); pc.normals(1); pc.select('MaxLeverageSampling', 25); pc.plot('MarkerSize', 5); ------------------------------------------------------------------------------ 7 'NormalSampling' DESCRIPTION The aim of this strategy is to select points such that the distribution of their normals in angular space is as large as possible. For this the angular space (exposition=x vs. slope=y) is divided into classes of equal angular extension (e.g. 10 degree x 10 degree), and points are uniformly sampled among these classes. The normal vectors are required for this option. INPUT 1 [percentPoi] Percentage of points to select. 2 ['DeltaAngleExposition' deltaAngleExposition] Class width on exposition axis (=x). 3 ['DeltaAngleSlope' deltaAngleSlope] Class width on slope axis (=y). EXAMPLES 1 Select 5 percent of all points. pc = pointCloud('Lion.xyz'); pc.select('UniformSampling', 2); pc.normals(1); pc.select('NormalSampling', 10); pc.plot('MarkerSize', 5); 2 Define class widths. pc = pointCloud('Lion.xyz'); pc.select('UniformSampling', 2); pc.normals(1); pc.select('NormalSampling', 10, ... 'DeltaAngleExposition', 10, ... 'DeltaAngleSlope' , 5); pc.plot('MarkerSize', 5); ------------------------------------------------------------------------------ 8 'Attribute' DESCRIPTION Selection of points based on attribute values. The attribute has to be a field of the structure obj.A, e.g. obj.A.roughness. INPUTS 1 [attributeName] Name of attribute as char. 2 [attributeMinMax] Limits of attribute defined as vector with 2 elements. EXAMPLE Selection of points based on their roughness attribute. pc = pointCloud('Lion.xyz', 'Attributes', {'nx' 'ny' 'nz' 'roughness'}); % Note: the imported attributes are saved as fields in the % structure pc.A, e.g. the roughness in saved in pc.A.roughness. pc.select('Attribute', 'roughness', [0.01 0.3]); pc.plot; ------------------------------------------------------------------------------ 9 'Limits' DESCRIPTION Selection of points within a selection window. The window is defined by its coordinate limits in x, y and z. INPUT 1 [limitsMinMax] Selection window as 3-by-2 matrix: [minX maxX minY maxY minZ maxZ] 2 ['Reduced', reduced] Logical value which specifies if limits are given in reduced coordinates (true) or not (false=default). EXAMPLE Selection of the lions head. pc = pointCloud('Lion.xyz'); pc.select('Limits', [-Inf -10; -30 20; -10 Inf]); pc.plot; ------------------------------------------------------------------------------ 10 'InPolygon' DESCRIPTION Selection of points inside of a 2d polygonal region. INPUT [polygon] Matrix of size n-by-2, where each row contains the x and y coordinates of one polygon vertex. EXAMPLE Selection of the lions tail. pc = pointCloud('Lion.xyz'); pc.select('InPolygon', [45 4; 45 -7; 56 -7; 71 -2; 71 4; 63 6]); pc.plot; ------------------------------------------------------------------------------ 11 'InVoxelHull' DESCRIPTION Selection of points inside of a specified voxel hull. This method can be used to select points in parts which are common to another point cloud, i.e. in the overlapping areas of two point clouds. INPUT 1 [voxelHull] Voxel hull of a point cloud as a n-by-3 matrix. For the computation of a voxel hull the method getVoxelHull is recommended, see 'help pointCloud.getVoxelHull'. 2 [voxelSize] Edge length of voxels. EXAMPLE Two point clouds are given. Select those points of the second point cloud, which are overlapping to the first point cloud. pcScan1 = pointCloud('LionScan1.xyz'); pcScan2 = pointCloud('LionScan2.xyz'); pcScan1.plot('Color', 'r'); pcScan2.plot('Color', 'b'); pcScan1.getVoxelHull(2); pcScan2.select('InVoxelHull', pcScan1.voxelHull, ... pcScan1.voxelHullVoxelSize); pcScan2.plot('Color', 'm'); ------------------------------------------------------------------------------ 12 'RangeSearch' DESCRIPTION Selection of all points within a specified distance from another point cloud. This method is based upon the official function 'rangesearch'. INPUT 1 [points] Point cloud as a n-by-3 matrix. 2 [searchRadius] Search radius. 3 ['Distance', distance] String or function handle specifying the distance metric. Run doc rangesearch for further details. EXAMPLE First select a subset of points with uniform sampling, then search all points within the range of 1 from these points. pc = pointCloud('Lion.xyz'); pc.select('UniformSampling', 5); points = pc.X(pc.act,:); pc.select('All'); pc.select('RangeSearch', points, 1); pc.plot; ------------------------------------------------------------------------------ 13 'KnnSearch' DESCRIPTION Selection of K nearest neighbors for each point of another point cloud. This method is based upon the official function 'knnsearch'. INPUT 1 [points] Point cloud as a n-by-3 matrix. 2 ['K', k] Number of nearest neighbors to search. 3 ['Distance', distance] String or function handle specifying the distance metric. Run doc rangesearch for further details. OUTPUT [Distances] Distances to nearest neighbors n-by-k matrix. EXAMPLE First select a subset of points with uniform sampling, then search the 500 nearest neighbors of these points. pc = pointCloud('Lion.xyz'); pc.select('UniformSampling', 10); points = pc.X(pc.act,:); pc.select('All'); pc.select('KnnSearch', points, 'K', 500); pc.plot; ------------------------------------------------------------------------------ 14 'GeoTiff' DESCRIPTION Selection of points within specific cells of a geotiff file. For this strategy the Mapping Toolbox is required. INPUTS 1 [source] Source of geotiff file. Two possibilities are offered: 1 Path to a geotiff file defined as char, e.g. 'C:\map.tif'. 2 Cell containing objects A and R (see doc geotiffread), e.g. {A R}. 2 [minMax] Limits of cell values in which the points should be selected as vector with 2 elements. 3 ['RedPoi', redPoi] Optional reduction point of geotiff file specified as vector with 3 elements. ------------------------------------------------------------------------------ 15 'Profile' DESCRIPTION Selection of points within a vertical profile. The profile is defined by start point (x/y), end point (x,y) and width. INPUTS 1 [lineStart] Starting point of profile defined as vector with 2 elements: [startX startY]. 2 [lineEnd] Ending point of profile defined as vector with 2 elements: [endX endY]. 3 [lineWidth] Width of profile. OUTPUT [Azimuth] Azimuth of profile. The azimuth can be used for the visualization of the profile with view(azimuth, 0). EXAMPLE Profile through point cloud. pc = pointCloud('Lion.xyz'); az = pc.select('Profile', [ 100 0], [-100 0], 2); pc.plot; view(az,0); ------------------------------------------------------------------------------ 16 'ByIDs' DESCRIPTION Selection of points by point IDs. For this, the point IDs have to be saved as point attribute 'id'. INPUTS [IDs2select] Vector of point IDs to select. ------------------------------------------------------------------------------ REFERENCES [1] Glira, P., Pfeifer, N., Ressl, C., Briese, C. (2015): A correspondence framework for ALS strip adjustments based on variants of the ICP algorithm. In: Journal for Photogrammetry, Remote Sensing and Geoinformation Science (PFG) 2015(04), pp. 275-289. ------------------------------------------------------------------------------ philipp.glira@gmail.com ------------------------------------------------------------------------------