基于MATLAB的多方法车牌识别识别系统【GUI,多方法,lunwen,语音播报】

一、课题介绍
随着汽车数量的增加,城市交通状况日益受到人们的重视,如何进行有效的交通管理更是成为了人们关注的焦点。智能交通系统通过车辆检测装置对过往的车辆实施检测,提取有关交通数据,达到监控、管理和指挥交通的目的。因此,它已成为世界交通领域研究的重要课题。 车牌识别系统作为智能交通系统的一个重要组成部分,已在高速公路、城市交通和停车场等项目的管理中占有无可取代的重要地位。它在不影响汽车状态的情况下,由计算机自动完成车牌的识别,从而降低交通管理工作的复杂度。
该课题为基于MATLAB的多方法车牌识别识别系统,带有丰富的人机交互GUI界面。目前毕业设计选题中,传统的中规中矩的车牌识别不易得到高分,必须要在此基础上有所创新方得可以避开其他雷同课题,不会轻易被导师被否决而导致毕设不过。因此建议在车牌识别基础上加入多种方法的对比,看看哪种方法的精度高。虽然目前有很多方法的车牌识别,但是都是在各自的测试库里面测试的,比如测试的车牌图像不同,字符库不同,导致无法做对比。整个设计在一个GUI界面上完成。
传统基础版:中规中矩的车牌识别【只看到车屁股】
靓点1版本:可做成 复杂背景的车牌识别【可以看到全车以及周边其他物体】
靓点2版本:可做成 具备判断是否为库内车牌的车牌识别,并且计时计费(智慧停车场)
靓点3版本:可做成 具备语音播报的车牌识别,把识别结果通过声音方式播报出来
靓点4版本:可做成 两种方法的对比,本课题为模板匹配和bp神经网络方法的对比
二、基本流程
车牌识别部分
①图像预处理:在整个车牌识别系统中,由于采集进来的图像为真彩图,再加上实际采集环境的影响以及采集硬件等原因,图像质量并不高,其背景和噪声会影响字符的正确分割。和识别,所以在进行车牌分割和识别处理之前,需要先对车牌图像进行图像预处理操作。
②车牌定位:首先对车牌的二值图片进行形态学滤波,使车牌区域形成一个连通区域,然后根据车牌的先验知识对所得到的连通区域进行筛选,获取车牌区域的具体位置,完成从图片中提取车牌的任务。
③车牌分割:首先对车牌进行水平投影,去除水平边框;再对车牌进行垂直投影。通过对车牌进行投影分析可知,与最大值峰中心对应的为车牌中第二个字符和第三个字符的间隔,与第二大峰中心距离对应的即为车牌字符的宽度,并以此为依据对车牌进行分割。
④字符识别
神经网络:先用bp神经网络训练测试集中涉及到的字符,如粤、闽等,A-Z,0-9;进行比对识别;
模板匹配:来对车牌进行识别。识别过程中,首先建立标准字库,再将分割所得到的字符进行归一化,将归一化处理后的字符与标准字库里的字符逐一比较,最后把误差最小的字符作为结果显示出来。
三、GUI设计图(学习好GUI,有助于毕业后从事UI界面设计类工作,如深圳创维,康佳,彩虹电视等需要大量该类岗位,适合女孩子居多,该类工作居于程序员和文员之间)
GUI界面设计
GUI界面设计图

GUI制作说明:GUI是MATLAB的人机交互式GUI界面,有GUI界面,所有操作可在一个界面上完成,可以为毕设增分不少。GUI可在MATLAB命令行窗口输入guide回车快速打开,GUI常用的控件有axes,edit,putton,text几个组件,不同组件之间通过回调函数来进行连接,触发操作,可教学GUI制作,以及友情推荐同类岗位工作。

四、主函数附录
1、车牌载入
[filename,filepath]=uigetfile(’.jpg’,‘输入车牌图像’);% 直接自动读入%
file=strcat(filepath,filename); %strcat函数:连接字符串;把filepath的字符串与filename的连接,即路径/文件名
I=imread(file);
axes(handles.axes1)%让车牌显示在axes1控件中
imshow(I)%显示
title(‘车牌’)

2、图像预处理
I1=rgb2gray(I); %灰度处理
I2=edge(I1,‘roberts’,0.15,‘both’); %边缘检测
se=[1;1;1];
I3=imerode(I2,se);
se=strel(‘rectangle’,[25,25]);
I4=imclose(I3,se); %闭运算,去除杂质影响
I5=bwareaopen(I4,2000); %膨胀操作

3、车牌定位
[y,x,z]=size(I5);
myI=double(I5);
tic
white_y=zeros(y,1);
for i=1:y
for j=1:x
if(myI(i,j,1)==1)
white_y(i,1)= white_y(i,1)+1;
end
end
end
[temp MaxY]=max(white_y);
PY1=MaxY;
while ((white_y(PY1,1)>=5)&&(PY1>1))
PY1=PY1-1;
end
PY2=MaxY;
while ((white_y(PY2,1)>=5)&&(PY2<y))
PY2=PY2+1;
end
IY=I(PY1:PY2,:😅;
white_x=zeros(1,x);
for j=1:x
for i=PY1:PY2
if(myI(i,j,1)==1)
white_x(1,j)= white_x(1,j)+1;
end
end
end

PX1=1;
while ((white_x(1,PX1)❤️)&&(PX1<x))
PX1=PX1+1;
end
PX2=x;
while ((white_x(1,PX2)❤️)&&(PX2>PX1))
PX2=PX2-1;
end
PX1=PX1-2;
PX2=PX2+3;
dw=I(PY1:PY2-8,PX1:PX2,:);
axes(handles.axes2)
imshow(dw)
title(‘定位的车牌’)

4、字符分割
% 切割出 7 个字符
y1=10;y2=0.25;flag=0;word1=[];
while flag==0
[m,n]=size(d);
left=1;wide=0;
while sum(d(:,wide+1))~=0
wide=wide+1;
end
if wide<y1 % 认为是左侧干扰
d(:,[1:wide])=0;
d=qiege(d);
else
temp=qiege(imcrop(d,[1 1 wide m]));
[m,n]=size(temp);
all=sum(sum(temp));
two_thirds=sum(sum(temp([round(m/3):2*round(m/3)]😅));
if two_thirds/all>y2
flag=1;word1=temp; % WORD 1
end
d(:,[1:wide])=0;d=qiege(d);
end
end
% 分割出第二个字符
[word2,d]=getword(d);
% 分割出第三个字符
[word3,d]=getword(d);
% 分割出第四个字符
[word4,d]=getword(d);
% 分割出第五个字符
[word5,d]=getword(d);
% 分割出第六个字符
[word6,d]=getword(d);
% 分割出第七个字符
[word7,d]=getword(d);

5、字符识别
liccode=char([‘0’:‘9’ ‘A’:‘Z’ ‘京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼’]);%SubBw2=zeros(40,20);
l=1;
for I=1:7;
ii=int2str(I);
t=imread([ii,’.jpg’]);
SegBw2=imresize(t,[40 20],‘nearest’);
SegBw2=double(SegBw2)>20;
if l1 %第一位汉字识别
kmin=37;
kmax=43;
elseif l
2 %第二位字母识别
kmin=11;
kmax=36;
else l>=3 %第三位后字母或数字识别
kmin=1;
kmax=36;

end
for k2=kmin:kmax
    fname=strcat('字符模板\',liccode(k2),'.jpg');
    SamBw2=imread(fname);
    SamBw2=double(SamBw2)>1;
    for i=1:40
        for j=1:20
            SubBw2(i,j)=SegBw2(i,j)-SamBw2(i,j);
        end
    end
    %相当于两幅图相减得第三幅图
    Dmax=0;
    for k1=1:40;
        for l1=1:20
            if(SubBw2(k1,l1)>0 || SubBw2(k1,l1)<0)
                Dmax=Dmax+1;
            end
        end
    end
    Error(k2)=Dmax;
end
Error1=Error(kmin:kmax);
MinError=min(Error1);
findc=find(Error1==MinError);
Code(l*2-1)=liccode(findc+kmin-1);
Code(l*2)=' ';
l=l+1;

end
t=toc;
set(handles.text4,‘string’,Code)
五、运行效果图
部分车牌运行图
部分运行效果图

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
夫琅禾费衍射是光学中的一种重要现象,MatlabGUI可以很好地模拟圆环和矩形环夫琅禾费衍射。以下是简单的步骤: 1. 创建一个MatlabGUI窗口,并命名为“夫琅禾费衍射模拟”或者其他你喜欢的名字。 2. 在GUI窗口中添加两个按钮,分别命名为“圆环”和“矩形环”。 3. 为这两个按钮添加回调函数,使得当用户点击按钮时,程序可以执行相应的模拟。 4. 在回调函数中,首先清空之前的图像,然后根据用户选择的形状(圆环或矩形环),生成相应的夫琅禾费衍射模拟图像。 5. 最后,将生成的图像显示在GUI窗口中。 下面是一个简单的示例代码,可以作为参考: ```matlab function varargout = diffraction_simulation_gui(varargin) % DIFFRACTION_SIMULATION_GUI MATLAB code for diffraction_simulation_gui.fig % DIFFRACTION_SIMULATION_GUI, by itself, creates a new DIFFRACTION_SIMULATION_GUI or raises the existing % singleton*. % % H = DIFFRACTION_SIMULATION_GUI returns the handle to a new DIFFRACTION_SIMULATION_GUI or the handle to % the existing singleton*. % % DIFFRACTION_SIMULATION_GUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in DIFFRACTION_SIMULATION_GUI.M with the given input arguments. % % DIFFRACTION_SIMULATION_GUI('Property','Value',...) creates a new DIFFRACTION_SIMULATION_GUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before diffraction_simulation_gui_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to diffraction_simulation_gui_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help diffraction_simulation_gui % Last Modified by GUIDE v2.5 02-Jun-2021 15:31:48 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @diffraction_simulation_gui_OpeningFcn, ... 'gui_OutputFcn', @diffraction_simulation_gui_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before diffraction_simulation_gui is made visible. function diffraction_simulation_gui_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to diffraction_simulation_gui (see VARARGIN) % Choose default command line output for diffraction_simulation_gui handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes diffraction_simulation_gui wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = diffraction_simulation_gui_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on button press in circle_button. function circle_button_Callback(hObject, eventdata, handles) % hObject handle to circle_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % clear previous image cla(handles.axes1); % generate diffraction simulation image for circle [x,y] = meshgrid(-100:0.5:100); r1 = sqrt(x.^2 + y.^2); r2 = sqrt((x-20).^2 + y.^2); diffraction_pattern = abs((besselj(1,2*pi*r1) - besselj(1,2*pi*r2)) ./ (2*pi*r1)) .^ 2; diffraction_pattern = diffraction_pattern ./ max(max(diffraction_pattern)); imshow(diffraction_pattern, 'Parent', handles.axes1); % --- Executes on button press in rectangle_button. function rectangle_button_Callback(hObject, eventdata, handles) % hObject handle to rectangle_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % clear previous image cla(handles.axes1); % generate diffraction simulation image for rectangle [x,y] = meshgrid(-100:0.5:100); r1 = sqrt(x.^2 + y.^2); r2 = sqrt((x-50).^2 + y.^2); diffraction_pattern = abs((rect((x+50)./20,(y+50)./20) - rect((x-50)./20,(y+50)./20)) .* (besselj(1,2*pi*r1) - besselj(1,2*pi*r2)) ./ (2*pi*r1)) .^ 2; diffraction_pattern = diffraction_pattern ./ max(max(diffraction_pattern)); imshow(diffraction_pattern, 'Parent', handles.axes1); ``` 在这个例子中,我们创建了一个GUI窗口,其中包含两个按钮:“圆环”和“矩形环”。当用户点击这些按钮时,分别会执行`circle_button_Callback`和`rectangle_button_Callback`回调函数。这些回调函数会生成相应的夫琅禾费衍射模拟图像,并将其显示在GUI窗口中的`axes1`控件中。 在这些回调函数中,我们使用了Matlab内置的`besselj`和`rect`函数来生成圆环和矩形环的夫琅禾费衍射模拟图像。具体来说,我们首先生成一个网格,并计算每个点到圆环或矩形环的距离。然后,我们使用`besselj`函数计算出每个点处的衍射振幅,并根据距离计算出相应的衍射因子。最后,我们将所有的衍射因子相乘,并取平方,得到最终的夫琅禾费衍射模拟图像。 希望这个例子可以帮助你开始编写自己的MatlabGUI程序来模拟夫琅禾费衍射。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值