adjusts the brightness across image, correcting uneven illumination.


uses the correction model given by flatfield, which models the variation in brightness across image.


uses the dark environment model given by darkfield.

Details and Options

  • Local brightness adjustment is also known as flat fielding, and is used for removing image artifacts caused by nonuniform lighting or variations in sensor sensitivities.
  • BrightnessEqualize works with arbitrary 2D and 3D images, adjusting the lightness channel in the LABColor space.
  • A flatfield image is an image of a homogeneous signal like a plain well-lit white background. A darkfield is the same image obtained without lighting. The flat fielding of an image with an object in the same setting is given by (image-darkfield)xMean[flatfield-darkfield]/(flatfield-darkfield).
  • Possible settings for either flatfield or darkfield include:
  • vala constant value val
    corrimagea correction image (rescaled to the image dimensions)
    {scope,model}fit the data into a given model
  • The default flatfield consists of a 2nd order polynomial fit. The default darkfield is assumed to be 0.
  • Using {scope,model}, the flatfield or darkfield is estimated by fitting a function.
  • The scope parameter specifies whether to fit the entire image data or the image projections along each axis. Possible settings include:
  • "Global"fit the entire image to the model
    "Marginal"separately fit model to the projections along each axis
  • The model can be one of the following:
  • nan n-degree polynomial
    f,params,varsan arbitrary model f with parameters params and variables vars
  • The following options are available:
  • Masking Automaticthe regions to use for model estimation
    PerformanceGoalAutomaticaspects of performance to try to optimize
  • Using Masking->Automatic, over- and underexposed pixels are not used for the adjustment.
  • With partially transparent images, the alpha channel is multiplied with the mask.


open allclose all

Basic Examples  (1)

Equalize brightness of a plain texture:

Scope  (7)

Data  (3)

Equalize a grayscale image of a scanned document:

Adjust brightness in an unevenly illuminated color photo:

Adjust brightness of a 3D CT scan image:

Parameters  (4)

Remove uneven illumination in a microscopy image by estimating the brightness distribution:

Fitting a multivariate polynomial of first order on the entire image domain:

Using a second-order polynomial:

Fitting second-order univariate polynomials to the image marginals in each direction:

Using a flatfield image:

Remove a vignette effect by fitting the lightness channel to a given model:

Assuming a rotationally symmetric, radial-dependent vignette:

Assuming a Gaussian vignette:

Perform a subtractive correction on an astronomical image by estimating the dark field:

Options  (1)

Masking  (1)

By default, an automatic mask is used:

Equalize brightness based on the image background:

Applications  (7)

Achieve a constant luminosity of the Moon surface:

Equalize brightness of a microscopy image:

Identify the background:

Equalize brightness distribution assuming a homogeneous background:

Equalize color distribution by handling each channel separately:

Remove uneven illumination from a scanned document:

Create a mask to omit text in the subsequent equilibration:

Equalize brightness distribution fitting a sixth-order polynomial:

This improves the text recognition result:

Equalize the brightness distribution without a mask applying a horizontal fit:

This also improves the text recognition result:

Reduce the vignette effect of a photograph:

Compute a mask for the background that is expected to have even illumination:

Equalize image brightness:

Remove CCD artifacts from an image taken by a low-quality camera with many pixel defects.

Flat-field image of the camera:

Microscopy image of a tear drop:

Flat-field correction:

Correct uneven illumination in an MR scan:

Use only muscle tissue for brightness estimation:

Correct uneven brightness in a 3D magnetic resonance volume:

Note the reduced brightness toward the perimeter of the volume:

Select the muscle tissue to estimate the brightness distribution:

Estimate the brightness distribution by a polynomial in cylindrical coordinates of even orders up to 4:

Compare the initial volume and the result with equalized brightness:

Wolfram Research (2017), BrightnessEqualize, Wolfram Language function,


Wolfram Research (2017), BrightnessEqualize, Wolfram Language function,


Wolfram Language. 2017. "BrightnessEqualize." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2017). BrightnessEqualize. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_brightnessequalize, author="Wolfram Research", title="{BrightnessEqualize}", year="2017", howpublished="\url{}", note=[Accessed: 28-May-2024 ]}


@online{reference.wolfram_2024_brightnessequalize, organization={Wolfram Research}, title={BrightnessEqualize}, year={2017}, url={}, note=[Accessed: 28-May-2024 ]}