本文介绍了充水用于车牌识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个二进制图像的牌照。
I have a number plate which is a binary image.
我对图像进行了扩张,使边缘变粗,然后填充,最后是细化的侵蚀:
I performed dilation to the image to thicken the edges then "flood filling", lastly erosion for thinning:
但我希望我的输出是这样的:
But i want my output to be like this:
有人可以帮帮我吗?并告诉我如何获得所需的输出。
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');
推荐答案
您可以通过其他一些巧妙的调用来执行此操作 imfill
。这是一种方法,假设你的二进制图像在数组中 BW
:
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');
和 Res
是包含的二进制图像所需的输出:
and Res
is a binary image that contains the desired output:
这篇关于充水用于车牌识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!