A method of filtering a target pixel in an image comprising: forming, for a kernel of pixels comprising the target pixel and its neighbouring pixels, a data model to model pixel values within the kernel, wherein said forming a data model comprises: determining average gradients β in both x and y directions, from a summation of multiple pixel value differences determined from pairs of pixels located within the kernel; determining, from each pixel in the kernel, an estimated pixel value Î at the target pixel position based on the determined average gradients; and determining a model pixel value Î at the target pixel position by performing a weighted sum of the estimated pixel values Î determined from each of the pixels in the kernel; wherein the formed data model is defined by parameters including the determined average gradients β and the determined model pixel value Î at the target pixel position; calculating a weight for each pixel of the kernel comprising: (i) a geometric term dependent on a difference in position between that pixel and the target pixel; and (ii) a data term dependent on a difference between a pixel value of that pixel and its predicted pixel value according to the data model; and using the calculated weights for the pixels in the kernel to form a filtered pixel value for the target pixel. forming, for a kernel of pixels comprising the target pixel and its neighbouring pixels, a data model to model pixel values within the kernel, wherein said forming a data model comprises: determining average gradients β in both x and y directions, from a summation of multiple pixel value differences determined from pairs of pixels located within the kernel; determining, from each pixel in the kernel, an estimated pixel value Î at the target pixel position based on the determined average gradients; and determining a model pixel value Î at the target pixel position by performing a weighted sum of the estimated pixel values Î determined from each of the pixels in the kernel; wherein the formed data model is defined by parameters including the determined average gradients β and the determined model pixel value Î at the target pixel position; determining average gradients β in both x and y directions, from a summation of multiple pixel value differences determined from pairs of pixels located within the kernel; determining, from each pixel in the kernel, an estimated pixel value Î at the target pixel position based on the determined average gradients; and determining a model pixel value Î at the target pixel position by performing a weighted sum of the estimated pixel values Î determined from each of the pixels in the kernel; wherein the formed data model is defined by parameters including the determined average gradients β and the determined model pixel value Î at the target pixel position; calculating a weight for each pixel of the kernel comprising: (i) a geometric term dependent on a difference in position between that pixel and the target pixel; and (ii) a data term dependent on a difference between a pixel value of that pixel and its predicted pixel value according to the data model; and using the calculated weights for the pixels in the kernel to form a filtered pixel value for the target pixel.