| Customize Help
| Save Settings

MimStatCalculate



Function Map
Synopsis
Calculates and stores a variety of statistics from the specified source image(s).
Syntax
void MimStatCalculate(
MIL_ID StatContextImId, //in
MIL_ID SrcImageBufId, //in
MIL_ID StatResultImId, //in
MIL_INT64 ControlFlag //in
)
Description

This function calculates a variety of statistics for the pixels in the source image(s). Results are stored in the specified statistics result buffer.

This function can take statistics for the specified image (M_STATISTICS_CONTEXT context) or it can accumulate statistics for each pixel across multiple images (M_STATISTICS_CUMULATIVE_CONTEXT context). You must enable the statistical operation to perform using MimControl(). For an M_STATISTICS_CONTEXT context, you can specify a condition that a pixel must satisfy to be included in the calculation using M_CONDITION. Co-occurrence statistics (M_STAT_GLCM...) ignore any specified condition.

You can read the statistics from the result buffer using MimGetResult() or MimGetResult2d(), depending on the statistical operation performed. You can also draw some statistical results, using MimDraw().

Once the statistics image processing context is configured, preprocess the context and result buffer by calling MimStatCalculate() with M_PREPROCESS. If the preprocess operation is not done explicitly (using M_PREPROCESS), it will be done when MimStatCalculate() is first called. When explicitly preprocessing a cumulative statistics image processing context and result buffer, the source image buffer can be set to M_NULL if you set the size that the source buffer will be, using MimControl() with M_SOURCE_SIZE_X and M_SOURCE_SIZE_Y. Note that providing the source image buffer better optimizes future calls.

When working with an M_STATISTICS_CUMULATIVE_CONTEXT context, you can remove the calculated statistics associated with a specified source image from the result buffer by calling MimStatCalculate() with M_REMOVE. To reset the results generated from finding the extremes of each pixel's value (such as, M_STAT_MIN), use M_RESET_EXTREMES.

To reset all the results in the result buffer, free it using MimFree(), and then allocate a new result buffer using MimAllocResult() with M_STATISTICS_RESULT. These actions apply to either context (M_STATISTICS_CONTEXT or M_STATISTICS_CUMULATIVE_CONTEXT).

Note that when working with an M_STATISTICS_CUMULATIVE_CONTEXT context, your source images should have the same dimensions, so that statistics are calculated for the same pixel across the multiple images.

For an M_STATISTICS_CONTEXT, you can limit some of this function's results to a region of an image buffer using a region of interest (ROI) set using MbufSetRegion(). The ROI must be defined in raster format (M_RASTER or M_VECTOR_AND_RASTER). An error is generated if the ROI is only in vector format (M_VECTOR). Not all statistical operations support ROIs; for a list of those that do, see MimControl(). Note that the M_STATISTICS_CUMULATIVE_CONTEXT context does not support ROIs.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
StatContextImId

Specifies the identifier of the image processing context that specifies the statistics to calculate. The image processing context must have been previously allocated using MimAlloc() with either M_STATISTICS_CONTEXT or M_STATISTICS_CUMULATIVE_CONTEXT.

SrcImageBufId

Specifies the identifier of the source image buffer. The buffer used must be a 1-band image buffer.

When preprocessing a multiple statistic image processing context and result buffer, set this parameter to the identifier of a typical source image buffer. To exclude this buffer from preprocessing, set this parameter to M_NULL and set the height and width of the area in the source buffer for which you need statistics, using MimControl() with M_SOURCE_SIZE_X and M_SOURCE_SIZE_Y; otherwise, an error will occur.

If you specify an image buffer that has an ROI associated with it, the ROI must be in raster format; otherwise, you will get an error.

StatResultImId

Specifies the identifier of the result buffer. The buffer must have been allocated using MimAllocResult() with M_STATISTICS_RESULT.

ControlFlag

Specifies the operation to perform on the source image.

function map To specify the operation to perform
Click to summarizeValue Description
Click to summarize M_DEFAULT

Calculates the statistics specified using MimControl().

Click to summarize M_PREPROCESS

Preprocesses the specified image processing context and image processing result buffer. Note that, if not called explicitly, this operation will be performed automatically upon the first call to MimStatCalculate().

If the identifier of the source image buffer is not set to M_NULL, information about the source image buffer will be used in the preprocessing operation.

(summarize)
Click to summarize M_REMOVE

Removes the results related to the specified source image. This removes the results of the calculations, performed on the specified source image, from the accumulated results in the result buffer.

To reset the minimum and maximum statistical results, use M_RESET_EXTREMES. The minimum and maximum statistical results cannot be removed.

Note that this value only works when dealing with a cumulative statistics context (M_STATISTICS_CUMULATIVE_CONTEXT).

(summarize)
Click to summarize M_RESET_EXTREMES

Resets the results generated from M_STAT_MIN, M_STAT_MIN_ABS, M_STAT_MAX, and M_STAT_MAX_ABS operations. Note that, when resetting the minimum and maximum results, the SrcImageBufId parameter is ignored.

Note that this value only works when dealing with a cumulative statistics context (M_STATISTICS_CUMULATIVE_CONTEXT).

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
STATISTICS CONTEXT STATISTICS CUMULATIVE CONTEXT PROC NONE DEFAULT PREPROCESS REMOVE RESET EXTREMES STATISTICS CUMULATIVE CONTEXT