This paper proposes a novel edge detection method for both gray level images and color images. The 3 x 3 mask in the image is considered and two pixel sets S-0 and S-1 in the mask are used to define an objective function. The values of the objective funct