Azzera filtri
Azzera filtri

Split the license plate letters

1 visualizzazione (ultimi 30 giorni)
Blazej Staniak
Blazej Staniak il 29 Nov 2021
Commentato: yanqi liu il 30 Nov 2021
Hi, I need to split the license plate letters. My program consists in uploading a photo, finding the image of the license plate and cutting out the plate. I just need to split the numbers and letters of this array right now. I don't know exactly how to do this. Does anyone know how it should look like? I will present the effect that I want to achieve in the attachment. The result he wants to achieve is shown on the first appendix
Regards

Risposte (1)

yanqi liu
yanqi liu il 29 Nov 2021
yes,sir,may be use
clc; clear all; close all;
img = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/807304/obraz_2021-11-20_110914.png');
img2 = imcrop(img, [94 129 1086 217]);
bw = im2bw(img2);
bw = ~bw;
bw = imclearborder(bw);
bw = bwareaopen(bw, round(numel(bw)*0.01));
[L,num] = bwlabel(bw);
stats = regionprops(L);
rects = cat(1, stats.BoundingBox);
rects = sortrows(rects, 1);
ims = [];
figure('Color', [0.8 0.8 0.8]);
for i = 1 : size(rects, 1)
ims{i} = imcrop(img2, round(rects(i,:)));
bwi = ~im2bw(ims{i});
bwi = imresize(bwi, [48 28], 'bilinear');
subplot(1,size(rects, 1),i); imshow(bwi, []);
end
  2 Commenti
Blazej Staniak
Blazej Staniak il 29 Nov 2021
Iprops=regionprops(im4,'BoundingBox','Area', 'Image');
area = Iprops.Area;
count = numel(Iprops);
maxa= area;
boundingBox = Iprops.BoundingBox;
for i=1:count
if maxa<Iprops(i).Area
maxa=Iprops(i).Area;
boundingBox=Iprops(i).BoundingBox;
end
end
im = imresize(im4, [240 NaN]);
im = imopen(im, strel('rectangle', [4 4]));
im = imcrop(im3, boundingBox);%wyciecie tablicy
%%figure(5); imshow(im)
im = bwareaopen(~im, 1000); %usuniece obiektow jesli szerokosc jest za dluga lub za krotka niz 500
im_neg = imcomplement(im);
%%figure(6), imshowpair(im,im_neg,'montage');
labeledImage= bwlabel(im);
this is part of my code, I just need to add a few lines to make it work the way you presented
yanqi liu
yanqi liu il 30 Nov 2021
clc; clear all; close all;
img = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/807304/obraz_2021-11-20_110914.png');
img2 = imcrop(img, [94 129 1086 217]);
bw = im2bw(img2);
bw = ~bw;
bw = imclearborder(bw);
im4 = bwareaopen(bw, round(numel(bw)*0.01));
Iprops=regionprops(im4,'BoundingBox','Area', 'Image');
area = Iprops.Area;
count = numel(Iprops);
maxa= area;
boundingBox = Iprops.BoundingBox;
for i=1:count
if maxa<Iprops(i).Area
maxa=Iprops(i).Area;
boundingBox=Iprops(i).BoundingBox;
end
end
im = imresize(im4, 240/size(im4, 1), 'bilinear');
im = imopen(im, strel('rectangle', [4 4]));
%%figure(6), imshowpair(im,im_neg,'montage');
im = imclose(im, strel('rectangle', [2 2]));
labeledImage= bwlabel(im);
% use the follow code
stats = regionprops(labeledImage);
rects = cat(1, stats.BoundingBox);
rects = sortrows(rects, 1);
ims = [];
figure('Color', [0.8 0.8 0.8]);
for i = 1 : size(rects, 1)
imi = imcrop(im, round(rects(i,:)));
imi = imresize(imi, [48 28], 'bilinear');
subplot(1,size(rects, 1),i); imshow(imi, []);
end

Accedi per commentare.

Categorie

Scopri di più su Images in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by