| Customize Help

Steps to creating a cloud of 3D points using laser line profiling



The following steps provide a basic methodology for using laser line profiling to create a point cloud using the MIL 3D Reconstruction module:

  1. Allocate a 3D reconstruction context to hold your laser line profiling settings, using M3dmapAlloc() with M_LASER and M_CALIBRATED_CAMERA_LINEAR_MOTION.

  2. Optionally, use M3dmapControl() to change the settings of the M_CALIBRATED_CAMERA_LINEAR_MOTION context.

  3. If you need to adjust settings for a 1D locate peak image processing context (which specifies how to find the laser line in the image), inquire the identifier of the internal peak intensity image processing context using M3dmapInquire() with M_LOCATE_PEAK_1D_CONTEXT_ID. Then, use MimControl() to adjust the settings of this internal image processing context.

  4. Fully calibrate your 3D reconstruction setup; this includes calibrating your camera.

    1. Calibrate your camera by allocating a camera calibration context using McalAlloc() with M_3D_ROBOTICS or M_TSAI_BASED; then, calibrate it using McalGrid() or McalList().

    2. Allocate a 3D reconstruction calibration result buffer using M3dmapAllocResult() with M_LASER_CALIBRATION_DATA.

    3. Optionally, use M3dmapControl() to change the settings of the M_LASER_CALIBRATION_DATA result buffer.

    4. Accumulate required 3D reconstruction calibration information. This involves grabbing laser line images of planar objects with known heights. Extract the laser data from the images into the M_LASER_CALIBRATION_DATA result buffer using M3dmapAddScan(), while specifying the known height of the object using M3dmapControl() with M_CORRECTED_DEPTH.

    5. Complete the 3D reconstruction calibration using M3dmapCalibrate().

    6. Free the M_LASER_CALIBRATION_DATA result buffer, once 3D reconstruction calibration is complete, using M3dmapFree().

  5. Allocate a new 3D reconstruction result buffer to hold the point cloud, using M3dmapAllocResult() with M_POINT_CLOUD_RESULT.

  6. Grab a series of images of an object as it passes through the laser plane. For each image, extract the laser line information from the image and add the data to the M_POINT_CLOUD_RESULT result buffer, using M3dmapAddScan() and a point cloud label. Note that you should specify the same label for each image; specifying another label will create a new point cloud.

    The 3D reconstruction result buffer now has a point cloud that contains 3D points.

  7. To operate on the 3D points, copy the point cloud into a point cloud container using M3dmapCopyResult().

  8. If required, obtain additional information about the 3D points in your point cloud using M3dmapGetResult().

  9. Free all your allocated objects using M3dmapFree() and McalFree().

Steps 1 to 5 are usually performed only once for a given 3D reconstruction setup. You can repeat steps 6 to 9 for every object that you want to reconstruct. Note that before every new object being scanned, you should clear the contents of the result buffer using M3dmapClear().

Most of this chapter describes how to generate point clouds (M_CALIBRATED_CAMERA_LINEAR_MOTION 3D reconstruction mode). To generate a partially corrected depth map, see the Partially corrected depth maps section later in this chapter.