| MIL 10 Reference
| Customize Help
| Save Settings

M3dmapGetResult



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Get the specified type of result(s) from a 3D reconstruction result buffer.
Syntax
void M3dmapGetResult(
MIL_ID Result3dmapId, //in
MIL_INT LabelOrIndex, //in
MIL_INT64 ResultType, //in
void *ResultArrayPtr //out
)
Description

This function retrieves the result(s) of the specified type from a result buffer. For M_LASER_CALIBRATION_DATA, M_DEPTH_CORRECTED_DATA, and M_POINT_CLOUD_CONTAINER 3D reconstruction result buffers, results are available after using M3dmapAddScan() and/or M3dmapPut() to fill the result buffer with the extracted laser line data.

For an M_STAT_RESULT result buffer, results are available after using M3dmapStat() to fill the result buffer with statistics on a depth map.

An M_POINT_CLOUD_CONTAINER 3D reconstruction result buffer contains an array of distinct point clouds. You can retrieve results from an individual point cloud in the result buffer, from an aggregate of all point clouds in the result buffer, or from the result buffer itself using the LabelOrIndex parameter.

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
Result3dmapId

Specifies the identifier of the 3D reconstruction result buffer from which to retrieve results.

LabelOrIndex

Specifies the point cloud(s) in the specified 3D reconstruction result buffer, or the entire result buffer itself, from which to get results. Only 3D reconstruction result buffers allocated using M_POINT_CLOUD_CONTAINER have point clouds that can be specified using this parameter. For all other types of 3D reconstruction result buffers, set this parameter to M_DEFAULT.

function map For specifying the point cloud(s) or point cloud container
CollapseValue Description
Collapse

Specifies the array index of a point cloud in the specified 3D reconstruction result buffer.

(summarize)
Parameters

Specifies the array index of an existing point cloud.

Collapse

Specifies the label for a point cloud in the specified 3D reconstruction result buffer.

(summarize)
Parameters

Specifies the label of an existing point cloud.

Collapse M_ALL

Specifies to get results about all point clouds in the specified 3D reconstruction result buffer.

Collapse M_GENERAL

Specifies to get results about the point cloud container (3D reconstruction result buffer allocated using M_POINT_CLOUD_CONTAINER).

ResultType

Specifies the type of result to get.

See the Parameter associations section for possible values that can be specified.

ResultArrayPtr
Accepts the address of one of the following (see the Parameter associations section for specifics on which is expected):
  • array of type char
  • array of type MIL_DOUBLE
  • array of type MIL_FLOAT
  • array of type MIL_ID
  • array of type MIL_INT
  • array of type MIL_INT16
  • array of type MIL_INT32
  • array of type MIL_INT64
  • char
  • MIL_DOUBLE
  • MIL_FLOAT
  • MIL_ID
  • MIL_INT
  • MIL_INT16
  • MIL_INT32
  • MIL_INT64

Specifies the address in which to write the results.

When LabelOrIndex is set to M_ALL, you must specify the address of an array with as many elements as point clouds in the point cloud container. You can inquire the number of point clouds using M3dmapInquire() set to M_NUMBER_OF_POINT_CLOUDS.

See the Parameter associations section for possible values that can be returned.

To retrieve a result from an M_POINT_CLOUD_CONTAINER 3D reconstruction result buffer, the ResultType parameter can be set to one of the following values:

function map For retrieving results from a 3D reconstruction result buffer of type M_POINT_CLOUD_CONTAINER
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_HAS_FEATURE +

Retrieves whether the specified point cloud(s) have the specified feature (such as position or intensity data). The feature is specified using the combination value.

When the LabelOrIndex parameter is set to M_POINT_CLOUD_INDEX() or M_POINT_CLOUD_LABEL(), M_HAS_FEATURE returns whether the specified point cloud has the feature.

