Advanced Hough-based on-device document localization
AssigneeSmart Engines Service, LLC
InventorsDaniil Vyacheslavovich Tropin, Aleksandr Mikhailovich Ershov, Dmitry Petrovich Nikolaev, Vladimir Viktorovich Arlazarov
Life of this patent
Estimating the term…
Abstract
Advanced Hough-Based On-Device Document Localization. In an embodiment, lines are detected in an input image of a document. The lines are searched for candidate quadrilaterals. For at least a subset of the found candidate quadrilaterals, a contour score is calculated, and the candidate quadrilaterals are saved or discarded based on their contour scores. For each saved candidate quadrilateral, a contrast score is calculated. A final candidate quadrilateral is selected, based on the combined contour and contrast scores for the saved candidate quadrilaterals, to represent the borders of the document.
Claims20
A method comprising using at least one hardware processor to:
- receive an input image of a document, the input image comprising pixel data captured by an image sensor;
- detect a plurality of edges in the document by processing the pixel data of the input image;
- detect a plurality of lines based on the plurality of edges using a computer-implemented line detection algorithm;
- search the plurality of lines for combinations of the plurality of lines that represent a plurality of new candidate quadrilaterals;
- for each of at least a subset of the plurality of new candidate quadrilaterals,
- calculate a contour score for each new candidate quadrilateral,
- when a saved set of candidate quadrilaterals has not yet reached a predetermined maximum size K, add said new candidate quadrilateral to the saved set, and,
- when the saved set of candidate quadrilaterals has reached the predetermined maximum size K,
- when the contour score of said new candidate quadrilateral is not greater than a contour score of any candidate quadrilateral in the saved set, discard the new candidate quadrilateral, and,
- when the contour score of said new candidate quadrilateral is greater than a contour score of at least one candidate quadrilateral in the saved set, discard a candidate quadrilateral with a lowest contour score from the saved set, and add said new candidate quadrilateral to the saved set, such that the saved set never exceeds the predetermined maximum size K;
- after the search, for each candidate quadrilateral in the saved set,
- calculate a contrast score for each candidate quadrilateral, and
- calculate a combined score from the contour score and the contrast score calculated for each candidate quadrilateral;
- and
- select a candidate quadrilateral having a highest combined score from the saved set to represent borders of the document.
A system comprising:
- at least one hardware processor;
- and
- software configured to, when executed by the at least one hardware processor,
- receive an input image of a document, the input image comprising pixel data captured by an image sensor;
- detect a plurality of edges in the document by processing the pixel data of the input image;
- detect a plurality of lines based on the plurality of edges using a computer-implemented line detection algorithm;
- search the plurality of lines for combinations of the plurality of lines that represent a plurality of new candidate quadrilaterals,
- for each of at least a subset of the plurality of new candidate quadrilaterals,
- calculate a contour score for each new candidate quadrilateral,
- when a saved set of candidate quadrilaterals has not yet reached a predetermined maximum size K, add said new candidate quadrilateral to the saved set, and,
- when the saved set of candidate quadrilaterals has reached the predetermined maximum size K,
- when the contour score of said new candidate quadrilateral is not greater than a contour score of any candidate quadrilateral in the saved set, discard the new candidate quadrilateral, and,
- when the contour score of said new candidate quadrilateral is greater than a contour score of at least one candidate quadrilateral in the saved set, discard a candidate quadrilateral with a lowest contour score from the saved set, and add said new candidate quadrilateral to the saved set, such that the saved set never exceeds the predetermined maximum size K;
- after the search, for each candidate quadrilateral in the saved set,
- calculate a contrast score for each candidate quadrilateral, and
- calculate a combined score from the contour score and the contrast score calculated for each candidate quadrilateral;
- and
- selecta candidate quadrilateral having a highest combined score from the saved set to represent borders of the document.
A non-transitory computer-readable medium having instructions stored therein, wherein the instructions, when executed by a processor, cause the processor to:
- receive an input image of a document, the input image comprising pixel data captured by an image sensor;
- detect a plurality of edges in the document by processing the pixel data of the input image;
- detect a plurality of lines based on the plurality of edges using a computer-implemented line detection algorithm;
- search the plurality of lines for combinations of the plurality of lines that represent a plurality of new candidate quadrilaterals;
- for each of at least a subset of the plurality of new candidate quadrilaterals,
- calculate a contour score for each new candidate quadrilateral,
- when a saved set of candidate quadrilaterals has not yet reached a predetermined maximum size K, add said new candidate quadrilateral to the saved set, and,
- when the saved set of candidate quadrilaterals has reached the predetermined maximum size K,
- when the contour score of said new candidate quadrilateral is not greater than a contour score of any candidate quadrilateral in the saved set, discard the new candidate quadrilateral, and,
- when the contour score of said new candidate quadrilateral is greater than a contour score of at least one candidate quadrilateral in the saved set, discard a candidate quadrilateral with a lowest contour score from the saved set, and add said new candidate quadrilateral to the saved set, such that the saved set never exceeds the predetermined maximum size K;
- after the search, for each candidate quadrilateral in the saved set,
- calculate a contrast score for each candidate quadrilateral, and
- calculate a combined score from the contour score and the contrast score calculated for each candidate quadrilateral;
- and
- select a candidate quadrilateral having a highest combined score from the saved set to represent borders of the document.
Dependencies are inferred from the claim text.