Class WhiteBalance

java.lang.Object
org.monte.media.color.WhiteBalance

public class WhiteBalance extends 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.

Author:
Werner Randelshofer
  • Method Details

    • whiteBalanceGreyworld

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

      public static BufferedImage whiteBalanceGreyworldYCC(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 BufferedImage whiteBalanceGreyworldYUV(BufferedImage img, float[] uvAdjust, boolean all)
      Performs white balance adjustment using the "grey world" assumption as described in [Huo05].
    • whiteBalanceRetinex

      public static BufferedImage whiteBalanceRetinex(BufferedImage img)
    • whiteBalanceQM

      public static BufferedImage whiteBalanceQM(BufferedImage img)
    • whiteBalanceGreyworld

      public static double[] whiteBalanceGreyworld(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(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(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)