When the LabelOrIndex parameter is set to M_GENERAL, M_HAS_FEATURE returns whether all the point clouds in the specified result buffer have the feature.

When the LabelOrIndex parameter is set to M_ALL, M_HAS_FEATURE returns an array where the value of each element in the array is whether the point cloud at the corresponding index has the feature.


You must specify a combination value from the following table:
(summarize)
Collapse ResultArrayPtr data type info
  • Data type: MIL_DOUBLE
    Note: when retrieving the results from an individual point cloud or a general result

  • Data type: array of type MIL_DOUBLE
    Array size: this number can be obtained using M3dmapInquire() with M_NUMBER_OF_POINT_CLOUDS
    Note: when retrieving the results from all point clouds in the specified point cloud container (LabelOrIndex set to M_ALL)

Collapse M_FALSE

Specifies that the specified point cloud(s) do not have the feature.

Collapse M_TRUE

Specifies that the specified point cloud(s) do have the feature.

Collapse M_NUMBER_OF_3D_POINTS +

Retrieves the number of 3D points extracted from laser line data and stored in the specified point cloud(s).

When the LabelOrIndex parameter is set to M_POINT_CLOUD_INDEX() or M_POINT_CLOUD_LABEL(), M_NUMBER_OF_3D_POINTS returns the number of points in the specified point cloud.

When the LabelOrIndex parameter is set to M_GENERAL, M_NUMBER_OF_3D_POINTS returns the total number of points in all the point clouds in the specified result buffer.

When the LabelOrIndex parameter is set to M_ALL, M_NUMBER_OF_3D_POINTS returns an array where the value of each element in the array is the number of points in the point cloud at the corresponding index.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: MIL_DOUBLE
    Note: when retrieving the results from an individual point cloud or a general result

  • Data type: array of type MIL_DOUBLE
    Array size: this number can be obtained using M3dmapInquire() with M_NUMBER_OF_POINT_CLOUDS
    Note: when retrieving the results from all point clouds

Collapse Value >= 0

Specifies the number of 3D points.

Collapse M_TOTAL_DISPLACEMENT_Y +

Retrieves the total displacement along the Y-axis (typically the conveyor) from the first call to M3dmapAddScan().

If the value of M_SCAN_SPEED (M3dmapControl()) has remained constant since the last call to M3dmapClear(), M_TOTAL_DISPLACEMENT_Y is equivalent to M_SCAN_SPEED x (number of calls to M3dmapAddScan()-1).

M_TOTAL_DISPLACEMENT_Y is only available when the LabelOrIndex parameter is set to M_GENERAL.

(summarize)
Collapse ResultArrayPtr data type info

Data type: MIL_DOUBLE

Combination constants for M_HAS_FEATURE.

You must add one of the following values to the above-mentioned value to determine whether the feature exists in the specified location.

function map For specifying the feature to check
CollapseCombination value Description
Collapse M_INTENSITY

Specifies to determine if intensity information exists in the specified point cloud(s).

Collapse M_POSITION

Specifies to determine if position information exists in the specified point cloud(s).

Combination constants for M_NUMBER_OF_3D_POINTS.

You can add one or more of the following values to the above-mentioned value to determine which 3D points should be included when returning the number of points.

function map For modifying the number of points returned
CollapseCombination value Description
Collapse M_LAST_SCAN

Specifies to return only those points generated during the last call to M3dmapAddScan(). This option is valid only if LabelOrIndex refers to a point cloud(s) of type M_LASER_SCAN.

(summarize)
Collapse M_NO_INVALID_POINT

Specifies to exclude all points in the specified point cloud(s) that are set to M_INVALID_POINT.

To retrieve a result from a pairwise 3D alignment result buffer allocated using M3dmapAllocResult() with M_ALIGNMENT_RESULT, the ResultType parameter can be set to one of the following values:

function map For retrieving results from a pairwise 3D alignment result buffer
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_ALIGN_RMS_ERROR +

