| Customize Help
| Save Settings

M3dimStat



Function Map
Synopsis
Compute a variety of statistics on a point cloud or depth map.
Syntax
void M3dimStat(
MIL_ID StatContext3dimId, //in
MIL_ID ContainerOrImageBufId, //in
MIL_ID StatResult3dimId, //in
MIL_INT64 ControlFlag //in
)
Description

This function calculates a variety of statistics for the 3D points in a point cloud or for the real-world coordinates that correspond to pixels in a depth map. The specified statistics 3D image processing context establishes which statistics to calculate and how to calculate them. If you need to calculate one type of statistic and use default settings, you can use a predefined context; otherwise, use M3dimAlloc() to set up a custom context that you can control using M3dimControl(). For example, you can enable bounding box statistics calculations (M_BOUNDING_BOX), and have the algorithm compute the axis-aligned box that contains most of the points but rejects outliers ( M_BOUNDING_BOX_ALGORITHM set to M_ROBUST). Note that, if you use the default M_STAT_CONTEXT_BOUNDING_BOX context, M3dimStat() computes the bounding box of all valid points. Results are stored in the specified 3D statistics result buffer.

After calling M3dimStat(), you can obtain the statistics from the result buffer using M3dimGetResult().

Note that there must be a sufficient number of valid points in the source point cloud container or image buffer for the statistics to be calculated, otherwise the result will be 0. This means that there must be at least 2 valid points for M_STAT_CONTEXT_DISTANCE_TO_NEAREST_NEIGHBOR calculations, and at least 1 valid point for all other statistics types.

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
StatContext3dimId

Specifies a previously allocated statistics 3D image processing context (used to evaluate multiple statistical calculations), or a predefined statistics 3D image processing context (used to evaluate a single statistical calculation).

Set this parameter to one of the following:

function map For specifying the statistics context
Click to summarizeValue Description
Click to summarize M_STAT_CONTEXT_BOUNDING_BOX

Specifies a predefined statistics 3D image processing context with the M_BOUNDING_BOX control type (M3dimControl()) set to M_ENABLE.

Use this predefined context to calculate bounding box statistics using the default setting (M_ALL_POINTS), which includes all valid points; no valid points exist outside the bounding box.

To exclude outliers, use a custom context and compute a bounding box that contains most of the valid points instead of all of them, using M3dimControl() with M_BOUNDING_BOX_ALGORITHM set to M_ROBUST.

(summarize)
Click to summarize M_STAT_CONTEXT_CENTROID

Specifies a predefined statistics 3D image processing context with the M_CENTROID control type (M3dimControl()) set to M_ENABLE.

Use this predefined context to calculate centroid statistics. The centroid is the center of mass of a point cloud's 3D points or a depth map's real-world coordinates. Centroid statistics include the X-, Y-, and Z-coordinates of the point cloud or depth map's centroid.

(summarize)
Click to summarize M_STAT_CONTEXT_DISTANCE_TO_NEAREST_NEIGHBOR

Specifies a predefined statistics 3D image processing context with the M_DISTANCE_TO_NEAREST_NEIGHBOR control type (M3dimControl()) set to M_ENABLE.

Use this predefined context to calculate distance-to-nearest-neighbor statistics, which include the average distance, the maximum distance, and the minimum distance of 3D points or real-world coordinates to their nearest neighbor.

(summarize)
Click to summarize M_STAT_CONTEXT_NUMBER_OF_POINTS

Specifies a predefined statistics 3D image processing context with the M_NUMBER_OF_POINTS control type (M3dimControl()) set to M_ENABLE.

Use this predefined context to calculate number-of-points statistics, which include the total number of points, the number of points that are missing data (invalid points), and the number of valid points.

(summarize)
Click to summarize MIL statistics 3D image processing context
identifier

Specifies the identifier of a statistics 3D image processing context, previously allocated using M3dimAlloc() with M_STATISTICS_CONTEXT.

In this case, use M3dimControl() to enable the statistics type(s) and specify additional control settings.

(summarize)
ContainerOrImageBufId

Specifies the identifier of the source container containing a 3D-processable point cloud, or specifies the identifier of the source depth map image buffer.

The container must be 3D-processable (that is, if you call MbufInquireContainer() with M_3D_PROCESSABLE, the function returns M_PROCESSABLE), and must have been previously allocated using MbufAllocContainer() with M_PROC. The container must have at least the 2 components M_COMPONENT_RANGE and M_COMPONENT_CONFIDENCE.

The source image buffer must be a 1-band, 8-, 16-, 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). The source image buffer can have a region of interest (ROI) associated with it, but it must be a raster region. Using an image buffer with a non-raster type of ROI will cause an error.

StatResult3dimId

Specifies the identifier of the statistics 3D image processing result buffer. The buffer must have been allocated using M3dimAllocResult() with M_STATISTICS_RESULT.

ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; mil3dim.lib.
DLL Requires mil.dll; mil3dim.dll.
STAT CONTEXT BOUNDING BOX STAT CONTEXT CENTROID STAT CONTEXT DISTANCE TO NEAREST NEIGHBOR STAT CONTEXT NUMBER OF POINTS NOT PROCESSABLE UNSIGNED TRUE VECTOR