Click here to show toolbars of the Web Online Help System: show toolbars
 

| 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 that satisfy the specified condition in the source image. Results are stored in the specified statistic result buffer.

This function calculates both statistics and co-occurrence statistics. Before using this function to calculate statistics ( M_STAT...), you must enable the statistical operation to perform, using MimControl() and specify the condition (if any) using M_CONDITION. Co-occurrence statistics ( M_STAT_GLCM...) do not require a condition.

You can read the statistics from the result buffer using, MimGetResult(), MimGetResult1d() MimGetResult2d(), respective to the statistical operation performed. You can also draw statistical results, using MimDraw().

Once the statistic 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 preprocessing explicitly, the source image buffer can be set to M_NULL if you set the size of the target area ( MimControl() with M_SOURCE_SIZE_X and M_SOURCE_SIZE_Y) to M_DEFAULT. Note that providing the source image buffer better optimizes future calls.

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

With both the cumulative statistics context or the Statistics image processing context, additional information (such as specific calculated values) can be overridden (by performing the operation again). To reset all the results in the result buffer, free it using MimFree(), and then a allocate new result buffer using MimAllocResult() with M_STATISTICS_RESULT.

The statistics result buffer of a cumulative statistics context can contain the results of an operation performed cumulatively on numerous images by calling this function multiple times, each time using a different source image buffer. Note that in this case, the source images should have the same dimensions, otherwise unpredictable results could occur.

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). If you specify multiple image buffers with an ROI, results are limited to the portion of the ROIs that intersect. Note that not all statistics operations support ROIs; for a list of those that do, see MimControl().

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
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.

(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.

(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