function varargout = gui2(varargin)
% GUI2 MATLAB code for gui2.fig
% GUI2, by itself, creates a new GUI2 or raises the existing
% singleton*.
%
% H = GUI2 returns the handle to a new GUI2 or the handle to
% the existing singleton*.
%
% GUI2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI2.M with the given input arguments.
%
% GUI2('Property','Value',...) creates a new GUI2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui2_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 gui2
% Last Modified by GUIDE v2.5 04-Jan-2024 15:11:04
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui2_OpeningFcn, ...
'gui_OutputFcn', @gui2_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 gui2 is made visible.
function gui2_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 gui2 (see VARARGIN)
% Choose default command line output for gui2
handles.output = hObject;
clc;warning off all;%清除所有警告
% axes(handles.axes1);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);%图框的刻度
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes gui2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = gui2_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;
function pushbutton1_Callback(hObject, eventdata, handles)
axes(handles.axes1);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);%每次导入新图片都会清除原来的数据
axes(handles.axes2);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes3);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes4);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes5);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes6);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes7);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes8);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes9);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes23);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes10);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes11);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes12);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes13);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes15);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes16);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes17);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes18);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes19);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes20);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes21);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
axes(handles.axes22);cla reset;box on;set(gca,'XTickLabel',[],'YTickLabel',[]);
set(handles.edit1,'string',[]);
[filename pathname]=uigetfile({'*.jpg';'*.bmp'}, 'File Selector');
if isequal(filename,0)
msgbox('没有图片')
else
pathfile=fullfile(pathname,filename);
I=imread(pathfile);
msgbox('导入图片成功')
pause(2);
end
handles.I=I;
guidata(hObject, handles);
axes(handles.axes1);
imshow(I);title('原图');
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
I=handles.I;
I1=rgb2gray(I);
I2=edge(I1,'Canny',0.5);%roberts sobel0.18 Canny0.5
axes(handles.axes2);imshow(I1,[]);title('灰度图');
axes(handles.axes3);imhist(I1);title('灰度化直方图'); %imhist绘制灰度直方图
axes(handles.axes4);imshow(I2);title('边缘检测');
se=[1;1;1];
I3=imerode(I2,se);%腐蚀操作
axes(handles.axes5);imshow(I3);title('腐蚀后的图像');
se=strel('rectangle',[30,30]);
I4=imclose(I3,se);%图像聚类,填充图像
axes(handles.axes6);imshow(I4);title('闭运算平滑后的图像');
I5=bwareaopen(I4,2000);%去除聚团灰度值小于2000的部分
axes(handles.axes7);
imshow(I5);title('移除图像中的小对象');
[y,x,z]=size(I5);%返回15各维的尺寸,存储在x,y,z中
myI=double(I5);
tic %tic计时开始,toc结束
%车牌定位 粗定位(确定行列的初始及终止位置)
Blue_y=zeros(y,1);%产生一个y*1的零针
for i=1:y
for j=1:x
if(myI(i,j,1)==1)%如果myI图像坐标为(i,j)点值为1,即背景颜色为蓝色,blue加一
Blue_y(i,1)=Blue_y(i,1)+1;%蓝色像素点统计
end
end
end
[temp MaxY]=max(Blue_y);
%Y方向车牌区域确定
%temp为向量blue_y的元素中的最大值,MaxY为该值得索引
PY1=MaxY;
while((Blue_y(PY1,1)>=5)&&(PY1>1)) %阈值5可以调,车牌定位范围调节
PY1=PY1-1;
end
PY2=MaxY;
while((Blue_y(PY2,1)>=2)&&(PY2<y)) %阈值5可以调,车牌定位范围调节while((Blue_y(PY2,5)>=5)&&(PY2<y))
PY2=PY2+1;
end
IY=I(PY1:PY2,:,:);
%X方向车牌区域确定
Blue_x=zeros(1,x);%进一步确认x方向的车牌区域
for j=1:x
for i=PY1:PY2
if(myI(i,j,1)==1)
Blue_x(1,j)=Blue_x(1,j)+1;
end
end
end
PX1=1;
while((Blue_x(1,PX1)<1)&&(PX1<x))
PX1=PX1+1;
end
PX2=x;
while((Blue_x(1,PX2)<1)&&(PX2>PX1)) %车牌定位范围调节((Blue_x(1,PX2)<1)&&(PX2>PX1))
PX2=PX2-1;
end
PX1=PX1-1;%对车牌区域的矫正
PX2=PX2+1;
dwei=I(PY1:PY2-8,PX1+3:PX2,:); %阈值可改I(PY1:PY2-8,PX1:PX2,:) dw=I(PY1+8:PY2-8,PX1+7:PX2-14,:); (粤J54I55)
t=toc;
axes(handles.axes8);imshow(IY),title('横向定位后的车牌');
axes(handles.axes9);imshow(dwei),title('定位车牌');
% %倾斜校正
pictureGray1 = rgb2gray(dwei);
%水平方向调整
T=affine2d([0 1 0;1 0 0;0 0 1]);
pictureTr=imwarp(pictureGray1,T); % 图像转置,顺时针旋转90°调整水平方向
theta = -20 : 20; %设置倾斜角度的范围
r1 = radon(pictureTr, theta); %radon变换确定倾斜角
result1 = sum(abs(diff(r1)), 1); %求出行倒数绝对值的累加和,最大的对应倾斜角
rot1 = find(result1==max(result1))-21;
pictureRo = imrotate(dwei, rot1);
%竖直方向调整
pictureGray2 = rgb2gray(pictureRo);
r2 = radon(pictureGray2, theta);
result2 = sum(abs(diff(r2)), 1);
rot2 = (find(result2==max(result2))-21)/57.3; %将数值转为角度
if rot2>0
T1 = affine2d([1 0 0 ; -tan(rot2) 1 0 ; size(pictureGray2, 1) * tan(rot2) 0 1]);
else
T1 = affine2d([1 0 0 ; tan(-rot2) 1 0 ; size(pictureGray2, 1) * tan(-rot2) 0 1]);
end
dw = imwarp(pictureRo, T1);
handles.dw = dw;
guidata(hObject, handles);
axes(handles.axes23);
imshow(dw);title('倾斜校正后的图像');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于MATLAB编程,基于GUI和模板匹配的车牌的识别,选择图片的时候要选择彩色图片,选择灰度图片会报错,代码完整,包含数据,有注释,方便扩展应用 1,如有疑问,不会运行,可以私信, 2,需要创新,或者修改可以扫描二维码联系博主, 3,本科及本科以上可以下载应用或者扩展, 4,内容不完全匹配要求或需求,可以联系博主扩展。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![mp4](https://img-home.csdnimg.cn/images/20210720083504.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![tar](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
共 87 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/3165706ad4e540aeb062dd5ebcf069a7_abc991835105.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
神经网络机器学习智能算法画图绘图
- 粉丝: 2514
- 资源: 618
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)