Patent ID: 8763908

Claim:
A computer-implemented method of detecting a barcode in an image, the method comprising: under control of one or more computer systems configured with executable instructions, capturing an image of a subject using a camera of an electronic device; dividing at least a portion of the image into a plurality regions; for each region of the plurality of regions, determining a plurality of gradients of a respective region of the plurality of regions; applying a linear approximation to the plurality of gradients of the respective region to yield a dominant gradient direction of the respective region; determining a deviation of each gradient of the plurality of gradients of the respective region from the dominant gradient direction of the respective region to yield a deviation value associated with the respective region; determining that the respective region is a barcode region if the deviation value associated with the respective region is less than a deviation threshold; merging adjacent barcode regions if a difference between the dominant gradient directions of the adjacent barcode regions is less than an orientation threshold; and determining that the merged adjacent barcode regions corresponds to a barcode if the merged adjacent barcode regions satisfy at least one geometric property associated with the barcode.