Grayscale World Algorithm (Gray worlds algorithm)

Source: Internet
Author: User

The human visual system has the color constancy, can obtain the invariable characteristic of the object surface color from the changing illumination environment and the imaging condition, but the imaging equipment does not have such regulation function,

Different lighting environment will lead to a certain degree of deviation between the color of the image and the real color, need to choose the appropriate color balance (correction) algorithm, to eliminate the light environment

The effect of color appearance. The gray-scale world algorithm is the most commonly used balance algorithm.

First, gray-scale world algorithm

the gray World algorithm is based on the gray world hypothesis, which assumes that: for an image with a large number of color changes, , the average of three components tends to be the same gray

Degree Value . in the physical sense, the grey World law assumes that the mean value of the average reflection of the light in the natural scenery is a definite value in general, which is approximately "gray

Color ". the color balance algorithm applies this hypothesis to the processing image, which can eliminate the influence of the ambient light from the image and obtain the original scene image.

Algorithm execution steps:

(1) There are generally two ways to determine:

Either take a fixed value (such as half of the brightest grayscale value, eight-bit display is 128);

Either by calculating the three-channel average value of the image, take;

(2) Calculate the gain coefficient of three channels:;; ;

(3) According to von Kries diagonal model, for each pixel in the image , adjust its component Component:

This algorithm is simple and fast, but the algorithm often fails when the image scene color is not rich, especially when large-sized monochrome objects appear.

Note : Von Kries proposed that a diagonal matrix transform can be used to describe the relationship between the surface color of the same object under two illumination conditions. Assumed to perceive under illumination

to the object values are, respectively, according to von Kries diagonal theory there are:


The theory realizes the conversion between different light sources.

Second, the realization of MATLAB

function Test () i=imread (' test.jpg '), Y=grayworld (i), Y=uint8 (y), figure (1), Imshow (I), figure (2), Imshow (y), function y =grayworld (Image) r=image (:,:, 1); G=image (:,:, 2); B=image (:,:, 3); avgr = mean (mean (r)); Avgg = mean (mean (g)); AVGB = mean ( Mean (b)); Avgrgb = [Avgr avgg avgb];grayvalue = (avgr + avgg + avgb)/3scalevalue = Grayvalue./avgrgb;newi (:,:, 1) = ScaleVal UE (1) * R;newi (:,:, 2) = Scalevalue (2) * G;newi (:,:, 3) = Scalevalue (3) * B;Y=NEWI;


Test Results:




Reference:

Http://www.cnblogs.com/Imageshop/archive/2013/04/20/3032062.html

Http://scien.stanford.edu/pages/labsite/1999/psych221/projects/99/jchiang/intro2.html

Http://scien.stanford.edu/pages/labsite/2000/psych221/projects/00/trek/GWimages.html

[1] Xu Xiaozhao, Cai, Liu Xiaomin, ethnomusicology, Shen Lansun. Improved gray-scale world color correction algorithm [J]. Photonics Journal, 2010, 39 (3): 559~564




Grayscale World Algorithm (Gray worlds algorithm)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.