🟧 Image Brightness Contrast Adjustment

Function Description

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

Usage Scenarios

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

  • Visual effect enhancement: Adjust the visual appearance of images to make details clearer and easier to observe and analyze.

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

Input Output

Input

Image: Input images or image lists that need brightness and contrast adjustment.

Output

Result Image: Images or image lists after brightness and contrast adjustment.

Parameter Description

Formula Method

Parameter Description

Directly set precise contrast coefficient and brightness coefficient for dst=src×α+β formula calculation (src represents input image pixel values, dst is output image pixel values, α controls contrast, β controls brightness).

Parameter Adjustment

Contrast Coefficient

  • Value > 1.0: Increase contrast, bright areas in the image become brighter, dark areas become darker.

  • Value < 1.0: Decrease contrast, overall image tone becomes more neutral.

  • Value = 1.0: No change in contrast

Grayscale Coefficient

  • Positive values: Increase brightness, entire image becomes brighter.

  • Negative values: Decrease brightness, entire image becomes darker.

  • Value = 0: No change in brightness.

Parameter Range

Contrast coefficient: [0,30], Default value 0.8

Grayscale coefficient: [-255,255], Default value 0

Mean Value Method

Parameter Description

Calculate image average brightness, and indirectly adjust contrast and brightness through coefficients based on this.

Parameter Adjustment

Contrast Coefficient

  • Value > 1.0: Increase contrast, bright areas in the image become brighter, dark areas become darker.

  • Value < 1.0: Decrease contrast, overall image tone becomes more neutral.

  • Value = 1.0: No change in contrast

Grayscale Coefficient

  • Positive values: Increase brightness, entire image becomes brighter.

  • Negative values: Decrease brightness, entire image becomes darker.

  • Value = 0: No change in brightness.

Parameter Range

Contrast coefficient: [0,10], Default value 1

Grayscale coefficient: [-10,10], Default value 1

Histogram Method

Parameter Description

An automatic adjustment method where the operator automatically analyzes the pixel intensity distribution of the image and stretches it to the entire grayscale range, suitable for quickly and adaptively enhancing image contrast under complex and variable lighting conditions.

Parameter Adjustment

  • Increasing this value: Causes more extreme bright or dark pixel values to be ignored, which may result in loss of details in some bright or dark areas. For example, a value of 25 means the algorithm ignores 12.5% of pixels at each end of the cumulative histogram.

  • Decreasing this value: Adjustment effect is milder, preserving more details.

Parameter Range

[0, 100], Default value: 25