Retrieves the RMS error calculated from the distance between paired 3D points from the two aligned point clouds. A value of 0 implies that all points in the scene point cloud perfectly overlap with the points in the model point cloud.

(summarize)
Collapse ResultArrayPtr data type info

Data type: MIL_DOUBLE

Collapse Value >= 0

Specifies the RMS error.

Collapse M_ALIGN_RMS_ERROR_RELATIVE +

Retrieves the relative RMS error, which is the percent change of the RMS error of the last two iterations of the pairwise 3D alignment process.

For instance, if the RMS error of the first iteration is 2.0 and the RMS error of the second iteration is 0.8, the relative RMS error of the second iteration is 60% ([2.0-0.8]/2.0). If the value is positive, the point clouds are becoming better aligned (the RMS error is decreasing).

Note the relative error of the first iteration, the prealignment, is artificially set to 0.0. This is because the value relies on the previous iteration, which in the case of the first iteration, does not exist.

(summarize)
Collapse ResultArrayPtr data type info

Data type: MIL_DOUBLE
Note: This value is expressed as a percentage, so a value of 0.1 is 0.1%, not 10%.

Collapse M_ALIGNMENT_MATRIX +

Retrieves the transformation matrix that would align the model point cloud with the scene point cloud. The transformation matrix is a 4 x 4 homogeneous matrix.

(summarize)
Collapse ResultArrayPtr data type info

Data type: array of type MIL_DOUBLE
Array size: 16

Collapse M_NB_ITERATIONS +

Retrieves the number of iterations performed during the pairwise 3D alignment process. This always includes the prealignment step, which is the first iteration regardless of whether a prealignment matrix was passed to M3dmapAlign().

(summarize)
Collapse ResultArrayPtr data type info

Data type: MIL_INT
Note: greater than or equal to zero

Collapse M_STATUS +

Retrieves the status of the pairwise 3D alignment process.

Note that in a single iteration, there could be more than one status. For instance, the relative RMS threshold could be reached on the last allowable iteration. In this case, only a single status is returned. The following is the order of precedence of returned statuses: M_ALIGN_RMS_ERROR_THRESHOLD_REACHED, M_ALIGN_RMS_ERROR_RELATIVE_THRESHOLD_REACHED, M_MAX_ITERATIONS_REACHED.

(summarize)
Collapse ResultArrayPtr data type info

Data type: MIL_DOUBLE

Collapse M_ALIGN_RMS_ERROR_RELATIVE_THRESHOLD_REACHED

Specifies that the change in RMS errors of the last two iterations is equal to or lower than the specified percentile threshold (M3dmapControl() with M_ALIGN_RMS_ERROR_RELATIVE_THRESHOLD).

This is typically considered a successful alignment.

(summarize)
Collapse M_ALIGN_RMS_ERROR_THRESHOLD_REACHED

Specifies that the RMS error of the last iteration is equal to or lower than the specified RMS error threshold (M3dmapControl() with M_ALIGN_RMS_ERROR_THRESHOLD).

This is typically considered a successful alignment.

(summarize)
Collapse M_MAX_ITERATIONS_REACHED

Specifies that the maximum number of iterations of the alignment process, set using M3dmapControl() with M_MAX_ITERATIONS, has been reached.

Collapse M_NOT_ENOUGH_POINT_PAIRS

Specifies that the number of points which overlap between the model point cloud and the scene point cloud is below a critical threshold.

This could occur because the point clouds were too different in the first iteration, or that, throughout the iterations of the pairwise 3D alignment process, the point clouds diverged too much, rather than converged.

This status implies that the function did not discover a transformation which overlaps the two point clouds.

(summarize)

You can add the following value to the above-mentioned values to determine the result for each iteration.

function map For specifying to retrieve the result for each iteration
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_ALL_ITERATIONS

Specifies to retrieve the result for each iteration during the pairwise 3D alignment.

