Skip to main content

MclassDrawEntry

BoardSupported
Host SystemYes
V4L2Yes
Clarity UHDYes
Concord PoENo
GenTLYes
GevIQYes
GigE VisionYes
IndioNo
Iris GTXYes
Radient eV-CLYes
Rapixo CLYes
Rapixo CoFYes
Rapixo CXPYes
USB3 VisionYes

Draw region descriptors, classification results, segmentation results, object detection results, or anomaly detection results from an entry in an images dataset context.

Syntax

void MclassDrawEntry(
AIL_ID ContextGraId, //in
AIL_ID DatasetContextClassId, //in
AIL_ID DstImageBufOrListGraId, //out
AIL_INT64 Operation, //in
AIL_INT64 EntryIndex, //in
AIL_UUID EntryKey, //in
AIL_INT64 TaskType, //in
AIL_INT64 Index, //in
AIL_INT * DstLabelArrayPtr, //out
AIL_INT64 ControlFlag //in
)

Description

This function draws specific region descriptors, classification results, segmentation results, object detection results, or anomaly detection results from an entry in an images dataset context. Drawing operations are typically performed in a destination image buffer.

For datasets with more than 256 class definitions, using default colors will result in repeated colors.

Parameters

ContextGraId (in, AIL_ID)

Specifies the identifier of the graphics context to use for the draw operation.

For specifying the 2D graphics context

ValueDescription
M_DEFAULTSpecifies that the default 2D graphics context of the current Aurora Imaging Library application is used.

Note: Note that there is a different default 2D graphics context for each thread. | | 2D graphics context identifier | Specifies a valid 2D graphics context identifier, which you have allocated using MgraAlloc. |

DatasetContextClassId (in, AIL_ID)

Specifies the images dataset context from which to draw the entry.

For specifying the image dataset context

ValueDescription
DatasetContextClassIdSpecifies the identifier of an images dataset context. This context must have been previously allocated on the required system using MclassAlloc with M_DATASET_IMAGES.

DstImageBufOrListGraId (out, AIL_ID)

Specifies the identifier of the destination image buffer or 2D graphics list in which to draw. This can be either an image buffer or a graphics list identifier depending on the draw operation.

Operation (in, AIL_INT64)

Specifies the drawing operation. Set this parameter to one of the following values:

For specifying the drawing operation

ValueDescription
M_DESCRIPTOR_TYPE_BOXDraws the bounding box descriptor from the specified region using the color specified in the dataset (ContextGraId). To change the color, call MgraControl with M_COLOR on the specified graphics context (ContextGraId). To check for the presence of a bounding box descriptor, call MclassInquireEntry with M_NUMBER_OF_DESCRIPTOR_TYPE_BOX. Note that when no descriptor is present in the region, nothing is drawn.

M_DESCRIPTOR_TYPE_BOX is only available for object detection. | | M_DESCRIPTOR_TYPE_MASK | Draws the mask descriptor from the specified region using the color specified in the dataset (ContextGraId). To change the color, call MgraControl with M_COLOR on the specified graphics context (ContextGraId). To check for the presence of a mask descriptor, call MclassInquireEntry with M_NUMBER_OF_DESCRIPTOR_TYPE_MASK. Note that the destination must be an image buffer and not a graphics list. When no descriptor is present in the region, nothing is drawn.

M_DESCRIPTOR_TYPE_MASK is only available for segmentation and anomaly detection. | | M_DESCRIPTOR_TYPE_POLYGON | Draws the polygon descriptor from the specified region using the color specified in the dataset (ContextGraId). To change the color, call MgraControl with M_COLOR on the specifies graphics context (ContextGraId). To check for the presence of a polygon descriptor, call MclassInquireEntry with M_NUMBER_OF_DESCRIPTOR_TYPE_POLYGON. Note that the required size of the DstLabelArrayPtr is M_NUMBER_OF_DESCRIPTOR_TYPE_POLYGON for a single region. When no descriptor is present in the region, nothing is drawn.

