1. An image processing apparatus for character recognition, the apparatus comprising: a format character string acquisition unit configured to acquire a format character string that defines a format of the character string of each line; a character region setting unit configured to extract, from the image, character elements which are groups of pixels configuring characters, and set a plurality of character regions so as to include the character elements respectively; and a line recognition unit configured to divide the plurality of character regions into a plurality of lines, by executing a line extraction process for extracting a combination of character regions that are estimated to belong to the same line as a result of sequentially linking, starting from a certain character region, character regions that satisfy a predetermined adjacency condition, the line extraction process being repeatedly executed with different starting character regions, wherein, when there is a possibility that a third character region is redundantly selected in both a case where the line extraction process is performed starting from a first character region and a case where the line extraction process is performed starting from a second character region located in a line different from a line containing the first character region, the line recognition unit: sets, as a first candidate, a plurality of lines that are generated when incorporating the third character region into the line starting with the first character region, and as a second candidate, a plurality of lines that are generated when incorporating the third character region into the line starting with the second character region; and compares a degree of similarity between a format of a character string recognized from each of the lines of the first candidate and a format of a character string of each of the lines defined by the format character string, with a degree of similarity between a format of a character string recognized from each of the lines of the second candidate and the format of the character string of each of the lines defined by the format character string, and employs the candidate with the higher degree of similarity.