MIL_ID SrcImageBufId, | //in |
MIL_ID HistResultImId | //in |
This function calculates the histogram (or pixel intensity distribution) of the specified source image and stores the results in the specified result buffer.
You can control the bin size of the calculated histogram, and the number of smoothing iterations to perform on it, by calling MimControl() with M_HIST_BIN_SIZE_MODE and M_HIST_SMOOTHING_ITERATIONS. By default, a histogram has 1 value per bin, and has not been smoothed.
To read the resulting histogram values from the result buffer, use MimGetResult1d() or MimGetResult(), and specify M_CUMULATIVE_VALUE, M_HIST_..., M_PERCENTILE_VALUE, or M_VALUE as the result type.
You can limit 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).
Specifies the identifier of the source image buffer. The image buffer must be 1-band.
Buffer data will be treated as unsigned, if MimControl() with M_HIST_BIN_SIZE_MODE is set to M_DEFAULT or M_REGULAR. That is, floating-point values will be cast to MIL_UINT values before generating the histogram. In this case, unexpected results can occur if a floating-point value exceeds the MIL_UINT range.
Signed buffers are remapped in the result such that the minimum value is 0, if you set M_HIST_BIN_SIZE_MODE to M_FIT_SRC_DATA, M_FIT_SRC_RANGE, or M_FREEDMAN.
8-, 16-, and 32-bit source image buffers are supported, unless you set M_HIST_BIN_SIZE_MODE to M_FREEDMAN. In this case, 8- and 16-bit source image buffers are supported.
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.
The source image buffer must be unsigned monochrome 1- (packed binary), 8- or 16-bit, or floating-point.
Specifies the identifier of the destination for the histogram results. This parameter must be given the identifier of an image processing result buffer that was allocated with MimAllocResult() and has an M_HIST_LIST type.
If the result buffer has fewer entries than the full range of source values, the pixel values that are out of range will not be included in the histogram. If, however, the result buffer has more entries than the full range of source values, the entries that are out of range will have an undetermined value.
Generation of 8-bit histograms has been optimized as a very fast process.
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |