基于垂直投影的车牌字符分割matlab程序

该MATLAB程序实现了一种基于垂直投影的车牌字符分割方法。通过'segment'函数找到图像中每个字符的边界,若找到的字符数不足7个,将尝试清理已识别字符间的区域并再次调用函数。最终保留面积最大的7个字符段。
摘要由CSDN通过智能技术生成

function [seg] = character_segmentation(bw, DIGIT_WIDTH, MIN_AREA);
% character_segmentation: Returns the digit segments in the supplied binary image.
% The function uses the "segment" function, keeping only the seven
% segments in the result with largest area, and in case less than seven
% segments were found, it attempts to recall the function, making the
% separation between the already found segments clearer (by cleaning the
% bits which are there.


seg = segment(bw, DIGIT_WIDTH, MIN_AREA);
[x y] = size(seg);

% If we got less than 7 digits, we try to make the sepration between them
% clearer by cleaning the bits between them, and we call the "segment"
% function again:
if x < 7
    for i = 1 : x
        bw(:,seg(i,2))=0;
    end;
    seg = segment(bw, DIGIT_WIDTH, MIN_AREA);
end;

% Keeping in the results the seven segments with the largest area:
area = [];
for i = 1 : x
    pic = bw(:, seg(i,1) : seg(i,2), :);
    area(i) = bwarea(pic);   %bwarea函数计算对象面积
end;

area1 = sort(area);
seg = seg';

for j = 1:(length(area1)-7)
    i = find(area == area1(j));
    len = length(area);
    if i == 1
        area = [area(2:len)];
        seg = [seg(:,2:len)];
    elseif i == len
     

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值