| Customize Help

Working with compliant cameras

If your 3D sensor transmit 3D data in a format defined by an industry standard (such as GigE Vision or GenICam), grab this data into a container with the M_GRAB attribute (previously allocated using MbufAllocContainer()). Typically, you can convert the data directly to a format that is 3D-processable and/or 3D-displayable using MbufConvert3d().

You can determine whether your 3D sensor transmits data in a format suitable for grabbing into a container using MdigInquire() with M_TARGET_BUFFER_OBJECT.

You can perform a single grab into a container using MdigGrab(), or you can continuously grab and process the grabbed data, without dropping frames, using MdigProcess(). You can also use MdigGrabContinuous() to continuously acquire frames of data for use with a 2D or 3D display.

Displaying grabbed 3D data

If you grabbed into a container allocated with the M_DISP attribute, you can display 3D data immediately after it is grabbed by selecting the container to a 3D display (using M3ddispSelect()). If the container is not 3D-displayable, but could be converted to a 3D-displayable container using MbufConvert3d(), MIL will internally convert the 3D data. Typically, you will need to convert the grabbed data to a 3D-processable container using MbufConvert3d(); in this case, it is more efficient to convert the data to a container that is also3D-displayable, and select that container to the 3D display instead of the grab container.

Note that you can select an empty container to a 3D display. When you grab 3D data into the empty container, it will be shown in the 3D display immediately.

Processing grabbed 3D data

Typically, you must convert the grabbed data for processing using MbufConvert3d() before you can use it with MIL 3D-processing functions. For more information, see the Preparing a container for display or processing section of Chapter 35: 3D Containers.

Grabbed 3D data can be used with MIL 3D-processing functions immediately if the following conditions are all met:

  • The 3D sensor is configured to transmit data in a format that is 3D-processable.

  • The grab container was allocated with both the M_GRAB and M_PROC attributes.

  • The 3D settings (such as shear, offset, and scale) of the range component are set to their default values (except for M_3D_DISTANCE_UNIT). You can find these settings in the table For specifying settings useful with components that store 3D data.

    Typically, transmitted components have non-default values for 3D settings; MIL applies these settings to the underlying data when the container is passed as a source to MbufConvert3d(). For example if M_3D_SCALE_X is set to 1.5, MbufConvert3d() scales the coordinates by 1.5 in the destination and sets M_3D_SCALE_X to the default value of 1 in the destination container.

You can inquire whether a container is 3D-processable using MbufInquireContainer() with M_3D_PROCESSABLE.

You can still apply 3D settings (such as shear, offset, or scale) to a 3D-processable container by setting them for the range component (using MbufControlContainer()) and passing the container as a source to MbufConvert3d().