Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

algorithm - Flood filling for number plate recognition

I have a number plate which is a binary image.

enter image description here

I performed dilation to the image to thicken the edges then "flood filling", lastly erosion for thinning:

enter image description here

But i want my output to be like this:

enter image description here

Can anyone help me, please? And show me how to get the desired output.

ab=imread('test1.png');

level=graythresh(ab);
ab=im2bw(ab,level);

se=strel('disk',1);
ab=imdilate(ab,se); 


ab=imfill(ab,'holes');
ab=bwmorph(ab,'thin',1);
ab=imerode(ab,strel('line',3,90));

figure();imshow(ab,[]); title('floodFilling');
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can do this with a few other clever calls to imfill. Here is a way, assuming your binary image is in the array BW:

Tmp = imfill(BW, 'holes');
Tmp2 = imfill(Tmp-BW, 'holes');
Res = Tmp - imfill(BW & Tmp2, 'holes');

and Res is a binary image that contains the desired output:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...