An annular window-shaped structuring element is provided for image processing
to remove speckles from a scanned image. The window-shaped structuring element
is composed of two differently sized squares sharing the same geometric center-point.
The pixel to be analyzed with the structuring element is at the center-point. The
structuring element is used in a method to remove speckles from binary, grayscale,
and/or color images by first eroding the image, detecting speckles relative to
other pixels in the image, and removing declared speckles. The method may additionally
include a halftoning module to protect halftone images.