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.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Fit cylinder to 3-D point cloud

`model = pcfitcylinder(ptCloudIn,maxDistance)`

`model = pcfitcylinder(ptCloudIn,maxDistance,referenceVector)`

`model = pcfitcylinder(ptCloudIn,maxDistance,referenceVector,maxAngularDistance)`

```
[model,inlierIndices,outlierIndices]
= pcfitcylinder(ptCloudIn,maxDistance)
```

```
[___,meanError] =
pcfitcylinder(ptCloudIn,maxDistance)
```

`[___] = pcfitcylinder(___,Name,Value)`

fits
a cylinder to a point cloud with a maximum allowable distance from
an inlier point to the cylinder. This function uses the M-estimator
SAmple Consensus (MSAC) algorithm to find the cylinder.`model`

= pcfitcylinder(`ptCloudIn`

,`maxDistance`

)

fits
a cylinder to the point cloud with additional orientation constraints
specified by the 1-by-3 reference orientation input vector.`model`

= pcfitcylinder(`ptCloudIn`

,`maxDistance`

,`referenceVector`

)

additionally
specifies the maximum allowed absolute angular distance.`model`

= pcfitcylinder(`ptCloudIn`

,`maxDistance`

,`referenceVector`

,`maxAngularDistance`

)

`[`

additionally
returns linear indices to the inlier and outlier points in the point
cloud input.`model`

,`inlierIndices`

,`outlierIndices`

]
= pcfitcylinder(`ptCloudIn`

,`maxDistance`

)

`[___,`

additionally
returns the mean error of the distance of the inlier points to the
model.`meanError`

] =
pcfitcylinder(`ptCloudIn`

,`maxDistance`

)

`[___] = pcfitcylinder(___,`

uses
additional options specified by one or more `Name,Value`

)`Name,Value`

pair
arguments.

The function returns a geometric model that describes the cylinder. This function uses the M-estimator SAmple Consensus (MSAC) algorithm to find the cylinder. The MSAC algorithm is a variant of the RANdom SAmple Consensus (RANSAC) algorithm.

The fitting algorithm for the `pcfitcylinder`

function
requires point cloud normals. Therefore, if the `Normal`

property
for the input point cloud is empty, the function fills it. When the
function fills the `Normal`

property, it uses six points
to fit the local cylinder. If six points do not work and the fitting
fails, consider calling the `pcnormals`

function
which enables you to select the number of points to use.

[1] Torr, P. H. S., and A. Zisserman. “MLESAC:
A New Robust Estimator with Application to Estimating Image Geometry.” *Computer
Vision and Image Understanding*. Volume 78, Issue 1, April
2000, pp. 138-156.

`affine3d`

| `cylinderModel`

| `pcdenoise`

| `pcfitplane`

| `pcfitsphere`

| `pcmerge`

| `pcplayer`

| `pcread`

| `pcregrigid`

| `pcshow`

| `pctransform`

| `pcwrite`

| `planeModel`

| `pointCloud`