1. An image processing method for processing original groups of pixels of an original image to obtain groups of pixels of a final image, each pixel having a pixel value and a pixel position, the method comprising; ordering the pixels in each original group monotonically according to the values of the pixels; for each possible monotonic ordering of pixels in each original group: assigning a value to each pixel according to the position of the pixel in the ordering of pixels to form a corresponding intermediate pixel group; determining, for each pixel in the intermediate pixel group, a pixel value difference or a pixel position difference based on the position of the pixel in the intermediate pixel group and the position of the pixel in the original group of pixels from which the value of the pixel is assigned in the intermediate pixel group; calculating a cumulative sum of pixel value differences or pixel position differences of the pixels of the intermediate pixel group; selecting the intermediate pixel group with the smallest cumulative sum of pixel value differences or the smallest cumulative sum of pixel position differences; for each of the original groups of pixels: determining a filtering intensity based on the cumulative sum of pixel value differences or the cumulative sum of pixel position differences of the corresponding selected intermediate pixel group; and filtering the values of pixels in the corresponding selected intermediate pixel group based on the filtering intensity to provide the corresponding group of pixels for the final image.