| Customize Help
| Save Settings

M3dmetFit



Function Map
Synopsis
Fits a 3D geometry to a point cloud or depth map.
Syntax
void M3dmetFit(
MIL_ID Context3dmetId, //in
MIL_ID SrcContainerOrImageBufId, //in
MIL_INT GeometryType, //in
MIL_ID Result3dmetId, //in
MIL_DOUBLE OutlierDistance, //in
MIL_INT64 ControlFlag //in
)
Description

This function fits a 3D geometry to a point cloud or depth map using an iterative fit operation. The function starts from an initial fit estimate of the size and position of the 3D geometry. The function then internally iterates through better estimates of the correct size and position of the 3D geometry until a specified stop condition is reached. Upon each iteration, the function calculates the average root-mean-square (RMS) error per inlier, until a stop condition is met.

The initial fit estimate is calculated according to the mode specified using M3dmetControl() with M_ESTIMATION_MODE. A set of inlier points is then defined according to OutlierDistance, and a new size and placement for the 3D geometry, which reduces the average RMS error per inlier, is calculated. This process then repeats until a stop condition is met.

If the initial fit estimate mode is set to M_FROM_GEOMETRY, the fit operation will use the specified geometry in the fit 3D metrology context. By default, the context contains an undefined geometry. If you try to initiate the fit operation and use the undefined geometry to determine an initial fit estimate, an error will occur. You can use M3dmetCopy() to copy a defined 3D geometry object into the fit 3D metrology context.

If you perform a fit operation using a depth map, it is possible to specify a ROI in raster format, where only the values inside the ROI will be used in the fit. Note that missing data (or invalid points) in the depth map (or point cloud) are ignored when fitting.

When fitting, it is also possible to specify an outlier distance, beyond which no input data is considered for the fit operation.

After calling M3dmetFit(), you can inquire whether the operation was successful using M3dmetGetResult() with M_STATUS, along with several other metrics. To retrieve the calculated best fit 3D geometry or the inliers, use M3dmetCopyResult().

Note that the fit operation does not support 3D box geometry objects. All other 3D geometry objects are supported.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
Context3dmetId

Specifies the fit 3D metrology context.

function map For specifying the 3D metrology fit context
Click to summarizeValue Description
Click to summarize M_DEFAULT

Specifies to perform the fit operation using all the default settings specified for fit 3D metrology contexts in M3dmetControl().

Click to summarize Fit 3D metrology context identifier

Specifies the identifier of a fit 3D metrology context. This context must have been previously allocated on the required system using M3dmetAlloc() with M_FIT_CONTEXT.

(summarize)
SrcContainerOrImageBufId

Specifies the point cloud or depth map to which to fit the 3D geometry.

function map For specifying the point cloud or depth map
Click to summarizeValue Description
Click to summarize Depth map image buffer identifier

Specifies the identifier of an image buffer that contains a fully corrected depth map. The image buffer must be a 1-band, 8-bit, 16-bit or 32-bit unsigned buffer and must be fully corrected (that is, if you call McalInquire() with M_DEPTH_MAP, the function returns M_TRUE).

This image buffer can have a region of interest (ROI) associated with it, in raster format. Only values inside the ROI will be used in the fit operation.

(summarize)
Click to summarize Point cloud container identifier

Specifies the identifier of the container containing a 3D-processable point cloud.

The container must be 3D-processable (that is, if you call MbufInquireContainer() with M_3D_PROCESSABLE, the function returns M_PROCESSABLE).

(summarize)
GeometryType

Specifies the type of 3D geometry object to use in the fit operation. Note that 3D box geometry objects are not supported.

function map Specifies the type of geometry to fit onto the source container
Click to summarizeValue Description
Click to summarize M_CYLINDER

Specifies to fit a 3D cylinder geometry to the point cloud or depth map.

Fitting a 3D cylinder geometry requires at least 5 valid data points.

Note that only the curved surface of the cylinder geometry is used in the fitting process; points on the circular bases are ignored.

(summarize)
Click to summarize M_LINE

Specifies to fit a 3D line geometry to the point cloud or depth map.

Fitting a 3D line geometry requires at least 2 valid data points.

(summarize)
Click to summarize M_PLANE

Specifies to fit a 3D plane geometry to the point cloud or depth map.

Fitting a 3D plane geometry requires at least 3 valid data points.

(summarize)
Click to summarize M_SPHERE

Specifies to fit a 3D sphere geometry to the point cloud or depth map.

Fitting a 3D sphere geometry requires at least 4 valid data points.

(summarize)
Result3dmetId

Specifies the identifier of the fit 3D metrology result buffer in which to store the results of the fit operation. The result buffer must have been previously allocated using M3dmetAllocResult() with M_FIT_RESULT. To retrieve statistics for the fit operation, use M3dmetGetResult().

OutlierDistance

Specifies the distance from the 3D geometry, beyond which points are considered outliers and will be ignored during the fit operation.

function map For specifying the distance beyond which points become outliers
Click to summarizeValue Description
Click to summarize M_DEFAULT

Same as M_INFINITE.

Click to summarize M_INFINITE

Specifies that no points in the point cloud are outliers, and all points will be considered inliers in every iteration of the fit operation.

Click to summarize Value >= 0.0

Specifies the distance from the 3D geometry, beyond which points are considered outliers and will be ignored during the fit operation.

ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; mil3dmet.lib.
DLL Requires mil.dll; mil3dmet.dll.
DEFAULT UNSIGNED RASTER VECTOR AND RASTER PROC NOT PROCESSABLE CYLINDER LINE PLANE SPHERE DEFAULT INFINITE