Euro recognition Algorithm

 

SETTING IN THE CORRECT POSITION

The application allows to make photos of banknotes in different positions (rotated). For this task are necessary algorithms that can detect and change the banknote position to horizontal.

To detect the position first is calculated a quotient of width and heigh of the image, that in Euro banknote always is two. If it is different that two algorithm of Hough is used. The Hough algorithm is modified in the way that detect only vertical lines. For minimizing the number of lines the program is only looking for lines with more neighbours (for image 600 x 200 is 40 neighbours). Then for every line the image is rotated, and program calculates horizontal and vertical histogram and checks if the quotient of width and heigh is near to 2. All of this operations are made using thresholded horizontal image contour that was calculated before.

Arcs for rotation are searched by Hough algorithm, that returns couple of lines with different value of theta. For every theta the program rotates thresholded image, calculate histograms (horizontal and vertical) for locating the new image and check the quotient of width and heigh of the result. If the quotient is very close to 2, algorithm of rotation is finish and program rotate also RGB colour image (using inverse full rotation algorithm for every element R, G and B). If the algorithm is not able to find the position of the banknote, where quotient of width and height is two, then returns the value of arc, that is the closest to two.

After rotation it is important to check the position of the banknote and if it is necessary rotate it 180. This task is quite easy to solve because Euro banknotes has left side lighter than right side. There is just necessary to calculate the number of white pixels of part of the left side and compare with the number of white pixels of the right side.

In this point can be also checked the quality of the image, and if it is in low quality, banknote localisation algorithm is called another time for equalized image. It is important to do this in this point, not before Hough Transform, because the program could lost efficiency. (Hough transform and rotation is slower and more sophisticated that banknote localisation algorithm).