Gray World Colour Correction

A colour correction function based on the gray world assumption algortihm.
1.1K Downloads
Updated 25 Mar 2013

View License

A colour correction function based on the gray world assumption algortihm.
Gray world assumption is based on the principal that on average the world is gray. With this principal in mind we deduce that the average pixel value of an Unsigned 8-bit integer image is 127.5. By
calculating the real average pixel value, the scaling value is computed. This scaling value is used to scale the entire image linearly so that the average of the image is 127.5.
In practice the average of each individual channel is used to calculate a separate scaling value for each channel. This way the illumination on the different channel is eliminated
independent.
When using this algorithm it is important to keep the following in mind. An image in which many similar colors are present gives a bad result because the algorithm needs a wide range of colors. Otherwise the algorithm illuminates this dominant color.
This function can be executed on every image represented by both a one-dimensional and three-dimensional matrix.

Cite As

Sander Verhaeven (2024). Gray World Colour Correction (https://www.mathworks.com/matlabcentral/fileexchange/40937-gray-world-colour-correction), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Modify Image Colors in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0