A method for computing a unique identifier for a gemstone having facets separated by facet edges, comprising: - acquiring a 2D digital master image (MI, MIn, MIw) of the gemstone with a digital photographic imaging device, the digital image comprising a 2D array of pixels having a pixel value, where an image of a reference mark on the gemstone is included in the master image at a reference location with a reference orientation, thus defining a master image referential (OR, XR, YR) based on the reference location and on the reference orientation; - using a predefined virtual selection mask wherein the virtual selection mask comprises a series of distinct selection zones, and matching the virtual selection mask with the master image according to a predefined virtual selection mask position and predefined virtual selection mask orientation with respect to the master image referential; - defining, in the master image, a plurality of distinct selected zones (SZ') corresponding to the location of the selection zones of the matched mask; - detecting, in each of the plurality of distinct selected zones of the master image, the presence or not of at least one facet edge portion image; - in the presence of at least one detected facet edge portion image, defining a location of the detected facet edge portion images in the master image; - computing a unique identifier based on the defined locations of the detected facet edge portion images - wherein a selection zone of the virtual selection mask is defined by a selection path curve (Pi) associated with an analysis window having an analysis area measured in pixels, a selected zone in the master image being the array of pixels of the master image which are covered by the analysis window when the analysis window of a corresponding selection zone of the matched virtual selection mask is circulated along the associated selection path curve, - and assigning, as a defined location of a facet edge portion image, a value representative of a position of the analysis window for which a facet edge portion image is detected. - acquiring a 2D digital master image (MI, MIn, MIw) of the gemstone with a digital photographic imaging device, the digital image comprising a 2D array of pixels having a pixel value, where an image of a reference mark on the gemstone is included in the master image at a reference location with a reference orientation, thus defining a master image referential (OR, XR, YR) based on the reference location and on the reference orientation; - using a predefined virtual selection mask wherein the virtual selection mask comprises a series of distinct selection zones, and matching the virtual selection mask with the master image according to a predefined virtual selection mask position and predefined virtual selection mask orientation with respect to the master image referential; - defining, in the master image, a plurality of distinct selected zones (SZ') corresponding to the location of the selection zones of the matched mask; - detecting, in each of the plurality of distinct selected zones of the master image, the presence or not of at least one facet edge portion image; - in the presence of at least one detected facet edge portion image, defining a location of the detected facet edge portion images in the master image; - computing a unique identifier based on the defined locations of the detected facet edge portion images - wherein a selection zone of the virtual selection mask is defined by a selection path curve (Pi) associated with an analysis window having an analysis area measured in pixels, a selected zone in the master image being the array of pixels of the master image which are covered by the analysis window when the analysis window of a corresponding selection zone of the matched virtual selection mask is circulated along the associated selection path curve, - and assigning, as a defined location of a facet edge portion image, a value representative of a position of the analysis window for which a facet edge portion image is detected.