Coin Image Recognition and Research Based on Image Processing

2019-12-26 03:17YangTaoXuWeichangHuangLingxiao
中阿科技论坛(中英文) 2019年4期

Yang Tao,Xu Weichang,Huang Lingxiao

(College of Information Engineering,Ningxia University,Yinchuan,Ningxia 7 500021)

Abstract:The problems of coin recognition,classification and forgery detection affect the circulation and use of coins.Therefore,this paper proposes a coin recognition method based on image processing.Firstly,this paper preprocesses the coin image by using the domain average method,and carries on the edge detection through the mathematical morphology method.Secondly,the geometric features and texture features of the coin are extracted.Finally,the coin and counterfeit coin are identified by weighted Euclidean distance classification method.The results show that the method has a strong adaptability to the influence of the coin's position,environment and light on the coin.Under the condition that the surface wear of coin is not serious,a high recognition rate can be achieved through a large number of sample experiments.

Key words:image preprocessing;mathematical morphology;edge detection;feature extraction;feature recognition

With the rapid development of Chinese economy,self-service system is widely used in transportation,finance,entertainment,business and other fields,which makes the use of coins more and more frequent.There are a large number of coins in circulation and use every day,but the identification,classification and authentication of a large number of coins is an urgent problem to be solved.Public transportation system,automatic selling system and bank staff need to count a large number of coins after identification and elimination of counterfeit,which requires a lot of staff to complete after a long time of operation,which is time-consuming and inefficient.At the same time,the problem of a large number of counterfeit has brought huge losses to the company or enterprise.According to a news of Urban Times in 2008,the loss of fake coins of Kunming bus in one year is about 800,000 yuan[1].Therefore,the study of coin identification is very important.

Coin recognition system has a history of more than 100 years.Foreign coin recognition system developed earlier and its technology is more mature.However,different countries have different monetary systems,the development of a unified coin recognition system for each country is obviously inconsistent with the actual situation.Therefore,it is necessary to develop a corresponding coin recognition system for Chinese unique monetary system.In China,Tsinghua University has developed the YB50 fully automatic coin counting and wrapping machine[2];North China Electric Power University has theoretically designed an allin-one machine with functions of coin sorting,counterfeit detection and packaging[3];Nanjing University of Aeronautics and Astronautics described the eddy current sensor method for coin detection,forgery detection and coin counter from the perspective of sorting[4~5];Hefei University of Technology has proposed a coin counter designed by deductive reasoning;Donghua University has designed a coin counting machine using a disconnecting plate[7].These universities have done indepth theoretical and practical research on how to correctly identify coins.In theory,most of them adopt eddy current method,but there are some problems such as unsystematic,incomplete and poor identification effect.The current coin authentication methods mainly include eddy current method and image processing method:eddy current method is based on the shape and material of the coin to identify the counterfeit,this method is fast,but it is not applicable to the coin with similar shape and material such as game currency;the image processing method is based on the shape,color,texture and other features of the coin to identify false,many researchers used neural network method,texture statistical method,ant colony algorithm,SIFT feature matching algorithm,log-polar transformation and Fourier transform combination method,multi-feature space recognition method and other methods to achieve the counterfeit detection of coins,and have achieved good results.

This paper mainly studies the identification and forgery detection of 4 kinds of mixed coins (1 yuan,5 cents,large 1 cent and small 1 cent),due to the wear of the coin surface and the influence of illumination on the coin surface,it is necessary to preprocess the coin image first,then carry out four types of recognition according to the shape of the coin image,and finally realize the coin counterfeit detection through the image edge detection algorithm.

I.Coin Recognition Based on Image Processing

(i)Preprocessing of Coin Images

Due to the different degrees of wear and tear in the circulation of coins and the influence of different weather light on the surface of coins,the collected coin images cannot be directly identified and authenticated.Therefore,the initial image of the coin needs to be preprocessed,that is,smoothed.The main purpose of smoothing is to eliminate the discrete interference and noise in the initial image of the coin.These random noises may be generated in the process of coin image acquisition,quantization and coin image transmission,the process of eliminating these noises is usually called image preprocessing.

