Fill inner holes in the image

1 次查看(过去 30 天)
mukesh bisht
mukesh bisht 2019-11-20
Hi i have an image in which some holes are there , i want to make the image as solid . How to do that. I have attached the image
  1 个评论
mukesh bisht
mukesh bisht 2019-12-9
Hi
now i want to make the outline of this filled image to be smoother. i.e. the curved portion replaced with straight lines.
how to do it?

请先登录,再进行评论。

回答(1 个)

JESUS DAVID ARIZA ROYETH
change image.jpeg for the name of your image
image=imread('image.jpeg');
mask=imfill(imclose(not(imbinarize(rgb2gray(image))),strel('disk',1)),'holes');
R=image(:,:,1);
G=image(:,:,2);
B=image(:,:,3);
R(mask)=255;
G(mask)=0;
B(mask)=0;
image(:,:,1)=R;
image(:,:,2)=G;
image(:,:,3)=B;
figure;
imshow(image)
  2 个评论
mukesh bisht
mukesh bisht 2019-11-20
Thanks a lot sir.I had been trying this since long time.
JESUS DAVID ARIZA ROYETH
编辑:JESUS DAVID ARIZA ROYETH 2019-11-20
please formally accept my answer.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by