M_DESCRIPTOR_TYPE_POLYGON is only available for segmentation and anomaly detection. | | M_DRAW_ANOMALY_CONTOUR_MASK | Draws the contour of the anomalies using the color of the graphics context specified by the ContextGraId parameter. To change the color, you can use MgraControl with M_COLOR on the graphics context specified by the ContextGraId parameter.

Note, DstImageBufOrListGraId must be an image buffer of type M_UNSIGNED. Additionally, if the graphics context specified by the ContextGraId parameter is not grayscale, DstImageBufOrListGraId must be 3 bands and 8-bit. | | M_DRAW_ANOMALY_HEATMAP | Draws the anomaly scores for each pixel location in the image.

Note, DstImageBufOrListGraId must be an 8-bit and 3-band image buffer of type M_UNSIGNED. | | M_DRAW_ANOMALY_MASK | Draws the anomalous pixels using the color of the graphics context specified by the ContextGraId parameter. To change the color, you can use MgraControl with M_COLOR on the graphics context specified by the ContextGraId parameter.

Note, DstImageBufOrListGraId must be an image buffer of type M_UNSIGNED. Additionally, if the graphics context specified by the ContextGraId parameter is not grayscale, DstImageBufOrListGraId must be 3 bands and 8-bit. | | M_DRAW_ANOMALY_SCORES | Draws the anomaly scores for each pixel location in the image.

Note, DstImageBufOrListGraId must be a 1-band image buffer of type M_FLOAT. | | M_DRAW_BEST_INDEX_CONTOUR_IMAGE | Draws the contours of the best classes. If you do not specify the M_PSEUDO_COLOR combination value, Aurora Imaging Library uses the result type M_BEST_INDEX_IMAGE_TYPE to determine the type of the image to use. If you specify M_PSEUDO_COLOR, the image type must be 3 bands, 8-bit unsigned.

Note, this drawing operation supports combination values from the draw table. The combination values that you can specify depend on the type of predefined classifier that you are using (MclassGetResultEntry with M_CLASSIFIER_PREDEFINED_TYPE):

Note, this drawing operation supports combination values from the draw table. The combination values that you can specify depend on the type of predefined classifier that you are using (MclassGetResultEntry with M_CLASSIFIER_PREDEFINED_TYPE):

Note, this drawing operation supports combination values from the draw table. The combination values that you can specify depend on the type of predefined classifier that you are using (MclassGetResultEntry with M_CLASSIFIER_PREDEFINED_TYPE):

Multiple drawing operations for object detection can be used together by adding them. For example, M_DRAW_BOX + M_DRAW_BOX_NAME. | | M_DRAW_BOX_CENTER | Draws the center positions of the bounding boxes for all instances, a specific class, or a specific instance (only one center position will be drawn in this case). The drawn color is specified in the class definitions. To change the line thickness of center position, call MgraControl with M_LINE_THICKNESS on the specified graphics context (ContextGraId).

Multiple drawing operations for object detection can be used together by adding them. For example, M_DRAW_BOX + M_DRAW_BOX_NAME. | | M_DRAW_BOX_NAME | Draws the class names for bounding boxes for all instances, a specific class, or a specific instance (only one name will be drawn in this case).

The class names are drawn using the graphics context specified by the ContextGraId parameter. You can modify the text settings of the drawn names using MgraControl.

Multiple drawing operations for object detection can be used together by adding them. For example, M_DRAW_BOX + M_DRAW_BOX_NAME.

If used with M_DRAW_BOX, the class name is drawn on top of the outline of the bounding box. If used with M_DRAW_BOX_CENTER, the class name is drawn near the center of the bounding box. Text alignment controls set with MgraControl are relative to these locations. | | M_DRAW_BOX_SCORE | Draws the class scores for bounding boxes for all instances, a specific class, or a specific instance (only one score will be drawn in this case).

The class scores are drawn using the graphics context specified by the ContextGraId parameter. You can modify the text settings of the drawn scores using MgraControl.

