1. A non-transitory computer readable medium containing instructions which, when executed by a computer, perform a process of resizing a dimension of a received image to match or approximately match a corresponding dimension of template image, the process comprising: identifying a first set of lines in a received image and a second set of lines in a template image; selecting a first subset of lines from the first set of lines, and selecting a second subset of lines from the second set of lines, wherein each line of the first subset is longer than a first predetermined minimum length, and wherein each line of the subset is longer than a second predetermined minimum length; calculating distances between subsequent lines in the first subset, and calculating distances between subsequent lines in the second subset; calculating ratios between successive distances in the first subset, and calculating ratios between subsequent distances in the second subset; pairing ratios in the first subset with ratios in the second subset if the differences between two ratios exceeds a predetermined threshold of similarity; for each matching pair of ratios, calculating a ratio similarity coefficient that is less than or equal to a predetermined value; storing each ratio similarity coefficient in a similarity coefficient vector; sorting the similarity coefficient vector; calculating a hypothesis similarity coefficient based at least in part upon the median of the sorted similarity coefficient vector; selecting the hypothesis similarity coefficient with the greatest value from a set of all hypothesis similarity coefficients; and resizing the dimension of the received image based at least in part upon the selected hypothesis similarity coefficient.