(summarize)
Collapse ResultArrayPtr data type info

To retrieve a result about partially corrected depth maps from an M_DEPTH_CORRECTED_DATA 3D reconstruction result buffer, the ResultType parameter can be set to one of the following values:

Unless otherwise specified, the following values require that you pass the ResultArrayPtr parameter the address of a MIL_DOUBLE.

function map For retrieving results from a 3D reconstruction result buffer of type M_DEPTH_CORRECTED_DATA
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_CORRECTED_DEPTH_MAP_BUFFER_TYPE +

Retrieves the data type and depth that an image buffer should have to store the partially corrected depth map.

(summarize)
Collapse M_UNSIGNED + 8

Specifies that the image buffer should be an 8-bit unsigned buffer.

Collapse M_UNSIGNED + 16

Specifies that the image buffer should be a 16-bit unsigned buffer.

Collapse M_CORRECTED_DEPTH_MAP_SIZE_X +

Retrieves the X-size, in pixels, that an image buffer should have to store the partially corrected depth map.

If the MimControl() M_SCAN_LANE_DIRECTION control type setting is set to M_VERTICAL, this is equal to the X-size of the image buffer passed to M3dmapAddScan().

If the MimControl() M_SCAN_LANE_DIRECTION control type setting is set to M_HORIZONTAL, this is equal to the Y-size of the image buffer passed to M3dmapAddScan().

(summarize)
Collapse M_CORRECTED_DEPTH_MAP_SIZE_Y +

Retrieves the Y-size, in pixels, that an image buffer should have to store the partially corrected depth map.

This is equal to the number of times M3dmapAddScan() was called or the value of the M_MAX_FRAMES control, whichever is smaller.

(summarize)

To retrieve a result from a 3D reconstruction result buffer of type M_LASER_CALIBRATION_DATA or M_DEPTH_CORRECTED_DATA, or a point cloud of type M_LASER_SCAN, the ResultType parameter can be set to one of the following values:

Unless otherwise specified, the following values require that you pass the ResultArrayPtr parameter the address of a MIL_DOUBLE (when retrieving results from an individual point cloud or result buffer) or the address of an array of type MIL_DOUBLE with a size equal to this number can be obtained using M3dmapInquire() with M_NUMBER_OF_POINT_CLOUDS (when retrieving the results from all point clouds in the specified point cloud container).

function map For retrieving results from a 3D reconstruction result buffer of type M_LASER_CALIBRATION_DATA or M_DEPTH_CORRECTED_DATA, or individual point clouds.
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_CAMERA_IMAGE_SIZE_X +

Retrieves the X-size of the image buffer from which the last laser line was extracted using M3dmapAddScan().

(summarize)
Collapse M_CAMERA_IMAGE_SIZE_Y +

Retrieves the Y-size of the image buffer from which the last laser line was extracted using M3dmapAddScan().

(summarize)
Collapse M_INTENSITY_MAP_BUFFER_TYPE +

Retrieves the data type and depth that an image buffer should have to store the intensity map.

The returned depth and data type are the same as those of the image buffer, passed to M3dmapAddScan(), containing the grabbed image of the laser line.

(summarize)
Collapse M_UNSIGNED + 8

Specifies that the image buffer should be an 8-bit unsigned buffer.

Collapse M_UNSIGNED + 16

Specifies that the image buffer should be a 16-bit unsigned buffer.

Collapse M_NUMBER_OF_MISSING_DATA_LAST_SCAN +

Retrieves the number of points (pixels) with unknown values in the last laser line extracted using M3dmapAddScan().

(summarize)
Collapse M_SCAN_LANE_DIRECTION +

Retrieves whether laser line detection was performed vertically or horizontally.

(summarize)
Collapse M_UNCORRECTED_DEPTH_MAP_BUFFER_TYPE +

Retrieves the data type and depth that an image buffer should have to store the uncorrected depth map.

