我正在Matlab中制作一个脚本,用于拍摄汽车尾部的图像。经过一些图像处理后,我想输出汽车原始图像,并在汽车牌照周围绘制矩形。以下是我迄今写:如何以不同视角识别牌照上的字母
origImg = imread('CAR_IMAGE.jpg');
I = imresize(origImg, [500, NaN]); % easier viewing and edge connecting
G = rgb2gray(I);
M = imgaussfilt(G); % blur to remove some noise
E = edge(M, 'Canny', 0.4);
% I can assume all letters are somewhat upright
RP = regionprops(E, 'PixelIdxList', 'BoundingBox');
W = vertcat(RP.BoundingBox); W = W(:,3); % get the widths of the BBs
H = vertcat(RP.BoundingBox); H = H(:,4); % get the heights of the BBs
FATTIES = W > H; % find the BBs that are more wide than tall
RP = RP(FATTIES);
E(vertcat(RP.PixelIdxList)) = false; % remove more wide than tall regions
D = imdilate(E, strel('disk', 1)); % dilate for easier viewing
figure();
imshowpair(I, D, 'montage'); % display original image and processed image
下面是一些例子:
从他我不确定如何隔离车牌字母,特别是在上面的第二个示例中,由于图像的角度,每个字母的面积都减小了。我的第一个想法是获得所有区域的边界框,并只保留周长与面积比例“相似”的区域,但这会导致删除当我扩大图像时连接的板的字母,如K
和V
在上面的第四个例子中。
我将不胜感激关于如何去隔离这些字母的一些建议。没有代码是必要的,任何建议表示赞赏。