The smoothing filter can reduce or eliminate the high frequency components of the Fourier space,that is because the high frequency components correspond to the part of the image in which the gray value changes greatly,and the smoothing filter has little influence on the low frequency components,because the low frequency components correspond to the part of the image in which the gray value does not change much.The common methods are neighborhood average method,median filtering method and self-adaptive filtering method.This paper uses the neighborhood average method to smooth the coin image.

The neighborhood average method [8]is a local spatial domain processing algorithm.Suppose a digital imagef(x,y)is anarray,and the image after smoothing isg(x,y),its gray value of every pixel is determined by the average of the gray levels of(x,y)and several surrounding pixels,expressed as follows:

In formula (1),x=1,2,...,M;y=1,2,...N,Sis the scheduled neighborhood of pixel(x,y)(not include(x,y)pixel),Kis the total number of coordinate points inS.Suppose noisee(x,y)as additive white noise,the characteristics of this white noise are its mean value is 0,the variance is.The image of noise interference is as follows:

The imageg(x,y)after neighborhood average processing is:

The average value of residual noise after treatment is:

The variance of the residual noise is:

The above formula shows that the variance of residual noise reduces to 1Kof the original after neighborhood average treatment.

The most typical neighborhoodSis neighborhood 4 and neighborhood 8,as shown in the figure,

Figure 1 neighborhood 4

Figure 2 neighborhood 8

The templates of neighborhood 4 and neighborhood 8 are shown above:

The neighborhood 4 template or neighborhood 8 template moves point by point along the horizontal and vertical directions.Since the sum of the coefficients in the template is 1,when the neighborhood 4 template or neighborhood 8 template is used to process the image,the image itself does not change,so as to achieve the purpose of smoothing the whole image.

(ii)Edge Detection of Coin Image

For the preprocessed coin image,Roberts algorithm,Prewitt algorithm,Sobel algorithm and Canny algorithm can be used to detect the coin edge.However,when these common edge detection algorithms are used to detect the coin edge,many false edges will be obtained.

Mathematical morphology[9-10]uses different structural elements to measure the corresponding shape in the coin image,so as to achieve the purpose of detecting the edge of the coin image.Mathematical morphology is a nonlinear filtering method,which can quickly extract better edge details by using structural elements of different shapes.In this paper,the edge of the preprocessed coin image is detected by mathematical morphology.

Mathematical morphology includes two basic operations:corrosion and expansion.

Suppose the original image asI,structural element asb,Iandbare both the set of integer spaceZ.The corrosion ofbtoIis expressed as,that is:

The expansion ofbtoIis expressed as,that is:

In this paper,the results after expansion and corrosion are subtracted,and obtain the edge information and texture information of the coin,as shown in figure 3 and figure 4.

Figure 3 Coin Image after Preprocessed

Figure 4 Figure of Subtracting Results of Expansion Operation and Corrosion Operation

(iii)Feature Extraction of Coin Image

In order to identify a coin,it is also necessary to determine the characteristics of the coin that should be identified in order to generate descriptive parameters.

There are a large number of original features,which mainly include the following points[11].

(1)Coin image geometric features:describing the geometric characteristics of the coin area,with direct viewing,and simple calculation.

(2)Coin image gray statistical features:such as coin image histogram,coin image step interval,coin image cross-correlation features.

(3)Coin image texture features:The texture of the coin image is the visual expression of the gray scale and the change of the color spatial position,such as the shape of the coin,the edge of the coin,the stripe of the coin,the color block of the coin,etc.

(4)Coin image transformation domain features:Various mathematical transformation coefficients of the coin image are taken as the characteristics of the coin image,such as Fourier transform coefficients and Walsh transform coefficients.

(5)Algebraic features of coin images:The coin image is represented as a matrix,and the singular value obtained by the singular value decomposition theory of matrix is used as a group of characteristics of the coin image.

This paper chooses to extract those features with distinction and reliability,including the geometric features of the coin image and the texture features of the coin image.

a.Geometric Feature Extraction of Coin Image

