An image processing device and a computer program product capable of
accurately determining a user-desired region even when a region has been
only roughly marked by a user, wherein a specific region within an image
to be processed is detected; the image to be processed is allocated into a
plurality of blocks; text included in the image to be processed is
recognized; it is determined based on a result of text recognition that
presence and absence of relevance between a first block which is partially
included in the specific region and a second block which is entirely
included in the specific region among the allocated blocks; and it is
determined whether or not an image of the first block should be treated as
an image belonging to the specific region in accordance with a result of
determination as to the relevance.