(summarize)
Collapse M_UNSIGNED + 8

Specifies that the image buffer should be an 8-bit unsigned buffer.

Collapse M_UNSIGNED + 16

Specifies that the image buffer should be a 16-bit unsigned buffer.

Collapse M_UNCORRECTED_DEPTH_MAP_FIXED_POINT +

Retrieves the number of fractional bits used for the uncorrected depth map.

(summarize)
Collapse M_UNCORRECTED_DEPTH_MAP_SIZE_X +

Retrieves the X-size, in pixels, that an image buffer should have to store the uncorrected depth map.

(summarize)
Collapse M_UNCORRECTED_DEPTH_MAP_SIZE_Y +

Retrieves the Y-size, in pixels, that an image buffer should have to store the uncorrected depth map.

(summarize)

To retrieve a result from a M_STAT_RESULT 3D reconstruction result buffer, the ResultType parameter can be set to one of the following values:

Unless otherwise specified, the following values require that you pass the ResultArrayPtr parameter the address of a MIL_DOUBLE.

function map For retrieving results from an M_STAT_RESULT result buffer
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_DEVIATION_MAX +

Retrieves the maximum height between the depth map and the reference level (always positive).

(summarize)
Collapse M_DEVIATION_MEAN +

Retrieves the average height between the depth map and the reference level.

(summarize)
Collapse M_NUMBER_OF_PIXELS_MISSING_DATA +

Retrieves the number of pixels that were not taken into account while computing statistics because they were missing data, either in the depth map or the reference level.

(summarize)
Collapse M_NUMBER_OF_PIXELS_OUTLIER +

Retrieves the number of pixels that were not taken into account while computing statistics because the distance between the depth map and the reference level at those coordinates was beyond the outlier threshold.

(summarize)
Collapse M_NUMBER_OF_PIXELS_TOTAL +

Retrieves the number of pixels that were considered by M3dmapStat(). This value corresponds to the number of pixels in the depth map, or the number of pixels that are not 0 in the mask buffer if it was provided. This value is also the sum of M_NUMBER_OF_PIXELS_VALID, M_NUMBER_OF_PIXELS_OUTLIER, and M_NUMBER_OF_PIXELS_MISSING_DATA.

(summarize)
Collapse M_NUMBER_OF_PIXELS_VALID +

Retrieves the number of pixels that were taken into account while computing statistics.

(summarize)
Collapse M_VOLUME +

Retrieves the volume between the depth map and the reference level.

Note that if M_STAT_ALL is used as a combination value, this returns the signed volume between the depth map and reference level. To obtain the absolute volume, the M_STAT_ABS combination value must be used.

(summarize)
Combination constants for the values listed in For retrieving results from an M_STAT_RESULT result buffer.

You can add one of the following values to the above-mentioned values to specify which pixels to take into account.

function map For specifying which pixels to take into account
CollapseCombination value Description
Collapse M_STAT_ABS

Takes into account all valid pixels, treating all vertical distances as positive.

Note that this value can only be used with M_DEVIATION_MEAN and M_VOLUME.

(summarize)
Collapse M_STAT_ALL

Takes into account all valid pixels. This is the default behavior if no combination flag is added.

(summarize)
Collapse M_STAT_NEGATIVE

Takes into account only the pixels for which going from the reference level to the depth map is in the negative Z-direction, treating all vertical distances as positive.

Collapse M_STAT_POSITIVE

Takes into account only the pixels for which going from the reference level to the depth map is in the positive Z-direction.

You can add the following value to the above-mentioned values to determine whether a result is available.

function map For determining whether results are available
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_AVAILABLE

Retrieves whether a result is available to be returned.

(summarize)
Collapse ResultArrayPtr data type info

Data type: MIL_DOUBLE

Collapse M_NULL

Specifies that the result is not available to be returned.

Collapse Value != 0

