An electronic device and method may capture an image of an environment, followed by identification of blocks of connected components in the image. A test for overlap of spans may be made, between a span of a block selected (e.g. for having a line of pixels) and another span of an adjacent block located above, or below, or to the left, or to the right of the selected block and when satisfied, these two blocks are merged. Blocks may additionally be tested, e.g., for relative heights of the two blocks, and/or aspect ratio of either or both blocks, etc. Classification of a merged block as text or non-text may use attributes of the merged block, such as location of a horizontal pixel line, number of vertical pixel lines, and number of black-white transitions and number of white-black transitions in a subset of rows located below the horizontal pixel line.
RULES FOR MERGING BLOCKS OF CONNECTED COMPONENTS IN NATURAL IMAGES