필터 지우기
필터 지우기

Split the license plate letters

조회 수: 1 (최근 30일)
Blazej Staniak
Blazej Staniak 2021년 11월 29일
댓글: yanqi liu 2021년 11월 30일
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

답변 (1개)

yanqi liu
yanqi liu 2021년 11월 29일
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
Blazej Staniak
Blazej Staniak 2021년 11월 29일
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 2021년 11월 30일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by