MIL_ID Context3dmapId, | //in |
MIL_ID ModelResult3dmapId, | //in |
MIL_INT ModelLabelOrIndex, | //in |
MIL_ID SceneResult3dmapId, | //in |
MIL_INT SceneLabelOrIndex, | //in |
MIL_ID PreAlignmentResult3dmapOrArrayBufId, | //in |
MIL_ID AlignmentResult3dmapOrArrayBufId, | //in |
MIL_INT64 ControlFlag, | //in |
MIL_INT64 *StatusPtr | //out |
This function takes two point clouds, a model point cloud and a scene point cloud, and returns the transformation that could move the scene's relative coordinate system such that the two point clouds are expressed using the same coordinates.
The function finds points in one point cloud and pairs them up with points in the other point cloud to minimize the root mean square error (RMS error) of the distance between all the paired points. From this set of point pairs, a new set of point pairs is calculated that minimizes the RMS error even more. The iterations continue, trying to reduce the RMS error in each iteration, until at least one stop condition occurs, such as when the RMS error falls below a specified threshold or the maximum number of iterations has occurred. You can specify the stop conditions using M3dmapControl().
Once a stop condition occurs, M3dmapAlign() returns the transformation that moves the scene's relative coordinate system so that the two point clouds are expressed in the same coordinates. The resulting transformation matrix can be returned in a pairwise 3D alignment result buffer (M3dmapAllocResult() with M_ALIGNMENT_RESULT) or a 4x4 MIL array buffer (MbufAlloc2d() with M_ARRAY and 32 + M_FLOAT).
Typically, you can start the iterative process by specifying a rough estimate of the final transformation as a prealignment. You can prealign the point clouds by overlapping their centroids (center of mass). In this case, you must call M3dmapControl() with M_PREALIGNMENT_MODE set to M_CENTROID. When prealigning the point clouds using their centroids, there is only a translation and no rotation. Alternatively, you can prealign the point clouds by directly passing a transformation matrix. This transformation matrix is typically either the result of a previous call to M3dmapAlign() or the result of some custom processing stored in a 4x4 MIL array buffer. You can also prealign the point clouds by combining the alignment of the centroids, which only results in a translation, with a specified transformation matrix, from which only the rotation is used.
Unlike most other functions that modify a MIL object, you can call this function concurrently from multiple threads on the same M_POINT_CLOUD_CONTAINER result buffer (ModelResult3dmapId) without using a M_MUTEX object. This is valid as long as the ModelLabelOrIndex parameter of the concurrent calls is set to a different index, and is not set to M_ALL.
Specifies the identifier of a pairwise 3D alignment context, allocated using M3dmapAlloc() with M_PAIRWISE_ALIGNMENT_CONTEXT.
Specifies the 3D reconstruction result buffer of type M_POINT_CLOUD_CONTAINER that contains the model point cloud(s).
Specifies the point cloud(s) in the specified 3D reconstruction result buffer, or the entire result buffer itself, that represents the model.
For specifying a point cloud representing
the model
|
|||||||||||||||||||||||||||||||||||||||
Value |
Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Same as M_ALL. |
||||||||||||||||||||||||||||||||||||||
Specifies the index of a point cloud in the specified 3D reconstruction result buffer. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the index of an existing point cloud. |
|||||||||||||||||||||||||||||||||||||||
Specifies the label of a point cloud in the specified 3D reconstruction result buffer. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the label of an existing point cloud. |
|||||||||||||||||||||||||||||||||||||||
M_ALL |
Specifies all point clouds in the specified 3D reconstruction result buffer. |
Specifies the 3D reconstruction result buffer of type M_POINT_CLOUD_CONTAINER that contains the scene point cloud(s).
Specifies the point cloud(s) in the specified 3D reconstruction result buffer, or the entire result buffer itself, that represents the scene.
For specifying a point cloud representing
the scene
|
|||||||||||||||||||||||||||||||||||||||
Value |
Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Same as M_ALL. |
||||||||||||||||||||||||||||||||||||||
Specifies the index of a point cloud in the specified 3D reconstruction result buffer. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the index of an existing point cloud. |
|||||||||||||||||||||||||||||||||||||||
Specifies the label for a point cloud in the specified 3D reconstruction result buffer. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the label of an existing point cloud. |
|||||||||||||||||||||||||||||||||||||||
M_ALL |
Specifies all point clouds in the specified 3D reconstruction result buffer. |
Specifies a transformation matrix in a pairwise 3D alignment result buffer or 4x4 MIL array buffer, which is used to prealign the model before the pairwise 3D alignment process begins.
If you are specifying to prealign using the point clouds' centroids (M_PREALIGNMENT_MODE set to M_CENTROID), this parameter can be set to M_NULL or take a transformation matrix. In the later case, the translation which aligns the centroids takes precedence and the only the rotation of the specified transformation matrix is used.
The pairwise 3D alignment result buffer must be allocated using M3dmapAllocResult() with M_ALIGNMENT_RESULT and must contain the results of a previous call to M3dmapAlign(). The 4x4 MIL array buffer must be allocated using MbufAlloc2d() with M_ARRAY and 32 + M_FLOAT, and contain a transformation matrix, typically computed from custom processing.
Specifying a transformation matrix for use during the prealignment step is intended for advanced users; set this parameter to M_NULL if not using a transformation matrix.
Specifies a pairwise 3D alignment result buffer or 4x4 MIL array buffer used to store the results from the pairwise 3D alignment process. The alignment result buffer must be allocated using M3dmapAllocResult() with M_ALIGNMENT_RESULT. The 4x4 transformation matrix must be allocated using MbufAlloc2d() with M_ARRAY and 32 + M_FLOAT.
Specifies the address of the variable in which to write the 3D alignment status of the alignment operation. If you do not require this information, set this parameter to M_NULL.
For retrieving the alignment process
status
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_ALIGN_RMS_ERROR_RELATIVE_THRESHOLD_REACHED |
Specifies that the change in RMS error calculated from the distance between paired 3D points of the two aligned point clouds of the last iterations is equal to or lower than the specified percentage threshold (M3dmapControl() with M_ALIGN_RMS_ERROR_RELATIVE_THRESHOLD). (more details...) |
||||||||||||||||||||||||||||||||||||||
M_ALIGN_RMS_ERROR_THRESHOLD_REACHED |
Specifies that the RMS error calculated from the distance between paired 3D points of the two aligned point clouds of the last iteration is equal to or lower than the specified RMS error threshold (M3dmapControl() with M_ALIGN_RMS_ERROR_THRESHOLD). (more details...) |
||||||||||||||||||||||||||||||||||||||
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. (more details...) |
||||||||||||||||||||||||||||||||||||||
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. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib; mil3dmap.lib. |
DLL | Requires mil.dll; mil3dmap.dll. |