A method of performing Automatic White Balance to a captured image based in part on an illuminant of a scene in the image, the method comprising: receiving the captured image in RGB format; filtering the captured image to select gray pixels; determining a location of each of the gray pixels in a two-dimensional coordinate grid; determining a plurality of distances in the two-dimensional coordinate grid based on the location of each of the gray pixels in the coordinate grid and a location of each of a plurality of reference illuminant points, wherein the location of each of the plurality of reference illuminant points corresponds to a location of gray objects in the coordinate grid under each of a plurality of reference illuminants, determining an estimation of the illuminant of the scene corresponding to a reference illuminant point having a least distance among the plurality of distances; and applying the white balance gain based on a plurality of predefined white balance gains associated with the estimated illuminant; characterized in that the step of determining the plurality of distances in the coordinate grid either comprises: determining a center of gravity based on locations of the gray pixels in the coordinate grid; and determining the plurality of distances in the coordinate grid as the distances from the center of gravity to the location of each of the plurality of reference illuminant points; or for each reference illuminant point, summing the distances from the location of the reference illuminant point to the location of each of the gray pixel in the coordinate grid; and determining the plurality of distances in the coordinate grid as the plurality of sums, each sum corresponding to a reference illuminant point. receiving the captured image in RGB format; filtering the captured image to select gray pixels; determining a location of each of the gray pixels in a two-dimensional coordinate grid; determining a plurality of distances in the two-dimensional coordinate grid based on the location of each of the gray pixels in the coordinate grid and a location of each of a plurality of reference illuminant points, wherein the location of each of the plurality of reference illuminant points corresponds to a location of gray objects in the coordinate grid under each of a plurality of reference illuminants, determining an estimation of the illuminant of the scene corresponding to a reference illuminant point having a least distance among the plurality of distances; and applying the white balance gain based on a plurality of predefined white balance gains associated with the estimated illuminant; characterized in that the step of determining the plurality of distances in the coordinate grid either comprises: determining a center of gravity based on locations of the gray pixels in the coordinate grid; and determining the plurality of distances in the coordinate grid as the distances from the center of gravity to the location of each of the plurality of reference illuminant points; or for each reference illuminant point, summing the distances from the location of the reference illuminant point to the location of each of the gray pixel in the coordinate grid; and determining the plurality of distances in the coordinate grid as the plurality of sums, each sum corresponding to a reference illuminant point. determining a center of gravity based on locations of the gray pixels in the coordinate grid; and determining the plurality of distances in the coordinate grid as the distances from the center of gravity to the location of each of the plurality of reference illuminant points; or for each reference illuminant point, summing the distances from the location of the reference illuminant point to the location of each of the gray pixel in the coordinate grid; and determining the plurality of distances in the coordinate grid as the plurality of sums, each sum corresponding to a reference illuminant point.