1. A method for transforming a matrix representation of pixels of an image into a vector representation of the image comprising: partitioning the matrix representation of pixels of the image into contiguous homogeneous regions by calculating a gradient to obtain a gradient map, sorting pixels in the gradient map and applying a watershed type morphologic algorithm to the matrix representation of pixels; identifying contours of the contiguous homogeneous regions by applying a vector code contouring algorithm of a chain-code type to every region; and outputting a vector representation of the image produced with the contiguous homogeneous regions and the identified contours, wherein the step of calculating the gradient in order to obtain a gradient map comprises providing a gradient histogram, the step of sorting the pixels is performed on the pixels in the gradient histogram and the method is performed by an image acquisition device or by a personal computer receiving information about the matrix representation of pixels from an image acquisition device.