1. A computer-implemented method of recognizing text in an image, comprising: identifying a first plurality of patches within the image; applying, to each patch of the first plurality of patches, a first text detection algorithm that indicates whether a patch contains text, thereby identifying a first set of patches that contain text; determining whether the image represents sparse text or dense text based at least in part on the identified first set of patches; responsive to the image representing sparse text: identifying within the image, using a second text detection algorithm, a second set of patches that contain text, and performing optical character recognition on the second set of patches that contain text to obtain a textual result; responsive to the image representing dense text: performing optical character recognition on the image as a whole to produce the textual result; and storing the textual result.