Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

pointCloud class

Object for storing a 3-D point cloud

Syntax

ptCloud = pointCloud(xyzPoints)
ptCloud = pointCloud(xyzPoints,Name,Value)

Description

ptCloud = pointCloud(xyzPoints) returns a point cloud object with coordinates specified by xyzPoints.

ptCloud = pointCloud(xyzPoints,Name,Value) returns a point cloud object, with additional properties specified by one or more Name,Value pair arguments.

Tips

The pointCloud object is a handle object. If you want to create a separate copy of a point cloud, you can use the MATLAB® copy method.

ptCloudB = copy(ptCloudA)

If you want to preserve a single copy of a point cloud, which can be modified by point cloud functions, use the same point cloud variable name for the input and output.

ptCloud = pcFunction(ptCloud)

Input Arguments

expand all

Point cloud x, y, and z locations, specified as either an M-by-3 or an M-by-N-by-3 matrix. The M-by-N-by-3 matrix is commonly referred to as an organized point cloud. The xyzPoints matrix contains M or M-by-N [x,y,z] points. The z values in the matrix, which generally correspond to depth or elevation, determine the color of each point. The xyzPoints input must be numeric.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is 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 Name1,Value1,...,NameN,ValueN.

Example: 'Color',[0 0 255]

expand all

Point cloud color of points, specified as the comma-separated pair of 'Color' and an M-by-3, or M-by-N-by-3 matrix. RGB values range between [0, 255]. Single or double inputs are rescaled to [0, 255].

CoordinatesValid Values of Color
M-by-3 matrixM-by-3 matrix

M-by-N-by-3 matrixM-by-N-by-3 matrix containing RGB values for each point.

Normal vector at each point, specified as the comma-separated pair consisting of 'Normal' and a matrix. The normal matrix contains the coordinates for each point and their normal vectors.

CoordinatesNormal Matrix
M-by-3 matrixM-by-3 matrix, where each row contains a corresponding normal vector.
M-by-N-by-3 matrixM-by-N-by-3 matrix containing a 1-by-1-by-3 normal vector for each point.

Grayscale intensities at each point, specified as the comma-separated pair consisting of 'Intensity' and a M-by-1 vector or M-by-N matrix.

CoordinatesIntensity Value
M-by-3 matrixM-by-1 vector, where each element contains a scalar value for each point.
M-by-N-by-3 matrixM-by-N matrix containing a scalar value for each point.

Properties

expand all

Point coordinates, stored as an M-by-3 or M-by-N-by-3 matrix. Each entry specifies the x, y, z coordinates of a point. This property is read-only.

RGB color of point, specified as an M-by-3 or M-by-N-by-3 matrix. Each entry specifies the RGB color of a point.

Data Types: uint8

Normal vector, specified as an M-by-3 matrix or M-by-N-by-3 matrix. Each entry specifies the x, y, z component of a normal vector of a point. The data type must be the same as the Location data type.

Grayscale intensities at each point, specified as the comma-separated pair consisting of 'Intensity' and a M-by-1 vector or M-by-N matrix.

Number of points, stored as a positive integer. This property is read-only.

Range of coordinates along x-axis, stored as a 1-by-2 vector. This property is read-only.

Range of coordinates along y-axis, stored as a 1-by-2 vector. This property is read-only.

Range of coordinates along z-axis, stored as a 1-by-2 vector. This property is read-only.

Methods

findNearestNeighborsFind nearest neighbors of a point
findNeighborsInRadiusFind neighbors within a radius
findPointsInROIFind points within ROI
removeInvalidPointsRemove invalid points
selectSelect points by index

Examples

expand all

Create two point clouds.

  ptCloud1 = pointCloud(rand(100,3,'single'));     
  ptCloud2 = pointCloud(1+rand(100,3,'single'));
 
  minDist = inf;

Find the nearest neighbor in ptCloud2 for each point in ptCloud1.

for i = 1 : ptCloud1.Count
    point = ptCloud1.Location(i,:);
    [~,dist] = findNearestNeighbors(ptCloud2,point,1);
    if dist < minDist 
        minDist = dist;
    end
end

Introduced in R2015a