[Picture of me]

Emily Yu

Williams College Class of 2011
Email Me


[Williams Eph]

Since I couldn't get minMaxLoc working, I decided to write my own code. Since the byte array for the images is four times bigger than the actual dimensions of the image, I had to figure out how to represent the (x, y) coordinates of the image. In this specific case, my result image is 286 x 223. This means my result array is 288 x 223 x 4. So (0, 0) in the image is [0] through [3] in the array, (1, 0) in the image is [4] through [7], etc.

So for each pixel corresponding to 4 indices of the array, I summed up the values of the 4 indices in the array. I then found the maximum and minimum of these sums and the corresponding coordinate points. Then on the result image, I placed magenta and green boxes on the maximum and minimum points, respectively. By looking at these, I can't tell if my minMax method or if the OpenCV templateMatching method is not working properly. Sometimes I get decent maximum points like this:

[good match]

But other times I get bad points like this:

[bad match]

After talking to Professor Betke about this problem, she suggested that I try making the search region for the template smaller. The method I used to find the sub-region to search can be seen here. When this still did not yield good matches to the template, I decided to try to write my own method to calculate the Normalized Correlation Coefficient. The Normalized Correlation Coefficient is as follows:
[ncc equation]
Pt = the number of pixels in the template and