1. A method for processing an input image, the input image comprising a plurality of pixels, the method comprising: generating a base layer portion and a detail layer portion from the input image by carrying out a linear transformation of pixels of a guidance image; determining, for each of the pixels of the guidance image, a variance of the pixel in a surrounding window of pixels; and determining, for each of the pixels of the guidance image, a weight value of the pixel based on the determined variance; wherein the pixels are weighted in the linear transformation according to the determined weight value.