如何在Matlab中这些字符的边缘之间填充? [英] How can I fill between edges of these characters in matlab?

查看:231
本文介绍了如何在Matlab中这些字符的边缘之间填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的图片

如果我使用填充功能,我会得到这样的图像

if I use imfill function,I get like this image

我需要把孔放在第6号. 我该怎么办

I need to put the hole in number 6. how can I do this

plz谁能帮助我

谢谢

推荐答案

检查以下解决方案:

我一直在填充图像并填充图像的负片,直到解决它为止.

I played with filling image and filling negative of image, until solving it.

这是我的代码:

I = imread('https://i.imgur.com/Ap2PX2E.png');
I = im2bw(I);

J1 = imfill(I, 'holes');
J2 = imfill(I, [1, 1]);
J3 = imfill(~J2, [1, 1]);
J4 = imfill(~J3, 'holes');
J5 = J1 & (~J4);

figure;imshow(J5)

结果:

这篇关于如何在Matlab中这些字符的边缘之间填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