Skip to main content

MclassStatCalculate

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

Calculates statistics on the datasets.

Syntax

void MclassStatCalculate(
AIL_ID StatContextClassId, //in
AIL_ID DatasetContextClassId, //in
AIL_INT64 EntryIndex, //in
AIL_UUID EntryKey, //in
AIL_ID StatResultClassId, //out
AIL_INT64 ControlFlag //in
)

Description

This function calculates statistics on the classification datasets. This requires specifying a statistics classification context, which you must have allocated using MclassAlloc with M_STAT_ANO, M_STAT_CNN, M_STAT_DET, M_STAT_SEG, or M_STAT_TREE_ENSEMBLE. To control a statistics classification context, use MclassControl.

You can calculate statistics for specific dataset entries, using the EntryIndex or EntryKey parameters, if you are specifying M_STAT_DET, M_STAT_SEG, or pixel-level M_STAT_ANO.

After calling MclassStatCalculate, you can obtain the statistics from the result buffer, using MclassGetResultStat.

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

Before calling MclassStatCalculate, the statistics classification context must be in a preprocessed state (MclassPreprocess). To inquire this, call MclassInquire with M_PREPROCESSED.

Parameters

StatContextClassId (in, AIL_ID)

Specifies the identifier of a statistics classification context. This context must have been previously allocated on the required system using MclassAlloc with M_STAT_ANO, M_STAT_CNN, M_STAT_DET, M_STAT_SEG, or M_STAT_TREE_ENSEMBLE.

DatasetContextClassId (in, AIL_ID)

Specifies the identifier of the images or features dataset on which to calculate statistics. These contexts are allocated using MclassAlloc with M_DATASET_IMAGES or M_DATASET_FEATURES. Note that M_STAT_ANO, M_STAT_CNN, M_STAT_DET, M_STAT_SEG require an images dataset, and M_STAT_TREE_ENSEMBLE requires a feature dataset.

EntryIndex (in, AIL_INT64)

Specifies the index of the dataset entry for which to calculate statistic results. This is only possible when using M_STAT_DET, M_STAT_SEG, and when calculating pixel level statistics for M_STAT_ANO.

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 for which to calculate statistic results. This is only possible when using M_STAT_DET, M_STAT_SEG, and when calculating pixel level statistics for M_STAT_ANO.

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.

StatResultClassId (out, AIL_ID)

Specifies the identifier of the statistics classification result buffer in which to write the results of the statistics calculation. The statistics classification result buffer must have been previously allocated on the required system using MclassAllocResult with M_STAT_ANO_RESULT, M_STAT_CNN_RESULT, M_STAT_DET_RESULT, M_STAT_SEG_RESULT, or M_STAT_TREE_ENSEMBLE_RESULT.

ControlFlag (in, AIL_INT64)

Reserved for future expansion and must be set to M_DEFAULT.

Copyright © 2026 Zebra Technologies.