Image Recognizer

Consider an Image represented by a matrix of digits, each digit represents the brightness of a pixel, as shown below. In early image processing, one could detect a particular feature in the image by finding the location where the feature (template) best matches the image. Image: 0101100 0000111 0120120 0332330 0111001 Template: 001111 020020 333300 To do this, you have to calculate, for each point y in the image where the template can fit entirely within the image, the cross-correlation Sxi(x)t(x − y) where i and t are the image and template light function respectively and x runs over all points in the image. The point with maximum cross-correlation is accepted as the location of the feature in the image. Input Develop a program that takes pairs of images — real images (I) and templates (T). The image and templates sizes are variable and never will be greater than 50 by 50 points. The x-axis is horizontal and the y-axis is vertical. The Image starts al location (0, 0) which is the upper-left corner. A character ‘F’ in the input file indicates the end of pairs of images. Output For each pair, use the algorithm above and deliver the point of location (which is the pixel (x,y) in i where t has maximum cross-correlation). Give one answer per line. If a template fits equally in more than one place, the correct answer will be the closest to the upper side, then the closest to the left side. You can take the exact format from the example below. Note: In the example below, the feature is detected at point of location (1,1). Which is the only output line. Sample Input I 0101100 0000111 0120120 0332330 0110001 T 001111 020020 333300 F

2/2 Sample Output (1,1)