In the process of coin image recognition,it is very important to extract the geometric features based on the coin image.Geometric features describe the geometric properties of the target region,suppose the size of the coin imagef(x,y)as,the geometric features of the coin are defined as follows:

(1)Area

The area of the target is the total number of pixels occupied by the target in the coin image.

(2)Relative Area

The relative area is the ratio of the area of the coin to the total number of pixels in the whole coin image.

(3)Perimeter of the Objective

In the formula,Arepresents the area of the objective,represents the total number of pixels whose pixel values in the neighborhood 4 are all the target points.

(4)Duty Ratio

In the formula,LandWrepresent the length and width of the smallest outer rectangle of the coin,respectively.

(5)Circularity

It is the characteristic quantity defined by all the boundary points of the target.

(6)Eccentricity Ratio

It describes the compactness of the region to a certain extent.The definition of the ratio of long axis and short axis of the target is greatly affected by the shape and noise of the object.However,the eccentricity based on the definition of inertia has a strong anti-jamming ability.

In this formula,the two semi-principal axes of the inertia ellipse(pandq)respectively are:

b.Feature Extraction of Coin Image Texture

Texture feature refers to a surface structure formed by some regular (strong or weak)subpatterns(or texture elements)arranged in a certain order.It reflects an attribute of the object surface,and smoothness,roughness and regularity are its main characteristics[12].Let the image grey value be quantized asjgrey levels,command,and the pixel count ofigrey level is,and the total number of pixels in the whole coin image isM,then the probability of the appearance of grey leveliis:

Takingias abscissa,p(i)as ordinate,then obtain the first order gray histogram.According to the first-order gray value histogram of the coin image,the following texture features can be extracted:

(1)Gray Average

(2)Variance

It is a measure of the dispersion of image gray value distribution.

(3)Measure of Deviation

It is a measure of the deviation of image gray value distribution from symmetry.

(4)Peak Value

It is a measure of whether the image gray value distribution is clustered near the mean value.

(5)Energy Value

It is a measure of whether the gray value of the image is equal to the probability distribution.

(6)Entropy

It is a measure of whether the gray value of the image is equal to the probability distribution.

(iv)Feature Recognition of Coin Image

Pattern recognition is a subject developed at a very fast speed in the early 1960s.It uses computers to classify a specific thing into a certain category according to a certain pattern.The key of pattern classification lies in the design of classifier.The quality of classifier has an important impact on the final recognition effect.In this paper,a weighted Euclidean distance classifier is used to classify and identify coins.

The idea of weighted Euclidean distance classifier is to compare the eigenvector of the coin to be recognized with the eigenvector of the existing sample,if and only if the weighted Euclidean distanceWED(k)between its eigenvector and the eigenvector of thek-class sample is the smallest,the coin to be recognized is classified as thek-class.

In the formula,xirepresents the numberifeature of the coin to be recognized,respectively represent the mean and variance of the numberifeature of thek-class sample,andDrepresents the dimension of the feature vector extracted from each sample.

DefiningWED1,WED2,WED3andWED4respectively represent the weighted Euclidean distance between the coins to be recognized and the four types of coins:1 yuan,5 cents,large 1 cent greater and small 1 cent..The experiment shows that the nearest neighbor classifier recognizes 498 coins from 498 coin samples and 2 game currency samples,and it can be inferred that the correct recognition rate is about 100%.This is mainly because the influence of mean and variance is considered,and the surface wear of the coin is not serious,which makes the classification accuracy higher.However,the recognition rate of weighted Euclidean distance classifier cannot be proved to be effective due to the small number of recognized coins.Figure 5 is the original image,while figure 6 is the display of the results after image preprocessing,image edge detection,feature extraction and feature recognition on the original image.

Figure 5 Original Image

Figure 6 Coin Recognition Result Image

II.Conclusion

This paper combines coin image preprocessing,coin image edge detection,coin feature extraction and coin feature recognition,and realizes coin and game coin classification and recognition through a lot of experiments.The experimental results show that the method in this paper has a strong adaptability to the influence of the coin's position,environment and light on the coin,under the condition that the surface wear of coin is not serious,a high recognition rate can be achieved through a large number of sample experiments.