Specifies that the result is available to be returned.

You can add one of the following values to the above-mentioned values to cast the requested results to the required data type.

function map For specifying the data type
CollapseResultType Description
ResultArrayPtr
- Possible values returned
Collapse M_TYPE_CHAR

Casts the requested results to a char.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type char
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: char
    Note: When a single result.

Collapse M_TYPE_MIL_DOUBLE

Casts the requested results to a MIL_DOUBLE.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type MIL_DOUBLE
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: MIL_DOUBLE
    Note: When a single result.

Collapse M_TYPE_MIL_FLOAT

Casts the requested results to a MIL_FLOAT.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type MIL_FLOAT
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: MIL_FLOAT
    Note: When a single result.

Collapse M_TYPE_MIL_ID

Casts the requested results to a MIL_ID.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type MIL_ID
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: MIL_ID
    Note: When a single result.

Collapse M_TYPE_MIL_INT

Casts the requested results to a MIL_INT.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type MIL_INT
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: MIL_INT
    Note: When a single result.

Collapse M_TYPE_MIL_INT16

Casts the requested results to a MIL_INT16.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type MIL_INT16
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: MIL_INT16
    Note: When a single result.

Collapse M_TYPE_MIL_INT32

Casts the requested results to a MIL_INT32.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type MIL_INT32
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: MIL_INT32
    Note: When a single result.

Collapse M_TYPE_MIL_INT64

Casts the requested results to a MIL_INT64.

(summarize)
Collapse ResultArrayPtr data type info
  • Data type: array of type MIL_INT64
    Array size: Depends on the result type.
    Note: When multiple results.

  • Data type: MIL_INT64
    Note: When a single result.

Compilation information
Header Include mil.h.
Library Use mil.lib; mil3dmap.lib.
DLL Requires mil.dll; mil3dmap.dll.
ALL GENERAL HAS FEATURE FALSE TRUE NUMBER OF 3D POINTS TOTAL DISPLACEMENT Y INTENSITY POSITION LAST SCAN NO INVALID POINT ALIGN RMS ERROR ALIGN RMS ERROR RELATIVE ALIGNMENT MATRIX NB ITERATIONS STATUS ALIGN RMS ERROR RELATIVE THRESHOLD REACHED ALIGN RMS ERROR THRESHOLD REACHED MAX ITERATIONS REACHED NOT ENOUGH POINT PAIRS ALL ITERATIONS CORRECTED DEPTH MAP BUFFER TYPE UNSIGNED 8 UNSIGNED 16 CORRECTED DEPTH MAP SIZE X CORRECTED DEPTH MAP SIZE Y CAMERA IMAGE SIZE X CAMERA IMAGE SIZE Y INTENSITY MAP BUFFER TYPE UNSIGNED 8 UNSIGNED 16 NUMBER OF MISSING DATA LAST SCAN SCAN LANE DIRECTION HORIZONTAL VERTICAL UNCORRECTED DEPTH MAP BUFFER TYPE UNSIGNED 8 UNSIGNED 16 UNCORRECTED DEPTH MAP FIXED POINT UNCORRECTED DEPTH MAP SIZE X UNCORRECTED DEPTH MAP SIZE Y DEVIATION MAX DEVIATION MEAN NUMBER OF PIXELS MISSING DATA NUMBER OF PIXELS OUTLIER NUMBER OF PIXELS TOTAL NUMBER OF PIXELS VALID VOLUME STAT ABS STAT ALL STAT NEGATIVE STAT POSITIVE AVAILABLE NULL TYPE CHAR TYPE MIL DOUBLE TYPE MIL FLOAT TYPE MIL ID TYPE MIL INT TYPE MIL INT16 TYPE MIL INT32 TYPE MIL INT64 LASER SCAN DEFAULT DEFAULT DEFAULT DEFAULT ALL ALL ALIGNMENT MATRIX ALIGNMENT MATRIX