Multiple drawing operations for object detection can be used together by adding them. For example, M_DRAW_BOX + M_DRAW_BOX_NAME.

If used with M_DRAW_BOX, the class score is drawn on top of the outline of the bounding box. If used with M_DRAW_BOX_CENTER, the class score is drawn near the center of the bounding box. Text alignment controls set with MgraControl are relative to these locations. | | M_DRAW_CLASS_SCORES | Draws (fills) an image using the scores of a specific class. This drawing operation is not possible when drawing general results; you must set the Index parameter to a specific class.

Note, this drawing operation supports combination values from the draw table. The combination values that you can specify depend on the type of predefined classifier that you are using (MclassGetResultEntry with M_CLASSIFIER_PREDEFINED_TYPE):

For anomaly detection, non-anomalous values are drawn with index 0, anomalous pixels are drawn with index 1 and all don't care pixels are drawn with index -1. |

For modifying the draw entry operation

ValueDescription
M_GROUND_TRUTH_INDEXDraws the descriptor from the specified region using M_CLASS_INDEX_GROUND_TRUTH for pixel values. This combination value cannot be applied to M_GROUND_TRUTH_IMAGE.
M_NETWORK_OUTPUT_SIZEDraws according to the exact classification map size (output of the network) without scaling or expanding. In this case, the expected size of the destination buffer (DstImageBufOrListGraId) is the same as the X- and Y-size of M_NETWORK_OUTPUT_SIZE.

You cannot use M_NETWORK_OUTPUT_SIZE with:

If the operation is set to M_GROUND_TRUTH_IMAGE, M_PSEUDO_COLOR draws all the mask regions using colors specified in class definitions. This draws an image analogous to the input image of MclassEntryAddRegion with M_GROUND_TRUTH_IMAGE_COLOR. In this case, you can use M_PSEUDO_COLOR with other combination values. | | M_REPLICATE_BORDER | Draws with borders expanded to the size of the destination buffer (DstImageBufOrListGraId).

You cannot use M_REPLICATE_BORDER with:

For modifying the ground truth

ValueDescription
M_NO_REGION_PIXELSSpecifies that unlabeled pixels are assigned values according to M_NO_REGION_PIXEL_CLASS.

IfM_NO_REGION_PIXEL_CLASS is set to M_NO_CLASS, pixels are set to -2. For an 8 + M_UNSIGNED buffer, that resolves to 0xFE (that is, 254). Otherwise if M_NO_REGION_PIXEL_CLASS is set to an index, the pixel will be given the same value of this index.

Combined with M_PSEUDO_COLOR, this draws all the mask regions using the color specified in class definitions. IfM_NO_REGION_PIXEL_CLASS is set to M_NO_CLASS, pixels are set to the color specified by M_NO_CLASS_DRAW_COLOR. This draws an image analogous to MclassEntryAddRegion with M_GROUND_TRUTH_IMAGE_COLOR, but draws unlabeled pixels. |

EntryIndex (in, AIL_INT64)

Specifies the index of the entry to draw.

For specifying the index of an entry

ValueDescription
M_DEFAULTSpecifies that the index of an entry is not required.
Value >= 0Specifies the index of an entry.

EntryKey (in, AIL_UUID)

Specifies the key (AIL_UUID) of the entry to which regions are added. The key is defined as an Aurora Imaging Library universal unique identifier (UUID).

For specifying the unique key of an entry

ValueDescription
M_DEFAULT_KEYSpecifies that the unique key of an entry is not required.
ValueSpecifies the unique key of an entry.

TaskType (in, AIL_INT64)

Specifies the task (image classification, segmentation, object detection, or anomaly detection) for which the drawing operation is performed. A dataset entry might contain results from more than one task.

For specifying the type of task for which to draw results

ValueDescription
M_DEFAULTSame as M_AUTO.
M_ANOMALY_DETECTIONSpecifies that you are drawing for anomaly detection.
M_AUTOSpecifies the task for which to get results automatically, given the content in the dataset used (DatasetContextClassId).

