1. A method programmed in a non-transitory memory of a device comprising: a. acquiring an image using a sensor of the device; and b. performing image segmentation on the image in a color space and brightness space simultaneously, wherein performing image segmentation includes classifying gray-level pixels as belonging to a gray-level category, and subdividing remaining pixels into sub-categories by using a color triangle which is divided into sectors.