equ_histo_image_rectequ_histo_image_rectEquHistoImageRectEquHistoImageRectequ_histo_image_rect (Operator)

Name

equ_histo_image_rectequ_histo_image_rectEquHistoImageRectEquHistoImageRectequ_histo_image_rect — Histogram linearization within a rectangluar mask.

Signature

equ_histo_image_rect(Image : ImageEquHisto : Mode, MaskWidth, MaskHeight, MaxContrast : )

Herror equ_histo_image_rect(const Hobject Image, Hobject* ImageEquHisto, const char* Mode, const Hlong MaskWidth, const Hlong MaskHeight, double MaxContrast)

Herror T_equ_histo_image_rect(const Hobject Image, Hobject* ImageEquHisto, const Htuple Mode, const Htuple MaskWidth, const Htuple MaskHeight, const Htuple MaxContrast)

void EquHistoImageRect(const HObject& Image, HObject* ImageEquHisto, const HTuple& Mode, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& MaxContrast)

HImage HImage::EquHistoImageRect(const HString& Mode, Hlong MaskWidth, Hlong MaskHeight, const HTuple& MaxContrast) const

HImage HImage::EquHistoImageRect(const HString& Mode, Hlong MaskWidth, Hlong MaskHeight, double MaxContrast) const

HImage HImage::EquHistoImageRect(const char* Mode, Hlong MaskWidth, Hlong MaskHeight, double MaxContrast) const

HImage HImage::EquHistoImageRect(const wchar_t* Mode, Hlong MaskWidth, Hlong MaskHeight, double MaxContrast) const   (Windows only)

static void HOperatorSet.EquHistoImageRect(HObject image, out HObject imageEquHisto, HTuple mode, HTuple maskWidth, HTuple maskHeight, HTuple maxContrast)

HImage HImage.EquHistoImageRect(string mode, int maskWidth, int maskHeight, HTuple maxContrast)

HImage HImage.EquHistoImageRect(string mode, int maskWidth, int maskHeight, double maxContrast)

def equ_histo_image_rect(image: HObject, mode: str, mask_width: int, mask_height: int, max_contrast: Union[float, int]) -> HObject

Description

The operator equ_histo_image_rectequ_histo_image_rectEquHistoImageRectEquHistoImageRectEquHistoImageRectequ_histo_image_rect enhances the contrast. Similar to equ_histo_imageequ_histo_imageEquHistoImageEquHistoImageEquHistoImageequ_histo_image, it applies a transformation to linearize the cumulative histogram. However, instead of using the histogram of the whole image, only the local neighborhood of each pixel is considered to compute the transformation. The size of this rectangular neighborhood region can be set by MaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width and MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_height.

The local contrast maximization improves the visibility of low-contrast structures, but also amplifies noise. The parameter MaxContrastMaxContrastMaxContrastMaxContrastmaxContrastmax_contrast can be used to limit the maximum contrast in a local neighborhood, which effectively reduces the amplification of noise. Therefore, the method is also known as Contrast-Limited Adaptive Histogram Equalization (CLAHE).

The parameter ModeModeModeModemodemode determines the processing mode. In the 'accurate'"accurate""accurate""accurate""accurate""accurate" mode, the transformation is computed for each pixel as described above. In the 'fast'"fast""fast""fast""fast""fast" mode, the transformation is computed only for a subset of all pixels and interpolated between those points. Due to the interpolation, the results of both modes can differ significantly.

Attention

The operator equ_histo_image_rectequ_histo_image_rectEquHistoImageRectEquHistoImageRectEquHistoImageRectequ_histo_image_rect primarily serves for optical processing of images for a human viewer. For example, the contrast spreading can lead to a detection of fictitious edges.

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution Information

Parameters

ImageImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte)

Image to be enhanced.

ImageEquHistoImageEquHistoImageEquHistoImageEquHistoimageEquHistoimage_equ_histo (output_object)  (multichannel-)image(-array) objectHImageHObjectHImageHobject * (byte)

Image with linearized gray values.

ModeModeModeModemodemode (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Processing mode.

Default value: 'accurate' "accurate" "accurate" "accurate" "accurate" "accurate"

Suggested values: 'accurate'"accurate""accurate""accurate""accurate""accurate", 'fast'"fast""fast""fast""fast""fast"

MaskWidthMaskWidthMaskWidthMaskWidthmaskWidthmask_width (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the filter mask.

Default value: 51

Suggested values: 31, 51, 101, 151

Typical range of values: 1 ≤ MaskWidth MaskWidth MaskWidth MaskWidth maskWidth mask_width

Minimum increment: 2

Restriction: MaskWidth <= width(Image)

MaskHeightMaskHeightMaskHeightMaskHeightmaskHeightmask_height (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the filter mask.

Default value: 51

Suggested values: 31, 51, 101, 151

Typical range of values: 1 ≤ MaskHeight MaskHeight MaskHeight MaskHeight maskHeight mask_height

Minimum increment: 2

Restriction: MaskHeight <= height(Image)

MaxContrastMaxContrastMaxContrastMaxContrastmaxContrastmax_contrast (input_control)  real HTupleUnion[float, int]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Maximum contrast.

Default value: 0.01

Suggested values: 0, 0.01, 0.02, 0.05, 0.1, 0.5, 1

Typical range of values: 0 ≤ MaxContrast MaxContrast MaxContrast MaxContrast maxContrast max_contrast ≤ 1

Restriction: 0 <= MaxContrast <= 1

Complexity

In ModeModeModeModemodemode='accurate'"accurate""accurate""accurate""accurate""accurate", equ_histo_image_rectequ_histo_image_rectEquHistoImageRectEquHistoImageRectEquHistoImageRectequ_histo_image_rect uses an algorithm with constant complexity per pixel, i.e., the runtime only depends on the size of the input image and not on the mask size.

In ModeModeModeModemodemode='fast'"fast""fast""fast""fast""fast", the number of histograms to be computed depends on the mask size. Hence, the runtime increases with smaller mask sizes and decreases with larger mask sizes.

Possible Successors

disp_imagedisp_imageDispImageDispImageDispImagedisp_image

Alternatives

equ_histo_imageequ_histo_imageEquHistoImageEquHistoImageEquHistoImageequ_histo_image, scale_imagescale_imageScaleImageScaleImageScaleImagescale_image, scale_image_maxscale_image_maxScaleImageMaxScaleImageMaxScaleImageMaxscale_image_max, illuminateilluminateIlluminateIlluminateIlluminateilluminate

See also

equ_histo_imageequ_histo_imageEquHistoImageEquHistoImageEquHistoImageequ_histo_image, scale_imagescale_imageScaleImageScaleImageScaleImagescale_image

References

S. Pizer et al.: “Adaptive Histogram Equalization and Its Variations”. Computer Vision, Graphics, and Image Processing 39, pp. 355-368, 1987.

Module

Foundation