Skip to content

Image Enhancer vTool#

The Image Enhancer vTool allows you to improve the contrast of an image by manipulating its histogram.

The Image Enhancer vTool accepts an image via the Image input pin and outputs the filtered image via the Image output pin.

If you use the ROI Creator vTool to specify a region of interest before enhancing, the Image Enhancer vTool accepts the ROI data via its Roi input pin. In that case, only the region of interest is enhanced, which results in faster processing.

Image Enhancer vTool

How It Works#

The Image Enhancer vTool offers two enhancement operations:

Stretch Histogram#

By stretching the histogram, the lower and upper limits of the histogram are modified. All gray values below and equal the lower limit are mapped to the gray value 0. All gray values above and equal the upper limit are mapped to the maximum gray value (i.e., 255 for 8-bit pixel formats or 65535 for the other pixel formats). In mathematical terms, the histogram stretching is a linear transformation defined by the two user-defined limits.

There are two ways to specify the new upper and lower limits of the gray value range:

  • Adaptive: The gray value range is determined by analyzing the individual image's histogram. By specifying a relative rank, you can discard gray value sections at the upper and lower ends of the range.
  • Fixed: You can manually specify the new lower and upper limits of the gray value range. These limits will be the same for all images.

Info

For color images, the adaptive mode works on the three color channels separately. As a consequence, the overall color appearance of the image may change.

Using the fixed mode, the same limits are applied to all color channels.

In fixed mode, processing is so fast that the processing time is negligible. In adaptive mode, the histogram of every image is analyzed but processing is still very fast.

Equalize Histogram#

Equalizing the histogram means that all gray values of an image are distributed evenly across the entire range, e.g., 0–255. By doing this, areas of the histogram with high gray value populations are stretched and areas only sparsely populated are condensed. This results in a linear histogram.

Info

For color images, the three histograms of the color channels are equalized separately. As a consequence, the overall color appearance of the image may change.

Because the histogram and its equalization are computed for every image processed, the processing time depends on the image size.

Use Cases#

Images with Constant Histograms#

In this scenario, the gray value range of the incoming images is constant but a bit low in contrast. For example, if the gray value range is between 0 to 100, you can set the limits to 0 and 100. The resulting images are then stretched to the full gray value range and you get bright images with good contrast.

Images with Varying Histograms#

In this scenario, the gray value range of the incoming images may change over time. However, the application requires constant histograms or gray value contrasts. In this case, you can use the stretching method with adaptive limits or the equalization method.

Use stretching for general use cases. If the gray values in the histogram are distributed very unevenly, it is better to use equalization.

Configuring the vTool#

To configure the Image Enhancer Basic vTool:

Image Enhancer Basic vTool Settings

  1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
    The Image Enhancer Basic dialog opens.
  2. In the Enhancer Operation area, select the desired operation.
  3. If you have selected Stretch histogram, select a stretching method.
    • If you have selected Adaptive, specify a rank.
    • If you have selected Fixed, specify a lower and an upper limit.

You can view the result of the enhancement in a pin data view.

Inputs#

Image#

Accepts images directly from a Camera vTool or from a vTool that outputs images, e.g., the Image Format Converter vTool.

Roi#

Accepts a region of interest from the ROI Creator vTool or any other vTool that outputs regions or rectangles. Multiple rectangles or regions are merged internally to form a single region of interest.

  • Data type: RectangleF, RectangleF Array, Region, Region Array

Outputs#

Image#

Returns the filtered image. The output image can be used by any vTool accepting images as input.

Supported Pixel Formats#

Depending on the pixel format of the input image, the Image Combiner vTool outputs the following pixel formats:

Input Pixel Format Output Pixel Format
Bayer GR 8 RGB 8 Planar
Bayer GR 16 RGB 16 Planar
Bayer RG 8 RGB 8 Planar
BGRA 8 Packed RGB 8 Planar
BGR 8 Packed RGB 8 Planar
Mono 8 Mono 8
Mono 10 Mono 10
Mono 12 Mono 12
Mono 16 Mono 16
RGB 8 Packed RGB 8 Planar
RGB 16 Packed RGB 16 Planar
RGB 8 Planar RGB 8 Planar
RGB 16 Planar RGB 16 Planar

Typical Predecessors#

Typical Successors#

  • Any image processing vTool