Corner Detection


Since this program needs to compare similar regions of the bills, we need a way to make the compared regions be the same on both bills. To do this, we consider each bill to have an image region and a border region. The image region of any similar bill is the same size, but the border size may differ from bill to bill. In fact, bills may have slightly different overall sizes. Since we're taking a simple dot product and not a convolution (which would account for any offset in the image), we need to be sure that the features of the test bill are lined up with our samples. To accomplish this, we wrote a corner detector that looks for the upper left and lower right corners of the green image on the bill. Here's how it works:

Detecting the corners of the image region is useful, because it shows us where the real information in the image exists. We crop the region between the two corners and size the resulting image to a default size. This allows us to use images of any size or resolution, with any size border.

Our edge detection algorithm assumes that all bills have a fair amount of dark on the edge of their green region, like you see in the picture below:

Corner Picture

We check an L shaped region, with 100 pixels on each leg, and determine if the average is over a tolerance value we have set. It is important to check a fair number of pixels, so dirty bills will not produce false positives and that corners can be detected even if the absolute corner is not dark enough.

The code for the corner detection algorithm can be found in the findedge Matlab script.

With these tolerances, we are able to correctly find the corners on most bills. However, this method is not perfect. For instance a dirty edge on a bill may result in the edge being considered the corner. Also, a slightly rotated image might not result in the correct edge being found. There are many solutions to these problems. One would be a program which searches for the edges of the bill, rotates it to the correct orientation, then starts the edge detection inside the edge so that it will not interfere. Another way is to use a hardware input device which would guarantee the rotation and would have tactile edge detection. One example of this type device is the bill collector on vending machines.

Take me home