Matching white balance is not a trivial task. The easiest way is to take the gray world and scale the RGB channels of one image so that they match the average RGB values of the other. This will work easily when the scenes are shifted towards the color (instead of gray). You can improve it by rejecting dark / bright pixels, etc. There are tons of paper on white balance. Find an algorithm for estimating the color temperature of an image, and then determine which one is more suitable for scene / camera settings and image normalization.
, .
, , , . .
:
: HP
+ : dcraw