1. A method for automatic localization of objects in a mask, comprising the steps of: building a dictionary of atoms, wherein each atom models the presence of one object at one location; iteratively determining the atom of said dictionary which is best correlated with said mask, until ending criteria are met.