我正在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
在上面的第四個例子中。
我將不勝感激關於如何去隔離這些字母的一些建議。沒有代碼是必要的,任何建議表示讚賞。