Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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');
like image 776
Wong Wengkeong Avatar asked Dec 05 '25 11:12

Wong Wengkeong


1 Answers

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

like image 95
Ratbert Avatar answered Dec 08 '25 01:12

Ratbert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!