# 基于神经网络的车牌识别系统

### 文章目录

• 基于神经网络的车牌识别系统
• 前言
• 一、总体方案设计
• 二、数据准备
• 2.1 车牌定位
• 2.2 字符裁剪
• 2.3 构建字符库
• 三、神经网络模型训练
• 3.1 数据预处理
• 3.2 模型训练
• 四、车牌识别系统软件
• 总结

# 二、数据准备

## 2.1 车牌定位

``````function [y_image] = extract_blue_region(image);
% extract_blue_region: Determines the blue regions in the picture using
% the CIE-XYZ color system, and returns a black and white picture which is
% set on the yellow regions only.

% Define the lines in CIE-XYZ space, use to determine yellow color
lower_A = 0.87; lower_B = 0.04;
upper_A = 1.5 ; upper_B = -0.125;

% Convert 8-bit format of org_pic pixels to double format
pic = double(image)+1;
pic = pic.*1.6;

% Conversion from RGB709 to CIE-XYZ
x = ( pic(:,:,1).*0.412453 + pic(:,:,2).*0.35758 + pic(:,:,3).* 0.180423);
y = ( pic(:,:,1).*0.212671 + pic(:,:,2).*0.715160 + pic(:,:,3).* 0.072169);
z = ( pic(:,:,1).*0.019334 + pic(:,:,2).*0.119193 + pic(:,:,3).*0.950227);

sum = x + y + z;
x_bar = x./sum;
y_bar = y./sum;

% Define yellow color in CIE-XYZ space
x_sum_conds = ( ((x_bar > 0.34) & (sum > 400) & (sum < 500) ) | ((x_bar > 0.37) & (sum > 200) & (sum < 500)) );
xy_conds = ( (y_bar > 0.35) & (y_bar < 0.5) & (y_bar > (lower_A*x_bar + lower_B)) & (y_bar < (upper_A*x_bar + upper_B)) );

y_image = (x_sum_conds & xy_conds);
return;
``````

## 2.2 字符裁剪

``````function e=qiege(d)
[m,n]=size(d);
top=1;bottom=m;left=1;right=n;   % init
while sum(d(top,:))==0 && top<=m
top=top+1;
end
while sum(d(bottom,:))==0 && bottom>=1
bottom=bottom-1;
end
while sum(d(:,left))==0 && left<=n
left=left+1;
end
while sum(d(:,right))==0 && right>=1
right=right-1;
end
dd=right-left;
hh=bottom-top;
e=imcrop(d,[left top dd hh]);
``````

# 三、神经网络模型训练

## 3.1 数据预处理

``````for i=1:len
for j=1:max(label)
if j-1==train_y(i)
train_y1(i,j)=1;
end
end
end
train_y= train_y1;
``````