Machine Learning Based Currency Note Recognition Using Python
Machine Learning Based Currency Note Recognition Using Python
ABSTRACT
This paper presents currency recognition for the blind people. The proposed system can be utilized for automated
currency recognition using image processing techniques. This algorithm designed for recognizing denomination
value of paper currencies only. The designed system displays denomination value and also generates voice output
stating value of currency note. Thus, a person can know denomination value just by putting currency in front of the
digital camera. Even this system can be greatly useful for people who cannot read on currency note. It works as an
artificial intelligence agent for people in identifying currencies. This system is based on machine learning as it uses
supervised learning method by utilising the information present in the database to identify currency notes. Here,
denomination value is extracted using predefined qualities like size, colour, text on the note. Our framework can
precisely and rapidly distinguish test notes. It can also be used in forex and ATMs.
Keywords: Image processing techniques, Currency recognition, Denomination value, Forex, ATM.
1. INTRODUCTION
Now a days digital image processing became very popular to develop computer algorithms to perform image processing
on digital images. Digital image processingallows to develop wider range of algorithms for applying to the input data to
avoid problems like the noise and signal distortion while processing. Digital image processing can be modeled in the
practice of multidimensional systems. Thedevelopment and generationof digital image processing are mainly affected
with three factors like the development of computers and mathematics, the demand for a wide range of applications in
agriculture,medical science, industry,military and environmenthas increased. The motivation to improve the quality of
image is to enhance the required details from it. This was focused on humans to increase the distinct visualization of
individuals. If the information is of low-quality then higher quality is obtained by handing the image with
preprocessing schemes. Regular image processing includes picture encoding,compression, reclamation, andupgrade.
Some of the image processing strategies aregradation transformation,geometric correction, noise removal etc.So far
object detection or identification and classification are available with traditional image processing methods. Recently
algorithms are developed using enhanced methods using Machine learning and deep learning methods. The following
sections presents the steps and techniques used for the proposed method of recognizing currency notes.
2. LITERATURE SURVEY
Qing and Xun et.al. [1], two critical thinking methods like Artificial Neural Networks and Gene Algorithm were used
by them. They utilized Gene Algorithm (GA) to diminish the impact increased as more affordable computers and
reliable systems opened up. This provoked image being readied logically, for some committed issues, for instance, TV
standards change. Debnath et. al. [3], troupe neural system for cash acknowledgment of moderate combination and
uncertain beginning loads for Back Propagation (BP) Neural Networks. In this manner, GA-BP is utilized for picture
handling. To prepare the singleton Neural Networks (NNs) in an ENN they utilized denial relationship information.
There are various sorts of notes like new and old notes which are not seen by the machine. In this way, a framework
created utilizing ENN can distinguish them effectively and accurately. As a procedure of testing, various masteries
were utilized by them, similar to 2, 5, 10, 20, 50, 100, and 500 TAKAS. In the first place, they changed over the noted
picture into a dark scale further the picture is compacted which is given to framework as a contribution for
acknowledgment. The framework created utilizing ENN can without much of a stretch recognize the uproarious and
old money notes.
Jahangir and Raja et.al. [5], as a process of Bangladeshi currency recognition they used neural networks. They
implemented it on cheap hardware that has less expensive sensors. They experimented using 8 notes of TAKA that are
trained for recognition using the BP algorithm.
Guo et. al. [4], for recognition of paper currency they proposed the Local Binary Pattern (LBP) algorithm. The LBP is
a simple and high-speed method that is used for characteristic extraction.
Lee and Kims et.al. [2], used a new point, specific point, to arrange an information extraction strategy for
acknowledgment of banknotes. This design purpose is to reduce the recognition time. This method has an excellent low
training period and recognition rate.
. 3. PROPOSED METHOD
Image interpolating is done through resizing or distorting of image pixel grids. To vary total number of pixels image
resizing is needed. Image rotation and correction of lens distortion results in image remapping. Estimating values of
unknown points using known data and getting best precision of pixel's intensity based on neighboring pixel values.
Interpolation algorithms of 2 types: adaptive and non-adaptive. All pixels are treated equally in non-adaptive methods
(like lanczos, nearest neighbor, bicubic, sinc, bilinear, spline) while adaptive (Qimage, Genuine fractals, Photo Zoom
pro) make changes with interpolation. In general, Optical and digital zoom can be achieved using compacted digital
cameras. Optical zoom is more in detail compared to digital zoom for same number of pixels [2].
of math operators is that the procedure is extremely basic and, in this manner, quick. Consistent operators are regularly
used to join two (generally paired) pictures. On account of the number of pictures, the sensible operator is ordinarily
applied in a bitwise way.
3.6 Spatialdomainfiltering
Filtering is a method of an image enhancement. Spatial domain filtering (the modified value for the current pixel is
computed based on both itself and surrounding pixels). Filtering is a neighborhood operation where the value of a
chosen pixel in an output image is taken by applying some algorithm to the pixelvalues in the neighborhood of the
consistent input pixel. A pixels neighborhood is a set of pixels, defined by their locations with respect to chose
pixel. The filter is a kernel of weights organized in a rectangular pattern. The process is making kernel to move along
the image and to perform a multiplication operation and accumulate operation on the pixels enclosed by the kernal.
4.IMPLEMENTATION
OpenCV isused for an AI programming,open-source computer vision library. It was attempted to give the ordinary
establishment to computer vision applications, to stimulate usage of machine perception in business things. OpenCV
makes it straightforward for associations to use,change code.The above-stated library has over 2500 optimized methods,
and it also contains a comprehensive set of both state of the art,classic computer vision and machine learning
algorithms.These are used to identify faces,objects, differentiate human actions in video clips, track moving things and
camera movements then generates 3D models of objects along with 3D point clouds from cameras, combine generated
points of image together to get high resolution image of complete visual.Using flash red eyes can be removed from
images and by using it similar images from cloud can be found.Through establishment of markers to overlay it with
augmented reality can be achieved.
4.1 Resizingimagewithfixedaspectratio
1. Scaling is nothing but resizing the image. The size of the image can be determined physicallyand shown using the
scaling factor. It involves usage of various interpolation methods.
2.Translation is the shifting(altering) of an object's position.
3. Rotation operation is to rotate image at desired location with preferred angles.
OpenCV provides a function,cv. getRotationMatrix2D to get above transformation.
4. In affine transformation, all parallel lines in the original pictureare maintained parallel in the output picture too. To
find the above transformation matrix, 3 points from the input picture and their corresponding positions in the output
picture. Then, cv. getAffineTransform will create a 2x3 matrix which is to be passed to cv. warp Affine.
5. For perspective transformation 3x3 transformation matrix is required. Straight lines will remain straight even after
the transformation. To find this transformation matrix, 4 points on the input picture and corresponding points on the
output picture. Out of these 4 points, 3 of them should not be collinear.
4.2 Convertimagetograyscale
Grayscaling is the way toward changing over a picture from other color spaces for example RGB, HSV, CMYK and so
on to shades of dark. It shifts between completely dark and complete white.
Significance of Gray scaling: -
1. Dimension reduction: if we have color RGB image whichhas3 color channels (3D), whereas gray scaled images are
of 1 dimensional.
2. Reduces model complexity: Considering a training neural article on RGB images of 10x10x3 pixels. The input layer
will have 300 input nodes. Whereas, forsimilar neural network requires only 100 input nodes for gray scaled images.
There are various methodsin customized way to work only on gray scaled images, e.g. Canny edge detection function is
pre-implemented in OpenCV library that works on Gray scaled images only.
4.3 Gaussianblur
This operation involves image convolving using Gaussian filter (it is an LPF that removes high frequency components
are reduced) avoiding box filter.
4.4 Thresholding
Thresholding is a method in OpenCV, which is used to assign the pixel values with respect to the threshold value
chosen i.e., each and every pixel value is compared with the selected threshold value. If the value of pixel is smaller
compared to threshold, then that pixel is set to ‘0’or else, that is set to a maximum pixel value (in gray image it is
generally 255). Thresholding is one of the very popular segmentation technique, used for separation of an object
nothing but a fore-ground from the background. A threshold is nothing but a value which provides2 regions likemore
than the threshold or less than the threshold. This thresholdingtechnique is wilely used in Computer Visionon
grayscale images. At the beginning, the selected image is converted into grayscale image.
Parameters:
a. source: It is an array of input Image whichshould be in Grayscale color space.
b. threshold Value: Value of Threshold below and above which pixel values changeaccordingly.
c. max Val: Maximum value that can be given to a pixel.
d. thresholding Technique: some kind of thresholding to be applied.
This is a basic Binary Thresholding method. For each pixel, the same threshold value is applied. By comparing with
threshold value, if the pixel value is less than the threshold, then the pixel is set to ‘0’or else set to a highestvalue (255)
[8].
4.5 Buildingrobustcurrencyrecognitionsystem
This system begins with taking picture of currency note and tries to identify the note. During identification process
system uses image processing methods like pre-processing, edge detection, segmentation, etc. The problems may
generate in the process due to surface damage of note, sharpness issues, noise levels. These are to be taken care to avoid
system failures. The highlight in the process is pattern matching. In case of occurrence of any errors system generates
exceptions like "incomplete image", "recognition failure", etc. Flowchart of currency recognition system is shown in
figure 1.
transformation. Then another estimation of the pixel is made. A neighbor of the pixel is including with some various
pixels results in building up a system, the size of the structure is an odd number, the target pixel is arranged on the
focal point of the matrix.
Convolution is used to perform picture smoothing. As the underlying advance, we center our filter over a pixel that will
be isolated. The filters coefficients are expanded by the pixel values underneath and the results are incorporated. The
center pixel regard is changed to the new decided value. There are a few methods to deal with these circumstances:
1. Zero padding: all filter values outside or at boundary of the image are set to ‘0’.
2. Wrapping: All filter values outside image are set to its ‘reflection’ value.
3. Convolution start in second column and row.
4. Unfiltered columns and rows will get copied to the resultant picture.
Using a Gaussian operator to blur the image and suppress noise, it could be seen as perfect limit which is easy to
indicate. We make components in Gaussian. Filter is delivered by the code represent previously. Nonetheless, there are
various paths to deal with smooth images, for instance the median filter (for a nonlinear activity). Furthermore, this
perform is frequently utilized in picture preparing to diminish "salt and pepper" disturbance. Median filter is further
effective than convolution to diminish noise and spare edges. Resulting in getting ready with the median filter, the
noise is removed so well, few details are depicted so well on an image. Pattern which is the hugest thing that to find is
additionally clear. Subsequent to evacuating the noises, the following stage is to remove some pointless territory. In
some cases, for specific reasons, few dim lines may appear on the edge of the primary image, which may impact the
accompanying operation. To maintain a strategic distance from this issue, we chop each side somewhere around 10
pixels. Contrasted A4 size paper, currency note is small. In case of getting an image from the scanner, it is a picture
like an A4 paper. After scanning the picture will have heaps of white region encompassing the currency note which are
useless parts. To make the system beneficial, the white area part has to be removed. Since, light condition while getting
images from cutting edge cameras, histogram leveling is performed. Histogram leveling is used to adjust contrast,
brightness of the picture. Various light conditions may influence the outcome. therefore, histogram equalization is
expected to perform [10].
In segmentation, a lot of things are evacuated which are not predictable by an image binarization. To set a breaking
point to pick which one is set to "0" (dull), "1" (white). As a general rule, the things that don't require is set to "1". 2
characteristics have been set for the edge, estimation of the pixel between those 2 thresholds is set to "0" and remaining
to "1". To empty the white region, figuring is made. Clear image by ‘a’ direction, ‘b’ direction(a-b == x-y), then
recognize every pixel's value, in case value doesn't identical to ‘0’ (which infers is surely nonwhite point), note
particular point, by then continue recognizing, in case value counterparts to ‘1’ (which infers is the white point), note
particular point with break the loop. Here, setting the flag to ‘0’ that infers this section or line had checked, it consists
of a dull(black) point. Thusly, this line can be skipped and verify the next line. Here, system notes the points which is
very first time hit dim, white regions. The restriction of top and base can be observed, right, and left. Exactly at
restriction(boundary) of right, left, base and top coordinate of every point is found, afterward currency is isolated
effectively.
Fig. 2 Block diagram of Machine Learning based Currency Note Recognition using Python
4.5.3 Segmentation
From observations we found that unique patterns of each currency can be used to differentiate its various types.
Proportional segmentation is achieved as the position of pattern is not modulated.
4.5.4 Color detection
It implies detection of the primary color of the pictures. There are various kinds of color models like RGB, GREY,
HSV. RGB model is used to find mean of color. The image is represented as axbxp matrix where a is image width, b is
image height and p is number of planes for each pixel store the value of B, R and G. Thus mean of each channel is
calculated. Here the currency note is bisected as the left portion is generally white region and the right portion has
about portrait. Thus, primary color of the image is used to find the currency type.
4.6 Working mechanism
Currency image is captured using a camera of the system and generates a .jpg file of input currency which is then
processed using the CPU of the system and compares with the currency database. Finally, it generates an output
displaying denomination value (eg.:10 rupees,50 rupees, etc.) along with voice output.
5. RESULTS
Input .jpg of Rs. 50 as shown in figure 3 has given to the algorithm. After execution, algorithm gives output in two
ways that is it displays the detected note denomination value and reads the denomination values with the help of
speaker.
The output will display the probability of matching with the existing dataset as shown below and displays the highest
probability of note as the final denomination value.
0 files/20.jpg 16
1 files/50.jpg 17
2 files/100.jpg 15
3 files/500.jpg 11
files/50.jpg has highest matching probability as 17
Detected denomination: Rs. 50
6. CONCLUSION
1. This paper proposes a method for identifying denomination values of varies currencies using Opencv for image
processing techniques. This system is designed mainly using python programming. Usage of primary colors and some
portions present on the currency is the concept used by this algorithm for recognition. Firstly, currency denomination is
found using mean of intensity levels of blue, red and green. Secondly, pattern segmentation of currency with template
matching is done to verify the note. We used image processing to get quick and accurate responses. The damage levels
and quality of sample on note can affect the recognition rate, this may be considered as this system drawbacks. In
future, we expected to modify the system for more currency types with good efficient recognition.
References
[1] Qing, B. and J. Xun, “Currency recognition modeling research-based on BP neural network improved by gene
algorithm”, Proceeding of the 2nd International Conference on Computer Modeling and Simulation, 2010.
[2] Lee, J. and H. Kim, “New recognition algorithm for various kinds of Euro banknotes”, Proceeding of the IEEE
29th Annual Conference of Industrial Electronics Society,2003.
[3] Debnath, K.K., S.U. Ahmed and Md. Shahjahan, “A paper currency recognition system using negatively correlated
neural network ensemble”, Proceedings of 12th International Conference on Computer and Information
Technology, 2009.
[4] Guo, J., Y. Zhao and A. Cai, “A reliable method for paper currency recognition based on LBP”, Proceeding of the
2nd IEEE International Conference on Network Infrastructure and Digital Content, 2010.
[5] Jahangir, N. and A. Raja, “Bangladeshi banknote recognition by neural network with axis symmetrical masks”,
Proceeding of the 10th International Conference on Computer and Information Technology,2007.
[6] Milan Sonka, Vaclav Hlavac, Roger Boyle. Image Processing, Analysis, and Machine Vision Third Edition.
Thomson, 2008.
[7] Rafael C. Gonzalez, Richard E. Woods. Digital Image Processing 2nd edition. Pearson Education, New York,
2001.
[8] Rafael C. Gonzalez, Richard E. Woods, Steven L. Eddins. Digital Image Processing Using MATLAB. Pearson
Education, 2004.
[9] Shapiro, L. G. & Stockman, G. C. Computer Vision. Prentence Hall, 2001.
[10] Shyang-Lih Chang, Li-Shien Chen, Yun-Chung Chung, Sei-Wan Chen, Automatic license plate recognition, IEEE
Transactions on Intelligent Transportation Systems, Vol.: 5, Issue: 1, (2004) 42-53.
[11] Xifan Shi, Weizhong Zhao, and Yonghang Shen, Automatic License Plate Recognition System Based on Color
Image Processing. Springer Berlin /Heidelberg, 2005.