Skip to content

equ_histo_image_rectEquHistoImageRectEquHistoImageRectequ_histo_image_rectequ_histo_image_rect๐Ÿ”—

Short description๐Ÿ”—

equ_histo_image_rectEquHistoImageRectEquHistoImageRectequ_histo_image_rectequ_histo_image_rect โ€” Histogram linearization within a rectangluar mask.

Signature๐Ÿ”—

equ_histo_image_rect( image Image, out image ImageEquHisto, string Mode, extent.x MaskWidth, extent.y MaskHeight, real MaxContrast )void EquHistoImageRect( const HObject& Image, HObject* ImageEquHisto, const HTuple& Mode, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& MaxContrast )static void HOperatorSet.EquHistoImageRect( HObject image, out HObject imageEquHisto, HTuple mode, HTuple maskWidth, HTuple maskHeight, HTuple maxContrast )def equ_histo_image_rect( image: HObject, mode: str, mask_width: int, mask_height: int, max_contrast: Union[float, int] ) -> HObject

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 )

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)

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

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

Description๐Ÿ”—

The operator equ_histo_image_rectEquHistoImageRect enhances the contrast. Similar to equ_histo_imageEquHistoImage, 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 MaskWidthmaskWidthmask_width and MaskHeightmaskHeightmask_height.

The local contrast maximization improves the visibility of low-contrast structures, but also amplifies noise. The parameter MaxContrastmaxContrastmax_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 Modemodemode determines the processing mode. In the 'accurate'"accurate" mode, the transformation is computed for each pixel as described above. In the '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_rectEquHistoImageRect 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๐Ÿ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

  • Automatically parallelized on channel level.

  • Automatically parallelized on domain level.

Parameters๐Ÿ”—

Imageimageimage (input_object) (multichannel-)image(-array) โ†’ object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject (byte)

Image to be enhanced.

ImageEquHistoimageEquHistoimage_equ_histo (output_object) (multichannel-)image(-array) โ†’ object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject * (byte)

Image with linearized gray values.

Modemodemode (input_control) string โ†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Processing mode.

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

MaskWidthmaskWidthmask_width (input_control) extent.x โ†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the filter mask.

Default: 5151
Suggested values: 31, 51, 101, 15131, 51, 101, 151
Value range: 1 โ‰ค MaskWidth
Minimum increment: 2
Restriction: MaskWidth <= width(Image)

MaskHeightmaskHeightmask_height (input_control) extent.y โ†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the filter mask.

Default: 5151
Suggested values: 31, 51, 101, 15131, 51, 101, 151
Value range: 1 โ‰ค MaskHeight
Minimum increment: 2
Restriction: MaskHeight <= height(Image)

MaxContrastmaxContrastmax_contrast (input_control) real โ†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Maximum contrast.

Default: 0.010.01
Suggested values: 0, 0.01, 0.02, 0.05, 0.1, 0.5, 10, 0.01, 0.02, 0.05, 0.1, 0.5, 1
Value range: 0 โ‰ค MaxContrast โ‰ค 1

Complexity๐Ÿ”—

In Modemodemode='accurate'"accurate", equ_histo_image_rectEquHistoImageRect 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 Modemodemode='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.

Combinations with other operators๐Ÿ”—

Combinations

Possible successors

disp_imageDispImage

Alternatives

equ_histo_imageEquHistoImage, scale_imageScaleImage, scale_image_maxScaleImageMax, illuminateIlluminate

See also

equ_histo_imageEquHistoImage, scale_imageScaleImage

References๐Ÿ”—

S. Pizer et al.: โ€œAdaptive Histogram Equalization and Its Variationsโ€; Computer Vision, Graphics, and Image Processing, vol. 39, no. 3, pp. 355-368, 1987, doi: 10.1016/S0734-189X(87)80186-X.

Philipp Hรคrtinger, Carsten Steger: โ€œAdaptive histogram equalization in constant timeโ€; Journal of Real-Time Image Processing, vol. 21, article 93, 2024, doi: 10.1007/s11554-024-01465-1.

Module๐Ÿ”—

Foundation