MIL_ID AdaptiveEqualizeContextImId, | //in |
MIL_ID SrcImageBufId, | //in |
MIL_ID DstImageBufId, | //in |
MIL_INT64 ControlFlag | //in |
This function enhances the contrast of the specified source image by applying a Contrast Limited Adaptive Histogram Equalization (CLAHE). The resulting image is placed in the destination image buffer.
This function first partitions the specified source image into a set of rectangular sections of equal size, referred to as tiles, and calculates histograms for each one. The histograms are then used to transform the image and produce an enhanced (equalized) version of it. By default, MimHistogramEqualizeAdaptive() uses 8 tiles along the image's X- and Y-direction. To modify the number of tiles, call MimControl() with M_NUMBER_OF_TILES_X and M_NUMBER_OF_TILES_Y. Though MimHistogramEqualizeAdaptive() can take longer to execute than a conventional histogram equalization (MimHistogramEqualize()), it can help minimize the over-amplification of noise and the potential for saturation, particularly in images with inconsistent lighting where some sections are significantly brighter than others.
By default, the maximum percentage of pixels that can be represented by a histogram bin is limited to 1% of all the pixels in its respective tile. Exceeding values are distributed evenly among that histogram's other bins. To modify this behavior, use the M_CLIP_LIMIT control.
You can also modify the number of histogram bins for each tile, as well as the equalization operation performed, using the M_HIST_SIZE and M_OPERATION controls. By default, MimHistogramEqualizeAdaptive() determines the number of histogram bins automatically according to the specified source image and performs a uniform-type of equalization.
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). If you specify multiple image buffers with an ROI, results are limited to the portion of the ROIs that intersect.
Specifies the identifier of the adaptive histogram equalization context. The context must have been allocated using MimAlloc() with M_HISTOGRAM_EQUALIZE_ADAPTIVE_CONTEXT.
Specifies the identifier of the source image buffer. The buffer must be a 1-band, 8- or 16-bit image buffer allocated using MbufAlloc...() with M_IMAGE + M_PROC. The type of the source image buffer must be the same as the destination image buffer. To inquire this information, use MbufInquire() with M_TYPE.
Specifies the identifier of the destination image buffer. The buffer must be a 1-band, 8- or 16-bit image buffer allocated using MbufAlloc...() with M_IMAGE + M_PROC. The type of the destination image buffer must be the same as the source image buffer. To inquire this information, use MbufInquire() with M_TYPE.
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.
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |