本站内容均来自兴趣收集,如不慎侵害的您的相关权益,请留言告知,我们将尽快删除.谢谢.
1.软件版本
matlab2017b
2.系统原理
从图的算法流程图可知,基于车牌图像字符特征提取和神经网络的识别算法其首先将训练样本数据进行预处理,得到质量较高的样本数据,然后对这些样本数据进行HOG特征提取,再将特征数据通过神经网络进行训练学习最后得到基于神经网络的车牌识别模块。然后采集一些常规的测试样本图片,同样,对这些样本进行预处理操作,然后通过颜色模型对车牌进行定位和提取,然后将提取后的车牌进行字符分割,然后分别对分割后的多个字符进行HOG特征提取,最后输入到神经网络模型中进行识别,并得到识别输出结果。下面通过MATLAB对该算法进行仿真测试分析。
2.1基于HOG变换的特征提取方法
基于HOG变换的图像特征提取算法,目前被广泛应用在图像识别领域[29],如车牌识别,人脸识别,车辆识别等。下面对HOG变换的基本原理进行介绍。HOG特征的提取其详细步骤如下:
步骤一:细胞划分。如图1所示,将每一张目标图像划分为多个小的图像区域,每个小的图像区域作为一个细胞单元(如图1左图所示),由四个细胞单元构成一个块单元(如图1右图所示):
步骤二:计算块单元的像素点的梯度特征数据,其计算公式为:
通过上述HOG向量的计算步骤可知,HOG特征向量的提取主要是基于局部图像得到的,因此其具体更强的抗干扰能力。
2.2 GRNN神经网络
GRNN广义回归神经网络[28]是一种具有极强学习能力和适应能力的神经网络,其通过少量样本就可以实现对样本的训练和学习。此外,GRNN网络是一种基于非参数核回归实现方式的网络函数,其通过将样本数据作为后验概率进行验证,然后进行非参数估计。
GRNN网络第一层为网络输入层,输入层的神经元数量和学习样本中输入向量的维数相同。因此,每一个神经网络均接收一个维度的数据输入,然后在输入层中,将这些数据传递到第二层隐含层中。
3.部分源码
clc; clear; close all; addpath 'func\' %STEP1 %************************************************************************** I =imread('Images\18.jpg'); figure(1) subplot(161); imshow(I); title('原图'); I1=rgb2gray(I); subplot(162); imshow(I1); title('灰度图'); %车牌定位 Ip = func_position(I,I1,1.4,150); subplot(163); imshow(Ip); title('车牌区域'); %膨胀 se = strel('ball',16,16); Ip2 = uint8(imdilate(Ip,se)); Ip2 = 255*double(im2bw(Ip2)); subplot(164); imshow(Ip2); title('膨胀'); %去掉小面积的噪声干扰 %Determine the connected components. L = bwlabeln(Ip2); %Compute the area of each component. S = regionprops(L,'Area'); %Remove small objects. bw2 = ismember(L, find([S.Area] >= 10000)); subplot(165); imshow(bw2); title('去掉干扰'); %提取车牌 PP = im2bw(bw2); Ipos = func_Pai_Position(I,PP); subplot(166); imshow(Ipos); title('车牌提取'); save Result_STEP1.mat Ipos %STEP2 %************************************************************************** %提取的车牌 load Result_STEP1.mat figure; subplot(221); imshow(Ipos); title('车牌提取'); %如果有角度倾斜,则旋转 Iang = func_angle(Ipos); subplot(222); imshow(Iang); title('车牌提取-旋转'); %车牌分割 I2 = uint8(255*im2bw(Iang,1.2*graythresh(Iang))); subplot(223); imshow(I2); title('等待分割的车牌'); tmps = func_fenge(I2); save Result_STEP2.mat tmps Iang %STEP3 %************************************************************************** %提取的车牌 load Result_STEP2.mat word1=imresize(tmps{1},[40 20]); word2=imresize(tmps{2},[40 20]); word3=imresize(tmps{3},[40 20]); word4=imresize(tmps{4},[40 20]); word5=imresize(tmps{5},[40 20]); word6=imresize(tmps{6},[40 20]); word7=imresize(tmps{7},[40 20]); figure; subplot(241);imshow(word1); subplot(242);imshow(word2); subplot(243);imshow(word3); subplot(244);imshow(word4); subplot(245);imshow(word5); subplot(246);imshow(word6); subplot(247);imshow(word7);
clc; clear; close all; addpath 'func\' %提取的车牌 load Result_STEP2.mat word1=imresize(tmps{1},[40 20]); word2=imresize(tmps{2},[40 20]); word3=imresize(tmps{3},[40 20]); word4=imresize(tmps{4},[40 20]); word5=imresize(tmps{5},[40 20]); word6=imresize(tmps{6},[40 20]); word7=imresize(tmps{7},[40 20]); figure; subplot(241);imshow(word1); subplot(242);imshow(word2); subplot(243);imshow(word3); subplot(244);imshow(word4); subplot(245);imshow(word5); subplot(246);imshow(word6); subplot(247);imshow(word7); %神经网络训练 tic net = func_grnn_train(); toc %识别 %第一个中文 words = word1; wordss = func_yuchuli(words); wordsss = sim(net,wordss'); [V,I] = max(wordsss); d = 14; y{1} = func_check(d); %第2个英文文 words = word2; wordss = func_yuchuli(words); wordsss = sim(net,wordss'); [V,I] = max(wordsss(11:13)); d = I; y{2} = func_check(d+10); for i = 3:7 if i == 3 words = word3; end if i == 4 words = word4; end if i == 5 words = word5; end if i == 6 words = word6; end if i == 7 words = word7; end wordss = func_yuchuli(words); wordsss = sim(net,wordss'); [V,I] = max(wordsss); d = I; y{i} = func_check(d); end STR = [num2str(y{1}),num2str(y{2}),num2str(y{3}),num2str(y{4}),num2str(y{5}),num2str(y{6}),num2str(y{7})]; s=strcat(STR); disp(s); load Result_STEP1.mat figure; subplot(211); imshow(Iang); title(s);
4.仿真效果
5.仿真效果
[01] 吴卉 . 城市交通信息平台中地图匹配、车辆跟踪及速度估算的研究 [D]. 上海交通大学 , 2006.
[02] 李驰 . 智能交通中的车牌识别算法研究 [D]. 华中科技大学 ,2012.
[03] 陈振学 , 汪国有 , 刘成云 . 一种新的车牌图像字符分割与识别算法 [J]. 微电子学与计算机 ,2007,24(2):42-44.A10-53
Be First to Comment