If the dataset selected is an images dataset, and it contains only image classification results,M_AUTO is the same as M_CLASSIFICATION. If the dataset contains only segmentation results,M_AUTO is the same as M_SEGMENTATION. If the dataset only contains object detection results, M_AUTO is the same as M_OBJECT_DETECTION. If the dataset only contains anomaly detection results, M_AUTO is the same as M_ANOMALY_DETECTION.

If the dataset contains two types of results, then M_AUTO is the same as M_SEGMENTATION (if segmentation results are present), or M_CLASSIFICATION (if no segmentation results are present).

If the dataset contains image classification, segmentation, and object detection results, M_AUTO is the same as M_SEGMENTATION.

If the dataset contains segmentation and anomaly detection results, M_AUTO is the same as M_SEGMENTATION.

If the dataset selected is a features dataset, M_AUTO is the same as M_CLASSIFICATION, since segmentation and object detection are not supported for a features dataset.

To determine whether M_CLASSIFICATION, M_SEGMENTATION, M_OBJECT_DETECTION, or M_ANOMALY_DETECTION results are available in the dataset, use the M_PREDICT_INFO result. Typically, a dataset should be set up for a specific task (either image classification, segmentation, object detection, or anomaly detection). | | M_CLASSIFICATION | Specifies that you are drawing for image classification. | | M_OBJECT_DETECTION | Specifies that you are drawing for object detection. | | M_SEGMENTATION | Specifies that you are drawing for segmentation. |

Index (in, AIL_INT64)

Specifies what to use to perform the drawing operation. Set this parameter to one of the following values.

For specifying what to use to perform the drawing operation

ValueDescription
M_DEFAULTSpecifies the function call refers to the entry and not to a specific region or instance. The draw operation will be applied in a sequential manner to all regions or instances associated with the image.

Note: Note, this is not available when Operation is set to M_DRAW_CLASS_SCORES. | | M_CLASS_INDEX | Specifies that the drawing operation is for a specific class in the specified dataset context (DatasetContextClassId).

Note: Note, this is not available when Operation is set to M_DESCRIPTOR_TYPE_BOX, M_DESCRIPTOR_TYPE_MASK, M_DESCRIPTOR_TYPE_POLYGON, or M_GROUND_TRUTH_IMAGE. | | M_INSTANCE_INDEX | Specifies that the drawing operation is for a specific instance in the specified dataset context (DatasetContextClassId).

Note: Note, this is only available when Operationis set to M_DRAW_BOX, M_DRAW_BOX_CENTER, M_DRAW_BOX_NAME, or M_DRAW_BOX_SCORE. | | M_REGION_INDEX | Specifies the function call refers to a specific region within the entry.

Note: Note, this is only available when Operation is set to M_DESCRIPTOR_TYPE_BOX, M_DESCRIPTOR_TYPE_MASK, or M_DESCRIPTOR_TYPE_POLYGON. |

DstLabelArrayPtr *(out, AIL_INT)

Specifies the address of the array in which to write the labels that have been automatically given to the copied or moved graphics in the destination graphics list. Set this parameter to M_NULL if the destination (DstImageBufOrListGraId) is an image buffer.

ControlFlag (in, AIL_INT64)

Specifies how to control the drawing operation.

For specifying how to control the class score drawing

ValueDescription
M_DEFAULTImplements the default behavior. This is the only possible setting for all drawing operations except M_DRAW_CLASS_SCORES.
M_BILINEAR_INTERPOLATIONScales the classification map with a bilinear calculation. The scale is a network property and established in receptive field calculations. The scaled image is placed at the offset of the receptive field. This value is only supported for the M_DRAW_CLASS_SCORES drawing operation.
M_RECEPTIVE_FIELD_PATCHFills the corresponding receptive fields with calculated scores. Scores are drawn in order, from low to high. The best score is therefore drawn over lower scores. This value is only supported for the M_DRAW_CLASS_SCORES drawing operation.

This value only applies to an images dataset context.

Copyright © 2026 Zebra Technologies.