The method described below of the present invention has the beneficial characteristics of both prior art methods, and is capable of locating the two-dimensional barcode when it is printed on a document including a complex background such as the dark background 220 of FIG. 4.