Abstract: A method and apparatus for processing images received on an image sensor of rectangular configuration bounded by four outer edges and including a plurality of pixel elements arranged in a rectangular matrix includes the following operations: A. locating an initial rectangular-matrix region consisting of pixel elements determined to be free of an artifact; B. sequentially testing each pixel element along two contiguous outer edges of the image sensor, starting from the initial rectangular-matrix region, to determine whether the pixel value of the tested pixel element is sufficiently large to indicate the probability of an artifact, and for each such pixel element found to have such a pixel value, replacing its pixel value with another having a relation to the pixel value of its closest neighbours found to be free of an artifact, thereby cleaning the respective pixel element; and C. cleaning in a similar manner each of the remaining pixel elements.