Remove hidden points from point cloud
removes hidden points from the point cloud
ptCloudOut = removeHiddenPoints(
ptCloudIn. The function
removes the points hidden when viewing the point cloud from the specified viewpoint
viewPoint. Determining the visibility of a point can be useful for
shadow casting, reconstruction, and camera placement.
Remove Hidden Points in Point Cloud
Read point cloud data from a PLY file into the workspace.
ptCloud = pcread("teapot.ply");
Define the viewpoint.
viewPosition = [0 0 13];
Compute the indices of the visible points in the point cloud from the specified viewpoint, and remove the hidden points.
[ptCloudOut,indices] = removeHiddenPoints(ptCloud,viewPosition);
Display the visible points.
ptCloudIn — Input point cloud
Input point cloud, specified as a
viewPoint — Viewpoint
Viewpoint, specified as a three-element vector of the form [x y z]. Viewpoint can be inside or outside the point cloud.
rScale — Radius scale
3 (default) | positive scalar
Radius scale of the spherical projection, specified as a positive scalar. The
function scales the radius to a value of
10n, where n is the
rScale. Increasing the radius scale increases the number
of visible points.
Specify a higher radius scale value for dense point clouds.
ptCloudOut — Output point cloud
Output point cloud, returned as a
indices — Linear indices of visible points
M-element column vector
Indices of the points visible from the specified viewpoint, returned as an M-element column vector. M is the number of visible points.
The function uses these steps to determine the visible points in a point cloud from a specified viewpoint.
Associate the point cloud with a coordinate system whose center lies at the viewpoint.
Perform inversion using spherical projection.
Create a sphere of radius R such that all points in the point cloud lie within the sphere. You can control the radius value by using the
Transform the point cloud by reflecting each point, with respect to the sphere, along the line joining the point and the viewpoint.
Calculate a convex hull of the transformed point cloud and the viewpoint. The points inside the convex hull are the visible points.
Introduced in R2023a