Remove noise from 3-D point cloud
ptCloudOut = pcdenoise(ptCloudIn)
[ptCloudOut,inlierIndices,outlierIndices] = pcdenoise(ptCloudIn)
[ptCloudOut,___] = pcdenoise(___Name,Value)
Create a plane point cloud.
gv = 0:0.01:1; [X,Y] = meshgrid(gv,gv); ptCloud = pointCloud([X(:),Y(:),0.5*ones(numel(X),1)]); figure pcshow(ptCloud); title('Original Data');
Add uniformly distributed random noise.
noise = rand(500, 3); ptCloudA = pointCloud([ptCloud.Location; noise]); figure pcshow(ptCloudA); title('Noisy Data');
ptCloudB = pcdenoise(ptCloudA); figure; pcshow(ptCloudB); title('Denoised Data');
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside single quotes (
' '). You can
specify several name and value pair arguments in any order as
'1.0'sets the threshold to
'NumNeighbors'— Number of nearest neighbor points
Number of nearest neighbor points, specified as the comma-separated
pair consisting of '
NumNeighbors' and a positive
integer in pixels. The value is used to estimate the mean of the average
distance to neighbors of all points. Decreasing this value makes the
filter more sensitive to noise. Increasing this value increases the
number of computations.
'Threshold'— Outlier threshold
1.0(default) | scalar
Outlier threshold, specified as the comma-separated pair consisting
Threshold' and a scalar. By default, the
threshold is one standard deviation from the mean of the average distance
to neighbors of all points. A point is considered to be an outlier
if the average distance to its k-nearest neighbors
is above the specified threshold.
ptCloudOut— Filtered point cloud
Filtered point cloud, returned as a
inlierIndices— Linear index of inlier points
Linear index of inlier points, returned as a 1-by-N vector.
outlierIndices— Linear index of outlier points
Linear index of outlier points, returned as a 1-by-N vector of linear indices.
 Rusu, R. B., Z. C. Marton, N. Blodow, M. Dolha, and M. Beetz. “Towards 3D Point Cloud Based Object Maps for Household Environments”. Robotics and Autonomous Systems Journal. 2008.