980-车牌识别
980-车牌识别,车牌,识别,辨认
直接运行“run.m”文件即可提 要一、引言90 年代以来,交通的迅速发展使得全世界研究者不断采用先进的电子和计算机视觉技术来监视超速车辆、掌握车辆位置、或者用于收费站,以提高车辆的通行速度等。智育旨孟输系(ITS Intelligent Transportation Systems)是解决这种矛盾的重要途径,而车牌自动识别(LPR License Pate Recognition)是 ITS 中的有效技术之一,作为其重要组成部分,在公共安全、交通管理及有关军事部门有着极其重要的应用价值。在整个车牌自动识别系统中高识别率的实现主要有三个关键性部分:在车牌定位、车牌字符分割、字符识别。系统框图如图 1.10图 1.1 车牌识别系统框图二、车辆图像预处理图像预处理其实质是对图像进行加工,以得到对车牌定位更有用的车辆图像,本文先给出预处理流程图如 2.10。图 2.1 图像预处理流程图2.1 灰度拉伸灰度变换函数表达式如下:(2-1)图 2.2 灰度拉伸变换函数2.2 二值化二值化处理即将图像转换成二值图像,也就是整幅图像中仅有黑白二值的图像,这里定义 255 为白,O 为黑。设 0n、 b分别为目标和背景的象素数。 0()ng和 b分别表示在某一灰度值 g 下的象素数。如果取一个阈值 T,则应保证下式的值成立。max00min()/()/TbbTgg(2-2)其中 min,max 为灰度值的最小和最大值。2.3 中值滤波中值滤波一般采用一个含有奇数个点的滑动窗口,将窗口中各点灰度值的中值来替代指定点(一般是窗口的中心)的灰度值。对于奇数个元素,中值是指按大小排序后,中间的数值;对于偶数个元素,中值指排序后中间两个元素灰度值的平均值。这种方法既能消除噪声又能保持图像的细节。2.4 形态学滤波腐蚀是一种消除边界点的过程,结果将使目标缩小,孔洞增大,因而可有效的消除孤立噪声点;膨胀剥各与目标物体接触的所有背景点合并到物体中的过程,结果将使目标增大,孔洞缩小,可填补目标物体中的空洞,形成连通域。先腐蚀后膨胀的过程称为开运算,它可以把比结构元素小的突刺滤掉,切断细长搭接而起到分离和平滑较大物体边界的作用;先膨胀后腐蚀的过程称为闭运算,可以把比结构元素小的缺口或孔填充上,搭接短的间断而起到连通作用。三、车牌定位与字符分割3.1 线段性探针搜索定位分割3.3.1 水平方向定位基本处理过程如下:如果用 1 表示白象素,0 表示黑象素,用0,0,0,0,0,1,1,1,1,1和1,1,1,1,1,0,0,0,0,0两种线段作为探针对整幅图像进行逐行扫描。当遇到与这两种线段相匹配结构的象素时记录下来,并统计每行相匹配的象素个数,再从统计的个数中找出最高峰值点,然后从最高峰值点向上向下分别进行搜索。当搜索到某行统计个数小于给定闭值时停止搜索,并记下该行的纵轴坐标,即是进行水平分割的一个纵轴坐标。3.3.2 垂直方向定位先用竖直结构对提取出来的车牌进行腐蚀去掉一些不具有竖直方向连通性的背景干扰,再用竖直方向的膨胀算子将字符区域形成连通的白色区域,然后做垂直投影来确定垂直的分割线。3.2 车牌字符分割牌照有其自身的规格要求,字符之间有一定的间隔,而这个间隔是我们最先可以想到的分割依据。对于二值化后且定位的车牌图像,当对黑底白字的牌照图像做垂直投影时,可以很明显的看到相邻字符之间间隔的投影值正好处于波谷的位置,在毫无干扰的情况下,波谷位置则为分割线的位置。由于牌照存在倾斜、或光照、自然环境的影响可能出现字符粘连、分裂的情况,则利用整个宽度信息可以有针对性的对整幅牌照的粘连、分裂字符进行切割,从而保证切割对整幅图像的自适应。对此,采用统计方法,找到一个通用字符宽度。经考察,这类图像虽然字符之间产生了粘连,但是它的字符宽度比较均匀,洲门可以根据牌照本身的长度直接定义这类图像的字符宽度。其分割算法为:(l)对牌照图像做垂直投影,将投影结果进行差分分层。(2)对质量较好的候选层直接切分为单个字符。(3)对产生粘接或分裂的字符,通过统计的字符宽度,对其进行处理。四、车牌字符识别4.1 字符规一化方法设坟 x,y)为原图像,g(x,v)为规一化后的图像,橄 xl,yl)为 g(.)中任意一点,对应于取,力中的点(xo,yo),假设图像 X 轴方向缩放比率是 fx,Y 轴方向缩放比率是耳,那么原图中点(x。 ,y。)对应与新图中的点(x, ,y,)的转换矩阵为:其逆运算:如果( , )是整数,则:0xy1, 0()(,)gxyfxy那么当俩,x0)不是整数时,则采用邻近插值变换法。4.2 特征的提取与选择4.2.1 主量分析方法主量分析方法,是将多个相关变量简化为少数几个不相关变量的一种多元统计方法由于每个成分是初始变量的线性组合,即主成分间相互正交,其根本思想是从简化方差和协方差的结构来考虑降维。4.2.2 粗集理论模式维数的正交投影和约简考虑了最重要的数据信息,即保留原始数据本质信息的非相关元素,因此能加速识别进程。采用 SVD 变换的 PCA 方法进行特征提取后并不能保证所选择的每个主量都能进行识别,用 RS 进行特征约简,在保留关键信息的条件下对数据进行简化,从而选择对识别最有用的特征。基于粗集理论的 PCA 特征提取与选择的算法如下:(l)将输入 m 个样本图象作为原始数据集 T,转化为矩阵 X(N m 维)。(2)计算矩阵 X 的协方差矩阵 xR(3)采用 SVD 变换得到协方差矩阵 的本征值及与之相对应的本征向量,按递减的顺序进行排列。(4)基于排序的特征值在主量空间中选择约简的维数 K。(5)根据求得协方差矩阵 的本征向量,可找到由 K 个投影值( )组成的投影xR12,k空间 ,即在主量空间中将原始模式 x 转换为 K 维特征向量,其中。为 K、m 维矩阵。(6)将 离散化为 ,它与原始数据集 T 具有相对应的类,由 的模式构成决策表d d,主量成分作为条件属性,字符类作为决策属性。mDT(7)将决策表作为一个被选择的特征集,采用测试方法进行约简,组成最后离散化属性决策表 ,得到每个模式的最小描述,即在识别,fd时所必须要用到属性值。4.3 基于神经网络与模板匹配的多分类器设计4.3.1BP 神经网络的基本原理基本思想:如果利用已有权值和阑值正向传播得不到期望的输出,则反向传播,反复修改各节点的权值和阑值,逐步减少能量函数,直到达到预先设定的要求。一般以能量函数小于某一相当小的正数或迭代时不再减少,而是反复振荡为止,此时完成 BP 网络的训练、输入与输出的映射关系。4.3.2 仿真实验及其讨论我们要识别的字符图象是经字符分割与规一化后的车牌字符,根据车牌本身字符的特点分别建立了数字、字母、数字字母混合、汉字分类器。网络分三层:输入层、隐层、输出层。学习算法为附加动量项法与自适应学习速率调整策略。采用如下训练方法:先将少量样本输入到网络中进行训练,然后逐渐增加样本数,将第一次训练后的网络权值作为第二次训练的初始值,依次类推。这样分步训练能够很快实现网络的收敛。从图 4.1 与图 4.2 给出汉字分类器的仿真实验结果图可以看到:图 4.1 基于 pCA 特征提取的汉字 4.2 基于 Ro 吸少 set 的 PCA 特征提取汉字的网络训纺娱差变化图图 网络训练误差变化图仿真结果证明:采用粗集理论对 PCA 提取的特征进行约简,在保持分类能力不变的前提下,利用 RS 从大量数据中发现分类问题的基本规则,约简后的特征作为网络输入,一方面,可以去掉冗余的输入信息,而且可以简化隐层节点数,减少网络结构复杂性;另一方面,通过约简减少了学习过程,训练速度提高约 4.68 倍。因此将 PCA 与粗集相结合的特征抽取与选择对于设计神经网络分类器有很大的优化作用。4.3.3 多级多分类器的设计根据车牌字符排列情况,建立了数字、字母、数字字母混合、汉字分类器,采用模板匹配与神经网络相结合的方法进行识别。用于模板匹配方法的特征是:粗网格特征与方向像素特征。而神经网络识别的特征是 RS 约简后的 PCA 特征。采用此设计方案,洲门对相似字符的误识个数进行统计,表 4.3 给出了相似字符的误识个数统计,其中,第 1、2类的总样本数为 50,而第 3、4 类的总样本数为 60。表 4.3 相似字符误识个数统计表为了更好说明此方法的总体性能,给出对不同分类器的识别率如表 4.4。表 4.4 字符识别率五、车牌识别系统的设计与实现5.1 软件系统设计思想1.位图类的设计设计 CDib 类的基本操作功能应包括:(l)多种形式的构造函数,包括从空 DIB 创建、从 DIB 句柄创建、从 DIB 数据块指针创建、从屏幕或窗口显示创建等。(2)DIB 文件的读、写操作;(3)从资源中装载 DIB 位图;(4) DIB 的显示和缩放显示;(5)提供 DIB 空间、颜色和特征等信息(尤其是图像的宽和高);(6)DDB 与 DIB 的相互转换;(7)DIB 格式的转换;(8)DIB 调色板的操作;(9)能获取 DIB 位图数据的句柄;(10)能生成 DIB 数据的拷贝;5.2 车牌识别系统的结构设计和功能实现5.2.1 车牌识别系统数据流图.从给出车牌识别系统数据流图如 5.1 可以看到,整个系统的数据流向如下:(1)打开拍摄的车牌图像位图文件,从中得到车辆图像数据,并存入内存;经过图像预处理,再经过二值化处理和滤波,得到车辆二值图像;(2)根据前文所述线段性探针搜索算法,在车辆二值图像中找到车牌图像;(3)对车牌图像做垂直方向的投影直方图,根据直方图再结合车牌字符的一些先验知识,分割出车牌上的单个字符图像;(4)对字符图像进行滤波,并做归一化处理;提取特征送入训练好的神经网络识别,得到最终的字符识别结果。图 5.1 车牌识别系统数据流图5.2.2 车牌识别系统的结构设计车牌识别系统主要由 4 大部分组成:预处理、车牌定位、字符分割、字符识别。1.预处理预处理首先对车牌图像进行灰度拉伸,采用全局闭值化方法对图像进行二值化,后对其采用中值滤波,形态学滤波进行去噪等各种干扰,突出车牌的特征信息。给出原图与一系列处理效果图如图 5.2、5.3、5.4、5.5、5.6、5.7。图 5.2 原图图 5.3 灰度州申处理效果图 图 5.4 二值化处理效果图 图 5.5 中值滤波处理效果图 5.6 腐蚀处理效果图 图 5.7 膨胀处理效果图2.车牌定位在整幅车牌图像中对车牌进行水平与和垂直投影定位车牌。效果处理图如 5.8。图 5.8 车牌定位效果图3.字符分割字符分割方法:采用字符垂直投影与车牌字符先有宽度信息相结合进行分割。其效果图如 5.9、5.10。图 5.9 车牌校正效果图 图 5.10 字符分割效果图4.规一化采用邻近插值的规一化方法。其效果图如 5.11。5.提取特征采用 PCA 方法进行字符特征提取,并用 RS 对特征进行约简,将约简后的特征送入神经网络。6.字符识别基于字符不同特征采用各种分类器对字符进行识别和分类。设计了数字、字母、字母与数字混合、汉字识别分类器。其效果图如 5.12 图 5.12 字符识别结果5.2.3 车牌识别系统的功能实现整个界面按照实现功能分为三大区:车牌图像的显示区,界面的左边显示要处理的车牌图像,处理结果显示区。图 5.13 车牌识别系统5.2.4 实验结果下面主要给出车牌定位、字符分割与字符识别三大模块实验结果。六、结论本文主要研究了车牌定位、字符分割、字符识别的算法,并针对每一模块提出相应的处理方法,在此基础上,论文围绕车牌识别中的特征提取与字符识别的两个重要环节展开了详细的研究,通过分析比较各种方法,提出将主量分析方法和粗集理论相结合应用于特征提取,模板匹配与神经网络相结合用于字符识别,实验结果证明:该方案能有效识别车牌字符,尤其是相似字符的识别率有较大提高。SummaryI.PrefaceSince 90s,with the rapid development of the transportation, the whole world researchers adopt the advanced electronics and computer vision technology incessantly to keep watch on the overspeed vehicle, command the ehicle position and use in the toll station to improve the speed of vehicle.Intelligent Transportation System (ITS) is important effective approach to solve the traffic problem, license plate recognition(LPR), as an important part and oneof the crucial technology in ITS, which has great valuable in practical application such as public safety, traffic management and military department. There are three decisive parts in the whole realization of high recognition rate for license plate automatic recognition system: license plate location, license plate character segmentation, character recognition. System frame is showed in Figure 1.1.Figure 1.1 The frame diagram of LPRSII. Vehicle image preprocessingIn fact, for the acquireunagement of more useful image to license plate Lcalization,vehicle image is operated in advance. The flow chart of preprocessing is shown in Figure 2.1.Figure 2.1The flow chart of preprocessing for vehicle imagei. Gray stretchThe function of Crray transformation may be defined as followed:Figure 2.2 The function of gray transformationii. BinarizationBinarization is the process of converting an image into binary image, that is to say , only two gray levels, white and black, exists in the whole image.Here 255 represents white and 0 represents white and 0 represents black.Supppose that n, b represents respectively the object pixels and background pixels, , the number of the object pixels and background pixels for certain gray of 0()ngbg,select a threshold T the following formula should be hold:max00min()/()/TbbTnggnHere min is the minimal value of the gray and max is the maximal value of the gray. iii. Median filterGenerally, in Median filter, the slippage window with odd number points is applied. The specified pixel(the center of the window) can be replaced by a value obtained by computing the median of values of pixels in filter. For the odd elements, median is in the middle of by sorted order, for even elements, median is the mean value of two middle pixels by sorted. Which remove the noise while preserving the image detail.iv. Morphology filterErosion is the process of eliminating the boundary pixel, which will shrink the object area, increase the hole and remove the isolate noise effectively. Dilation is the process of incorporating into the object all background points that touch it, which will enlarge the object area, shrink the hole, fill up empty hollow and form connectivity. The process of erosion followed 饰 dilation is called opening. It has effect of eliminating stickup smaller than structure element, and cut off the thin juncture, and smoothing or separating the boundaries of larger objects. The process of dilation followed by erosion is called closing. Tt has the effect of filling small and thin holes in objects and generally connecting the boundaries of objects.III. License plate location and character segmenti. Linear probe search for location(i). Horizontal locationThis basic principle can be described by the following: 1 represents white, 0 represents black in the binary image, and 0,0,0,0,0,1,1,1,1,1and 1,1,1,1,1,0,0,0,0,0 are taken as the probe to search the image row by row. The pixels matching with the same structure are recorded and counted, then maximal count is obtained, from this row corresponding to maximum, search upwards and downwards rows until the certain row are attained, which are lower than the given threshold, record the two rows that are segmented on the horizontal. (ii). VerticallocationFirstly, the license plate is eroded with vertical structure elements, thus some background that have no adjacent in vertical are removed, in the following, the license plate is dilated with vertical structure elements to form connective area in characters, finally, segmentation is performed with vertical projection. ii. The license plate character segmentationBecause of specification for license plate, there are some gaps between characters, it is the according to segment. From the vertical projection of binarized and localized image, which obviously shows that the projection of between characters are in the position of wave trough,this is exactly the position of segmentation without disturb. Because inclination or the light, the influence of the natural environment are existed, characters are connected or parted, then we can make use of the whole width information ensure the adaptive segmentation for license to segment plate. Thus,characters, which can the statistical method can be adopted that the generalcharacters width are obtained. Through investigation, although between characters are connected in the type of image, width of character are equality, the character width of image are defined directely according to the length of license plate. The algorithm of segmentation can be described as follows: (a). The image is projected in the vertical and the difference according to vertical projection are gained.(b). For the better layer can segment character directly.(c). To stickup or split characters are processed with the character of statistical widthIV. License plate character recognitioni. Character image uniformIt is supposed that f(x,y) is origin image, g(x,y) is uniform image. ( , ) is the random 1xypoint in g(.), which is corresponding to ( , ) in f(x,y), fx is the zoom ratio of the X axis and 0xyfy is the zoom ratio of the Y axis, then conversion matrix ofthe pixel ( , ) in the origin image 0xytoward the pixel ( , ) is: 1xyThe reversion matrix is:If ( , ) is an integer, then: g( , =f(xo,yo) 0xy1xyIf ( , ) is not an integer, nearest neighbor interpolation is applied to uniformii. The feature extraction and selection(i). The principal component analysisThe principal component analysis is a multi-statistical method that many correlated variances are simplified to minority uncorrelated variances. Because each component is linear combination of initial variances, that is to say, principal component are orthonormal. The essential idea is dimensional reduction based on simplification of square and covariance.(ii). Rough setThe most important information is considered by the orthonormal projection and reduction of patter dimensionality, with uncorrelated elements in essential information of origin data retained. Therefore, which can accelerate the progress of identification. Each component, as a feature vector, extracted by the PCA method based on SVD transformation can not be guaranteed to be recognized adequately. The feature vector are reduced by RS, the data are simplified while preserving crucial information, thus the most useful feature for recognition are selected.The Algorithm of Feature extraction and selection based on the PCA and RS are followed:(a). Suppose m image cases as original data set T, converting it into thematrix X( N m).(b). Computing the covariance matrix of matrix X.XR(c). Compute for the matrix Rs the eigenvalues and corresponding eigenvectors based on svd, and arrange them in descending order.(d). Select the reduced dimension K according to defined selection method which may based on judgement of the ordered values of computed eigenvalues.(e). According to the eigenvectors of the matrix R.r,the projection space aregained, which are composed of K projection( ).Transform original patterns from 12,kX into K-dimensional feature vectors in the principal component space. r is K m dimension.(f). Discretize the with resulting matrix ,with conrresponding to classes from the doriginal data set T, the decision table DTm is constituted with the patterns ,principal dcomponent is condition attribute, character pattern classification is decision attribute.(g).The decision table as feature set is selected, discrete attribute decisiontable composed of feature by reduced with detected method. the least describing of ,fdDTeach pattern is gotten, it is to say, attribute values with classification.iii. The design of multiclassification based on the model match and neural network(i). Basic principle of Back-Propagation neural networkBasic thoughts: if the expected output are not received by positive spread with old weight and threshold, then reverse the direction spreads, the weight and threshold of each node are modified again and again. Power function is reduced gradually until the primary request are attained.(ii). The simulation and discussion of experimentsCharacter image to be recognized are segmented and uniformed, according to its characteristics, numbers, letters, alphanumeric characters, Chinese characters classifier are designed. Network are parted to three lays: input layer, hidden layer, output layer, the learning algorithm had momentum and adaptive learning techniques built into it. Training method is followed that training are processed through the input of least cases, then cases are increased gradually, the network weight after gained in the first time are used as the initial training weight in the second time, in turn, the network convergence is realized quickly. Chinese characters classification simulation experiment are showed in the Figure 4.1 and Figure 4.2, it shows that the PCA features are reduced by RS with the ability to classification remained, the fundamental rules of classification aregained in a large quantity of data by RS, the reduction features are used as input of network, redundant input information can be removed, the number of node in the hidden layer can be simplified, the network structure complexity can be cut down, on the other hand, the procession of learning is speeded up, the velocity of training are enhanced about 4.68 times, neural network classifier can be optimized with PCA and RS combined.Figure 4.1 The schematic of error Figure 4.2 The schematic of error diversification for Chinese characters diversification for chinses charactersnetwork training based on the network training based on the PCA PCA feature reduction feature using RS(iii). The design of multilevel-multiclassfierMultilevel- multiclassfier are adopted, model match and neural network are combined. The features in model match are characterized with mesh and direction pixel, but the features in neural network are characterized with PCA feature by RS reduced.Adopting the scheme, the misclassification of similar character is counted. The result is showed in the Table 4.2. Among them, the total number of case is 50 in the 1,2 types, but 60 in the 3,4 types.Table 4.3 the number of misclassification for similar character For the sake of the total performance to be illuminated better, the recognition rate of classifier are showed in the Table 4.4.Table4.4 the recognition rate of different classifierV. The design and realization of license plate recognition systemi. The thoughts of software system design(i). The design of bitmap classBasic operation function that design of CDib should include:(a). The various structure function: create from the empty DIB, create from the DIB handle, create from the DIB data piece point, create from screen or window display etc.(b). The operation to read and write of DIB.(c). Load the DIB bitmap from the resources.(d). The display for DIB and zoom image display for DIB.(e). Provide DIB with space, color, characteristic information etc.(width, height of image).(f )The conversion for DDB with DIB mutually.(g). The conversion for DIB format.(h).The operation for DIB palette.(i). The handle with ability to obtain DIB.(j). The copy of DIB data.ii. The construction of design and realization of function for LPRS(i). The diagram of data flows in the license plate recognition systemThe data flows of license plate recognition system is showed in the Figure5.1,it is followed:Figure 5.1 The figure of data flows for LPRS(a). Open the file of license plate image, the data of vehicle image are saved, after preprocessed, binarized and filtered, binarization image can be gained. (b). According to linear probe research algorithm, the license plate image are localized.(c). Based on the vertical projection and transcendent knowledge of license plate character, single character is segmented in license plate.(d). Single character is filtered and uniformed, then feature extracted are sent to neural network already trained to get the result of recognition finally.(ii). the design of construction for the license plate recognition system There are 4 parts in license plate recognition system: preprocessing, license plate location,character segment, character recognition.(a). preprocessingFirstly, vehicle image gray is stretched, then binarized based on the global threshold method, thirdly, some kinds of disturb are removed through the median filter and morphology filter, the characteristic information of license plate are outstanding. Give the original image and a series of result of processing such as Figure 5.2,5.3,5.4,5.5,5.6 and 5.7.Figure 5.2 Origin image Figure 5.3 Image of gray stretchFigure 5.4 Image of binarization Figure 5.5 Image of median filterFigure 5.6 Image of erosion Figure 5.7 Image of dilation(b). License plate locationLicense plate are projected in horizontal and ve: are localized. The result is showed in Figure 5.8Figure 5.8 Iimage of license plate location(c). Character segmentCharacter are segmented by vertical projection and transcendent width information. The result is showed in Figure 5.9, 5.10.Figure 5.9 Revised image of license plate Figure 5.10 Image of character segment(d). uniformNearest neighbor interpolation uniform are adopted, the result is showed in Figure 5.11.Figure 5.11 Image of character uniform(e). feature extractionThe PCA method is applied into feature extraction, then PCA feature vector are reduced by RS, finally sent to neural network.(f).character recognitionDifferent classification are adopted based on the different characteristic of character, number, letter, alphanumeric, Chinese character classification are designed. The result of recognition is showed in Figure 5.12.Figure 5.12 The result of license plate recognition(iii). The realization of function for license plate recognition system According to the function of realization for interface, the whole interface is divided into three areas: the display of vehicle image, the display of result in processing, the areas of button. The design of system software interface is showed in Figure 5.13. Figure 5.13 The design of LPRS interface(iv). The result of experimentThe experiment result of license plate location, character segment, character recognitio
收藏