资源简介
基于Hough变换的车牌子图像提取,得到清晰的车牌区域,输出直线方程与坐标点
代码片段和文件信息
N = 44/14;%车牌长宽比
%%%%%灰度图转换
I = imread(‘chepai2.jpg‘);
subplot(131);
imshow(I);
I1 = rgb2gray(I);
subplot(132);
imshow(I1);
I11 = medfilt2(I1);%中值滤波
subplot(133);
imshow(I11);
I2 = edge(I11‘canny‘);%边缘检测
figure
imshow(I2);
se = [1;1;1];
I3 = imerode(I2se);%图像腐蚀
figure
imshow(I3);
%%%%%%灰度跳变阈值初步确定车牌区域
[x0y0] = size(I3);
s = zeros(1y0);
for cnt1 = 1:x0
for cnt2 = 2:y0
if abs(I3(cnt1cnt2)-I3(cnt1(cnt2 - 1)))==1
s(cnt1) = s(cnt1) + 1;
end
end
end
r1 = zeros(1x0);
for cnt1 = 1:x0
if s(cnt1) >= 20 %设置阈值为20
r1(cnt1) = cnt1;
end
end
cnt3 = 0;%寻找车牌区域第一行,存在cnt3中
for cnt1 = 1:x0
if r1(cnt1) == 0
cnt3 = cnt3 + 1;
else
break;
end
end
figure
A = 10;
B = 25;
I4 = I1((cnt3-A):(max(r1)+B)1:480);%初步取出车牌区域
imshow(I4);
rotI = imrotate(I40‘crop‘);%图像旋转(若有必要)
I5 = edge(rotI‘canny‘);%canny算子边缘检测
figure
imshow(I5);
Theta_test = 1;%参数度量选择
Rho_test = 1;
[HTR] = hough(I5‘ThetaResolution‘Theta_test‘RhoResolution‘Rho_test);%Hough变换
%%%%%选取theta = 0 时的直线
[x00x0] = size(T);
[ab] = size(H);
H0 = zeros(ab);
for cnt1 = 1:x0
if T(cnt1) == 0
H0(:cnt1) = H(:cnt1);
end
end
T0 = zeros(1x0);
for cnt1 = 1:x0
if T(cnt1) == 0
T0(1cnt1) = T(1cnt1);
end
end
P0 = houghpeaks(H02‘threshold‘ceil(0.4*max(H0(:))));
H_mid = (H(P0(11)P0(12)) + H(P0(21)P0(22)))/2;
lines0 = houghlines(I5T0RP0‘FillGap‘50
相关资源
- 盲道分割.zip含过程图
- hough变换matlab程序
- 基于MATLAB+Hough变换对工件尺寸检测.
- 自编霍夫变换实现直线检测
- matlab实现边缘检测算法hough
- hough变换检测圆的matlab程序
- hough变换的matlab源代码
- 基于MATLABhough变换的表盘刻度识别系统
- 基于Hough变换的航迹起始方法
- 基于HOUGH变换的车道线检测和识别的程
- 随机hough变换RHT提取椭圆matlab源程序
- hough变换法检测椭圆matlab
- random-hough-transform 利用随机霍夫变换进
- chapter9 图像分割
- hough-Matlab 利用Matlab编写的基于hough变
- hough-circle 读入图像
- Hough 实现Hough直线检测
- lines-hough
- Hough-detection
- hough_matlab matlab实现图像的读取
- xiaochengxu 该程序包中有基于Hough变换的
- Matlab 边缘检测与Hough变换
- hough变换检测直线的matlab源程序,可直
- matlab的hough直线检测绘制
- 边缘检测和hough 变换实现边缘检测
- 基于matlab的霍夫变换处理案例
- hough变换圆检测matlab程序包括几幅图片
- matlab实现的hough变换
- matlab基于hough变换的直线检测
- hough变换圆检测matlab程序包括几幅图片
评论
共有 条评论