Split the license plate letters
조회 수: 1 (최근 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
댓글 수: 0
답변 (1개)
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
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 Center 및 File Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!