1. A method of identifying a two-dimensional bar code in digital image data of the bar code, the bar code comprising first and second type elements arranged in an ordered grid and having an outline that comprises an L-shape solid line without transitions between the first and second type elements, the method comprising: calculating a gradient field from the digital image data, the gradient field specifying a gradient of the pixel value in the digital image data; calculating gradient magnitude data from the gradient field; performing a thresholding operation on the calculated gradient magnitude data and obtaining edge segment image data; detecting linear segments in the edge segment image data; identifying pairs of the detected linear segments based on an angular criterion between two of the detected linear segments and based on a distance criterion considering a distance between one extremity of each of the two linear segments; and sampling partial digital image data corresponding to a rectangle area in the digital image data and detecting a presence of the first and second type elements in partial digital image data, the rectangle area being defined by one of the identified pairs of detected linear segments.