version 1.0.0 (415 KB) by Constantino Carlos Reyes-Aldasoro
Remove shading (or the un-even intensity background) of images


Updated 28 Sep 2021

From GitHub

View License on GitHub

A common phenomenon in biomedical imaging is the presence of spurious intensity variations due to the sample of interest and the technique of acquisition. In light microscopy, the variation may originate from uneven sample thickness, out-of-focus objects (in thick slices), or departure from Kohler illumination and is commonly known as shading. In magnetic resonance imaging, intensity inhomogeneity or bias field may be caused by variation in the radio-frequency (RF) coil uniformity, static field inhomogeneity, RF penetration, as well as the anatomy and position of the sample.

This Matlab Code corrects shading in images retrospectively. The algorithm is fully automatic, the details are described in this paper:
Reyes-Aldasoro, C.C., Retrospective shading correction algorithm based on signal envelope estimation, Electronics Letters (2009), 23 April 2009; Vol. 45, Issue 9, p. 454-456.

Cite As

Constantino Carlos Reyes-Aldasoro (2022). shading-correction (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.