MATLAB车牌识别车库管理系统

题目:MATLAB车牌识别车库管理系统

  • 简介
  • 功能介绍

系统对进入停车位的车辆进行车牌识别,将识别出来的车牌号显示出来;然后对车主进行人脸识别,框出车主照片的人脸部分作为车主信息的标记,记录在系统库中。车辆在库期间,系统使用者可以随意查看车辆与车主信息的获取过程及获取结果,当驾驶车辆离开停车场时,系统库将清空该车辆与车主的信息。

  • 源代码

function varargout = GUI(varargin)

% GUI MATLAB code for GUI.fig

%      GUI, by itself, creates a new GUI or raises the existing

%      singleton*.

%

%      H = GUI returns the handle to a new GUI or the handle to

%      the existing singleton*.

%

%      GUI('CALLBACK',hObject,eventData,handles,...) calls the local

%      function named CALLBACK in GUI.M with the given input arguments.

%

%      GUI('Property','Value',...) creates a new GUI or raises the

%      existing singleton*.  Starting from the left, property value pairs are

%      applied to the GUI before GUI_OpeningFcn gets called.  An

%      unrecognized property name or invalid value makes property application

%      stop.  All inputs are passed to 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 GUI

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name',       mfilename, ...

    'gui_Singleton',  gui_Singleton, ...

    'gui_OpeningFcn', @GUI_OpeningFcn, ...

    'gui_OutputFcn',  @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 GUI is made visible.

function 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 GUI (see VARARGIN)

% Choose default command line output for GUI

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

% UIWAIT makes GUI wait for user response (see UIRESUME)

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = 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 pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles)

%清空

ax1=(handles.axes1);cla(ax1,'reset')

ax2=(handles.axes2);cla(ax2,'reset')

ax3=(handles.axes3);cla(ax3,'reset')

ax4=(handles.axes4);cla(ax4,'reset')

ax5=(handles.axes5);cla(ax5,'reset')

ax6=(handles.axes6);cla(ax6,'reset')

ax7=(handles.axes7);cla(ax7,'reset')

ax8=(handles.axes8);cla(ax8,'reset')

ax9=(handles.axes9);cla(ax9,'reset')

ax10=(handles.axes10);cla(ax10,'reset')

ax11=(handles.axes11);cla(ax11,'reset')

ax12=(handles.axes12);cla(ax12,'reset')

ax13=(handles.axes13);cla(ax13,'reset')

ax14=(handles.axes14);cla(ax14,'reset')

ax15=(handles.axes15);cla(ax15,'reset')

ax16=(handles.axes16);cla(ax16,'reset')

set(handles.text3,'string',' ');

%选择图片路径

[fname,pname,index] = uigetfile({'*.jpg';'*.bmp'},'选择图片');

str = [pname fname];

c = imread(str);

axes(handles.axes1); %获取句柄

imshow(c);

I = c;

title('测试图片');

handles.I=I;

guidata(hObject, handles);

% hObject    handle to pushbutton1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)

global I;

I=handles.I;

I1=rgb2gray(I);%转灰度图

axes(handles.axes2) %显示在axes2里

imshow(I1);

title('灰度图');

handles.I1=I1;

guidata(hObject, handles);

% hObject    handle to pushbutton2 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton3.

function pushbutton3_Callback(hObject, eventdata, handles)

I1=handles.I1;

I2=edge(I1,'roberts',0.18,'both');%边缘检测

axes(handles.axes3) ;%显示在axes3

imshow(I2);

title('边缘检测');

handles.I2=I2;

guidata(hObject, handles);

% hObject    handle to pushbutton3 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton4.

function pushbutton4_Callback(hObject, eventdata, handles)

I2=handles.I2;

se=[1;1;1]; %

I3=imerode(I2,se); %%腐蚀,相当于让线条更细,细到没有。

axes(handles.axes4);

imshow(I3);

title('腐蚀图');

handles.I3=I3;

guidata(hObject, handles);

% hObject    handle to pushbutton4 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton5.

function pushbutton5_Callback(hObject, eventdata, handles)

I3=handles.I3;

axes(handles.axes5);

imshow(I4);

title('开运算图')

handles.I4=I4;

guidata(hObject, handles);

% hObject    handle to pushbutton5 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton6.

function pushbutton6_Callback(hObject, eventdata, handles)

I4=handles.I4;

[n1, n2] = size(I4);

I4(1:round(n1/3), 1:n2) = 0;

imshow(I5);

title('去除小面积干扰')

handles.I5=I5;

guidata(hObject, handles);

% hObject    handle to pushbutton6 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton7.

function pushbutton7_Callback(hObject, eventdata, handles)

axes(handles.axes7);

imshow(dw);

title('车牌定位图');

handles.dw=dw;

guidata(hObject, handles);

% hObject    handle to pushbutton7 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton8.

function pushbutton8_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton8 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in pushbutton9.

function pushbutton9_Callback(hObject, eventdata, handles)

k1=1;

k2=1;

s=sum(d);

j=1;

while j~=n

    while s(j)==0

        j=j+1;

    end

    k1=j;

    while s(j)~=0&&j<=n-1

        j=j+1;

    end

    k2=j-1;%

    if k2-k1>=round(n/6.5)%

        [val,num]=min(sum(d(:,[k1+5:k2-5])));%

        d(:,k1+num+5)=0;  %

    end

end

% 再切割

d=qiege(d);

y1=10;y2=0.25;

flag=0;

word1=[];

%拎出第一个字符

wide=round(1/8*N);

temp=(imcrop(d,[1 1 wide m]));

word1=temp;

d(:,[1:wide])=0;

d=qiege(d);%踢出掉第一个字符

return

word2=wordprocess(word2);

word3=wordprocess(word3);

word4=wordprocess(word4);

word5=wordprocess(word5);

word6=wordprocess(word6);

word7=wordprocess(word7);

axes(handles.axes10);

imshow(word1);

axes(handles.axes11);

imshow(word2);

axes(handles.axes12);

imshow(word3);

axes(handles.axes13);

imshow(word4);

axes(handles.axes14);

imshow(word5);

axes(handles.axes15);

imshow(word6);

axes(handles.axes16);

imshow(word7);

% hObject    handle to pushbutton9 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

  • 运行结果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值