Main Content

sphereModel

Object for storing a parametric sphere model

Description

The sphereModel object stores a parametric sphere model.

Creation

Description

example

model = sphereModel(params) constructs a parametric sphere model from the specified parameters. The params argument is a 1-by-4 numeric vector that determines the value of the Parameters property.

Properties

expand all

This property is read-only.

Sphere model parameters, stored as a 1-by-4 numeric vector. The four parameters [a b c d] satisfy this equation for a sphere:

(xa)2+(yb)2+(zc)2=d2

This property is read-only.

Center of the sphere, stored as a 1-by-3 vector of form [xc yc zc]. The elements xc,yc,zc specify the x-, y-, and z-coordinates of the center coordinates of the sphere, respectively.

This property is read-only.

Radius of the sphere, stored as a scalar value.

Object Functions

plotPlot parametric model

Examples

collapse all

Load point cloud.

load("object3d.mat");

Display point cloud.

figure
pcshow(ptCloud)
xlabel("X(m)")
ylabel("Y(m)")
zlabel("Z(m)")
title("Detect a sphere in a point cloud")

Figure contains an axes object. The axes object with title Detect a sphere in a point cloud contains an object of type scatter.

Set the maximum point-to-sphere distance (1cm), for sphere fitting.

maxDistance = 0.01;

Set the region of interest to constrain the search.

roi = [-inf,0.5;0.2,0.4;0.1,inf];
sampleIndices = findPointsInROI(ptCloud,roi);

Detect the globe in the point cloud and extract it.

model = pcfitsphere(ptCloud,maxDistance,SampleIndices=sampleIndices);

Plot the sphere.

hold on
plot(model)

Figure contains an axes object. The axes object with title Detect a sphere in a point cloud contains 2 objects of type scatter, surface.

Version History

Introduced in R2015b