1. A computer-readable storage medium that stores a program causing a computer to function as a document recognition apparatus, the program causing said computer to operate as: an extraction unit for extracting connected components of pixels from an input image; a generation unit for generating a reference element that is connected components of pixels extracted by said extraction unit and combined elements obtained by combining the reference element and connected components of pixels adjacent to the reference element as an element to be estimated; a calculation unit for calculating a degree of certainty that indicates how much the element to be estimated generated by said generation unit seems to be a character; and a determination unit for determining elements that seem to be characters among said elements to be estimated based on the degree of certainty calculated by said calculation unit.