Fast multipass underline removal for camera captured OCR
AssigneeAmazon Technologies, Inc.
InventorPradeep Natarajan
Life of this patent
Estimating the term…
Abstract
A system that removes underlines in text appearing in captured images in multiple stages. The improved system rejects most text regions that do not require underline removal quickly and performs detailed underline detection and removal on a small number of regions.
Claims21
A computer-implemented method for removing an underline from a text item before performing optical character recognition on the text item, comprising:
- acquiring an image that comprises the text item including an underline;
- identifying the text item in the acquired image;
- scanning a plurality of vertical columns across a bottom of the text item to determine one or more bottom edges;
- determining a fit line for the one or more bottom edges;
- identifying contiguous pixels extending from the fit line;
- vertically scanning the contiguous pixels in a first stripe to determine a first bottom pixel, a first top pixel, and a first number of transitions along the first stripe, the first number of transitions being a first number of light-to-dark transitions, or a first number of dark-to-light transitions;
- vertically scanning the contiguous pixels in a second stripe to determine a second bottom pixel, a second top pixel, and a second number of transitions along the second stripe, the second number of transitions being a second number of light-to-dark transitions, or a second number of dark-to-light transitions;
- determining that the first number of transitions in the first stripe is equal to one;
- determining that the second number of transitions in the second stripe is greater than one and less than or equal to a first threshold;
- deleting pixels in the image corresponding to the first stripe from the first top pixel to the first bottom pixel;
- deleting pixels in the image corresponding to the second stripe that are proximate to the fit line;
- and
- performing optical character recognition on the image after the pixels are deleted to recognize the text item.
A computing device comprising:
- at least one processor;
- a memory including instructions operable to be executed by the at least one processor to perform a set of actions to configure the at least one processor to:
- acquire an image that comprises a first text item including a first underline;
- determine first contiguous pixels comprising the first underline and pixels extending from the first underline;
- vertically scan the first contiguous pixels in a first stripe to determine a first bottom pixel, a first top pixel, and a first number of transitions along the first stripe, the first number of transitions being a first number of light-to-dark transitions, or a first number of dark-to-light transitions;
- vertically scan the first contiguous pixels in a second stripe to determine a second bottom pixel, a second top pixel, and a second number of transitions along the second stripe, the second number of transitions being a second number of light-to-dark transitions, or a second number of dark-to-light transitions;
- determine that the first number of transitions in the first stripe is equal to one;
- determine that the second number of transitions in the second stripe is greater than one and less than or equal to a first threshold;
- delete first pixels in the image from the first top pixel to the first bottom pixel for the first stripe;
- and
- delete second pixels in the image comprising the first underline for the second stripe.
A non-transitory computer-readable storage medium storing processor-executable instructions for controlling a computing device, comprising program code to configure the computing device to:
- acquire an image that comprises a first text item including a first underline;
- determine first contiguous pixels comprising the first underline and pixels extending from the first underline;
- vertically scan the first contiguous pixels in a first stripe to determine a first bottom pixel, a first top pixel, and a first number of transitions along the first stripe, the first number of transitions being a first number of light-to-dark transitions, or a first number of dark-to-light transitions;
- vertically scan the first contiguous pixels in a second stripe to determine a second bottom pixel, a second top pixel, and a second number of transitions along the second stripe, the second number of transitions being a second number of light-to-dark transitions, or a second number of dark-to-light transitions;
- determine that the first number of transitions in the first stripe is equal to one;
- determine that the second number of transitions in the second stripe is greater than one and less than or equal to a first threshold;
- delete first pixels in the image from the first top pixel to the first bottom pixel for the first stripe;
- and
- delete second pixels in the image comprising the first underline for the second stripe.
Dependencies are inferred from the claim text.