Patent ID: 8666185

Claim:
A method for creating a binary mask image from an inputted digital image of a scanned document, comprising the steps of: a) creating a binarized image by binarizing said inputted digital image, b) detecting in said binarized image first text regions representing light text on a dark background in said inputted digital image, c) detecting in said binarized image second text regions representing dark text on a light background in said inputted digital image, d) inverting said first text regions in said binarized image, such that a transformed binary image is formed in which the inverted first text regions are interpretable in the same way as dark text on a light background, e) generating the binary mask image from the transformed binary image by eliminating picture blobs that relate to no actual text elements, wherein the steps of detecting the first and second text regions and the step of inverting the first text regions are performed in a single pass over the binarized image on the basis of pixel blobs contained in the binarized image without analyzing if the first and second text regions represent text, wherein the pixel blobs are processed as soon as they are found and wherein descriptions of said pixel blobs that are being used for said processing are eliminated immediately after said processing.