pixels of an image are coded as colour vectors specified by rgb values . the image is filtered by calculating new colour vectors for the pixels on a pixel by pixel basis . a new colour vector for a subject pixel is calculated from the average of neighbour pixels in a window around the subject pixel . a first threshold is calculated from the standard deviation of the colour vectors of the neighbour pixels in the window . a second threshold is calculated from the median maximum difference between the values defining the colour vectors of the respective neighbour pixels in the window and the standard deviation of the values . only neighbour pixels having a colour vector that differs from the colour vector of the subject pixel by less than or the same as the first and second thresholds are used in calculation of the new colour vector for the subject pixel .