Copyright 2012-04-26 Werner Randelshofer

org.monte.media.image
Class WhiteBalance

java.lang.Object
  extended by org.monte.media.image.WhiteBalance

public class WhiteBalance
extends java.lang.Object

WhiteBalance.

References:
[Ken09] Kenfack, Pierre Marie (2009). Implementierung und Vergleich verschiedener Algorithmen zur Bildsensorkalibrierung. Fraunhofer ITWM. http://www.itwm.fraunhofer.de/fileadmin/ITWM-Media/Abteilungen/BV/Pdf/ Diplomarbeit_Kenfack.pdf

[Lam05] Edmund Lam, Combining gray world and retinex theory for automatic white balance in digital photography, Consumer Electronics, 2005. (ISCE 2005). Proceedings of the Ninth International Symposium on (2005), pp.134–139.

[Huo05] Huo Yun-yan, Chang Yi-lin, Wang Jing, Wei Xiao-xia. (2005). Robust Automatic White Balance Algorithm using Gray Color Points in Images.

Version:
$Id: WhiteBalance.java 165 2012-01-31 20:34:46Z werner $
Author:
Werner Randelshofer

Method Summary
static java.awt.image.BufferedImage whiteBalanceGreyworld(java.awt.image.BufferedImage img)
          Performs white balance adjustment using the "grey world" assumption as described in [Ken09].
static double[] whiteBalanceGreyworld(javax.media.jai.Histogram rgbHist)
          Computes the white balance of an image using the Greyworld algorithm.
static java.awt.image.BufferedImage whiteBalanceGreyworldYCC(java.awt.image.BufferedImage img, float[] ccAdjust, boolean all)
          Performs white balance adjustment using the "grey world" assumption as described in [Huo05], but using the YCbCr color space instead of YUV.
static java.awt.image.BufferedImage whiteBalanceGreyworldYUV(java.awt.image.BufferedImage img, float[] uvAdjust, boolean all)
          Performs white balance adjustment using the "grey world" assumption as described in [Huo05].
static java.awt.image.BufferedImage whiteBalanceQM(java.awt.image.BufferedImage img)
           
static double[] whiteBalanceQM(javax.media.jai.Histogram rgbHist)
          Computes the white balance of an image using the Quadratic Mapping (QM) algorithm.
static double[] whiteBalanceQM(long[][] rgbBins)
           
static java.awt.image.BufferedImage whiteBalanceRetinex(java.awt.image.BufferedImage img)
           
static double[] whiteBalanceRetinex(javax.media.jai.Histogram rgbHist)
          Computes the white balance of an image using the Retinex algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

whiteBalanceGreyworld

public static java.awt.image.BufferedImage whiteBalanceGreyworld(java.awt.image.BufferedImage img)
Performs white balance adjustment using the "grey world" assumption as described in [Ken09].


whiteBalanceGreyworldYCC

public static java.awt.image.BufferedImage whiteBalanceGreyworldYCC(java.awt.image.BufferedImage img,
                                                                    float[] ccAdjust,
                                                                    boolean all)
Performs white balance adjustment using the "grey world" assumption as described in [Huo05], but using the YCbCr color space instead of YUV.


whiteBalanceGreyworldYUV

public static java.awt.image.BufferedImage whiteBalanceGreyworldYUV(java.awt.image.BufferedImage img,
                                                                    float[] uvAdjust,
                                                                    boolean all)
Performs white balance adjustment using the "grey world" assumption as described in [Huo05].


whiteBalanceRetinex

public static java.awt.image.BufferedImage whiteBalanceRetinex(java.awt.image.BufferedImage img)

whiteBalanceQM

public static java.awt.image.BufferedImage whiteBalanceQM(java.awt.image.BufferedImage img)

whiteBalanceGreyworld

public static double[] whiteBalanceGreyworld(javax.media.jai.Histogram rgbHist)
Computes the white balance of an image using the Greyworld algorithm.

The Greyworld algorithm assumes that the average color of an image should be a neutral gray: avg(R)=avg(G)=avg(B).

References:
Edmund Lam, Combining gray world and retinex theory for automatic white balance in digital photography, Consumer Electronics, 2005. (ISCE 2005). Proceedings of the Ninth International Symposium on (2005), pp.134–139.

Kenfack, Pierre Marie. (2009). Implementierung und Vergleich verschiedener Algorithmen zur Bildsensorkalibrierung. Fraunhofer ITWM. http://www.itwm.fraunhofer.de/fileadmin/ITWM

Parameters:
rgbHist -
Returns:
a 3x3 matrix which performs the color correction matrix*[R,G,B].

whiteBalanceRetinex

public static double[] whiteBalanceRetinex(javax.media.jai.Histogram rgbHist)
Computes the white balance of an image using the Retinex algorithm.

References:
Edmund Lam, Combining gray world and retinex theory for automatic white balance in digital photography, Consumer Electronics, 2005. (ISCE 2005). Proceedings of the Ninth International Symposium on (2005), pp.134–139.

Kenfack, Pierre Marie. (2009). Implementierung und Vergleich verschiedener Algorithmen zur Bildsensorkalibrierung. Fraunhofer ITWM. http://www.itwm.fraunhofer.de/fileadmin/ITWM

Parameters:
rgbHist -
Returns:
a 3x3 matrix which performs the color correction matrix*[R,G,B].

whiteBalanceQM

public static double[] whiteBalanceQM(javax.media.jai.Histogram rgbHist)
Computes the white balance of an image using the Quadratic Mapping (QM) algorithm. QM is a combination of the Greyworld and the Retinex algorithm. And usually gives better results.

References:
Edmund Lam, Combining gray world and retinex theory for automatic white balance in digital photography, Consumer Electronics, 2005. (ISCE 2005). Proceedings of the Ninth International Symposium on (2005), pp.134–139.

Kenfack, Pierre Marie. (2009). Implementierung und Vergleich verschiedener Algorithmen zur Bildsensorkalibrierung. Fraunhofer ITWM. http://www.itwm.fraunhofer.de/fileadmin/ITWM

Returns a vector with 4 values: Rmu, Rnu, Bmu, Bnu. These values can be put into a 3x6 matrix as shown below:

 
                                     [ R
                                       G
                                       B
 [R'    [ Rnu  0   0  Rmu  0   0       R^2
  G'  =    0   1   0   0   0   0    *  G^2
  B']      0   0  Bnu  0   0  Bmu ]    B^2 ]

Parameters:
rgbHist -
Returns:
a vector with the values {Rmu, Rnu, Bmu, Bnu}.

whiteBalanceQM

public static double[] whiteBalanceQM(long[][] rgbBins)

Copyright 2012-04-26 Werner Randelshofer