Image Brightness and Contrast Adjustment

Description

This operator adjusts the brightness and contrast of the input image based on pixel transformation formulas to enhance image quality.

Overview

Provides multiple methods to adjust image brightness and contrast.

Scenarios

  • Image preprocessing: Preprocessing before image detection to eliminate the effects of uneven lighting.

  • Visual effect enhancement: Adjusting the visual presentation of the image to make details clearer for observation and analysis.

  • Exposure correction: Correcting overexposed or underexposed images to restore image details.

Inputs and Outputs

Inputs

Image: The input image or list of images requiring brightness and contrast adjustment.

Outputs

Result image: The image or list of images after brightness and contrast adjustment.

Parameters

Adjustment Type

Description

Three adjustment methods are provided: Formula Method, Mean Method, and Histogram Method.

Tuning Instructions

  • Formula Method: Allows direct setting of precise contrast and brightness coefficients for the calculation formula dst = src × α + β (where src is the input pixel value, dst is the output pixel value, α controls contrast, and β controls brightness).

  • Mean Method: Calculates the average brightness of the image and indirectly adjusts contrast and brightness based on coefficients.

  • Histogram Method: An automatic adjustment method that analyzes the pixel intensity distribution and stretches it across the entire grayscale range. Suitable for quickly and adaptively enhancing contrast under complex lighting conditions.

Parameter Range

Values/Range:

  • Formula Method

  • Mean Method

  • Histogram Method

Default: Formula Method

Contrast Coefficient

Tuning Instructions

  • Value > 1.0: Increases contrast; bright areas become brighter, dark areas become darker.

  • Value < 1.0: Decreases contrast; the overall image tone becomes more neutral.

  • Value = 1.0: Contrast remains unchanged.

Parameter Range

[0, 30], Default value: 0.8

Parameter Range

Values/Range: [0, 30]

Default: 0.8

Grayscale Coefficient

Tuning Instructions

  • Positive value: Increases brightness; the entire image becomes brighter.

  • Negative value: Decreases brightness; the entire image becomes darker.

  • Value = 0: Brightness remains unchanged.

Parameter Range

[-255, 255], Default value: 0

Parameter Range

Values/Range: [-255, 255]

Default: 0

Contrast Coefficient

Tuning Instructions

  • Value > 1.0: Increases contrast; bright areas become brighter, dark areas become darker.

  • Value < 1.0: Decreases contrast; the overall image tone becomes more neutral.

  • Value = 1.0: Contrast remains unchanged.

Parameter Range

[0, 10], Default value: 1

Parameter Range

Values/Range: [0, 10]

Default: 1

Grayscale Coefficient

Tuning Instructions

  • Positive value: Increases brightness; the entire image becomes brighter.

  • Negative value: Decreases brightness; the entire image becomes darker.

  • Value = 0: Brightness remains unchanged.

Parameter Range

[-10, 10], Default value: 1

Parameter Range

Values/Range: [-10, 10]

Default: 1

Histogram Clip Percent

Tuning Instructions

  • Increase this value: Causes more extreme bright or dark pixel values to be ignored, which may result in the loss of some details in highlights or shadows. For example, a value of 25 means the algorithm will ignore the top and bottom 12.5% of pixels in the cumulative histogram.

  • Decrease this value: The adjustment effect is milder, retaining more details.

Parameter Range

[0, 100], Default value: 25

Parameter Range

Values/Range: [0, 100]

Default: 25