A list,

The function of the simulated parking space management system is: the system to enter the parking space of the vehicle license plate recognition, will identify the license plate number display; Then the owner of the face recognition, frame the owner of the photo of the face part as the owner of the information mark, recorded in the system library. During the period when the vehicle is in storage, the system user can view the process and results of obtaining the information of the vehicle and the owner at will. And when the vehicle leaves, the system library will erase all information about the vehicle and its owner.

Ii. Source code

function varargout = slyarh_main(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @slyarh_main_OpeningFcn, ...
                   'gui_OutputFcn',  @slyarh_main_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
function slyarh_main_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = slyarh_main_OutputFcn(hObject, eventdata, handles) 
varargout{1} = handles.output;

%“※﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ 启动画面 ﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ ※”
ImageFile  = '.\字符模板\wel.png';
ScreenSize = get(0,'ScreenSize');
jImage     = im2java(imread(ImageFile));
jfBounds   = num2cell([...
    (ScreenSize(3)-jImage.getWidth)/2 ...
    (ScreenSize(4)-jImage.getHeight)/2 ...
    jImage.getWidth ...
    jImage.getHeight]);
jFrame     = javax.swing.JFrame;
icon       = javax.swing.ImageIcon(jImage);
label      = javax.swing.JLabel(icon);
jFrame.getContentPane.add(label);
jFrame.setUndecorated(true)
jFrame.setBounds(jfBounds{:});
jFrame.pack
jFrame.show
pause(3)
jFrame.dispose
%“※﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏  ﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ ※”

%“※﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ 背景和logo ﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ ※”
h = handles.figure1; %创建一个Figure,并返回其句柄
newIcon = javax.swing.ImageIcon('.\字符模板\logo.png')
figFrame = get(h,'JavaFrame'); %取得Figure的JavaFrame。
figFrame.setFigureIcon(newIcon); %修改图标
ha=axes('units','normalized','pos',[0 0 1 1]);
uistack(ha,'down');
ii=imread('.\字符模板\bg1.png');
%设置程序的背景图为beijing1.jpg
image(ii);
colormap gray
set(ha,'handlevisibility','off','visible','off');
%“※﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏  ﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ ※”

%“※﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ 停车 ﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ ※”
function bt_in_Callback(hObject, eventdata, handles)
[filename pathname]=uigetfile({'*.jpg';'*.png';'*.bmp'}, '正在拍摄入场的车辆~');
I=imread([pathname '\' filename]);
handles.I=I;
guidata(hObject, handles);
axes(handles.axes1);imshow(I);title('汽车靓照');
axes(handles.axes11);imshow(I);title('汽车靓照');
imwrite(I,'.\进车记录\原.jpg');
set(handles.bt_new,'visible','on');
set(handles.ui_in,'visible','off');
set(handles.ui_out,'visible','on');
%“※﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ 进车 ﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏﹋﹏ ※”
I=handles.I;
I1=rgb2gray(I);
I2=edge(I1,'roberts',0.18,'both');
imwrite(I1,'.\进车记录\灰度.jpg');
imwrite(I2,'.\进车记录\边缘.jpg');
se=[1;1;1];
I3=imerode(I2,se);%腐蚀操作
imwrite(I2,'.\进车记录\腐蚀.jpg');
se=strel('rectangle',[25,25]);
I4=imclose(I3,se);%图像聚类,填充图像
I5=bwareaopen(I4,2000);%去除聚团灰度值小于2000的部分
[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为向量yellow_y的元素中的最大值,MaxY为该值得索引
PY1=MaxY;
while((Blue_y(PY1,1)>=5)&&(PY1>1))
    PY1=PY1-1;
end
PY2=MaxY;
while((Blue_y(PY2,1)>=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)<3)&&(PX1<x))
    PX1=PX1+1;
end
PX2=x;
while((Blue_x(1,PX2)<3)&&(PX2>PX1))
    PX2=PX2-1;
end
PX1=PX1-1;%对车牌区域的矫正
PX2=PX2+1;
dw=I(PY1:PY2-8,PX1:PX2,:);
t=toc;
imwrite(dw,'.\进车记录\定位.jpg');
b=rgb2gray(dw);%将车牌图像转换为灰度图
g_max=double(max(max(b)));
g_min=double(min(min(b)));
T=round(g_max-(g_max-g_min)/3);%T为二值化的阈值
[m,n]=size(b);
d=(double(b)>=T);%d:二值图像
imwrite(d,'.\进车记录\二值.jpg');
% imwrite(d,'二值化.jpg');
%均值滤波前
%滤波
h=fspecial('average',3);
%建立预定义的滤波算子,average为均值滤波,模板尺寸为3*3
d=im2bw(round(filter2(h,d)));%使用指定的滤波器h对h进行d即均值滤波
imwrite(d,'.\进车记录\均值.jpg');
% imwrite(d,'均值滤波.jpg');
%某些图像进行操作
%膨胀或腐蚀
se=eye(2);%单位矩阵
[m,n]=size(d);%返回信息矩阵
if bwarea(d)/m/n>=0.365%计算二值图像中对象的总面积与整个面积的比是否大于0.365
    d=imerode(d,se);%如果大于0.365则进行腐蚀
elseif bwarea(d)/m/n<=0.235%计算二值图像中对象的总面积与整个面积的比值是否小于0.235
    d=imdilate(d,se);%%如果小于则实现膨胀操作
end
imwrite(I2,'.\进车记录\膨胀.jpg');
%寻找连续有文字的块,若长度大于某阈值,则认为该块有两个字符组成,需要分割
d=qiege(d);
[m,n]=size(d);
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);
%切割出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;%word1
        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);
[m,n]=size(word1);
%商用系统程序中归一化大小为40*20
word1=imresize(word1,[40 20]);
word2=imresize(word2,[40 20]);
word3=imresize(word3,[40 20]);
word4=imresize(word4,[40 20]);
word5=imresize(word5,[40 20]);
word6=imresize(word6,[40 20]);
word7=imresize(word7,[40 20]);
axes(handles.axes2);imshow(word1);
axes(handles.axes3);imshow(word2);
axes(handles.axes4);imshow(word3);
axes(handles.axes5);imshow(word4);
axes(handles.axes6);imshow(word5);
axes(handles.axes7);imshow(word6);
axes(handles.axes8);imshow(word7);
Copy the code

3. Operation results



Fourth, note

Version: 2014 a