Fill inner holes in the image

조회 수: 3 (최근 30일)
mukesh bisht
mukesh bisht 2019년 11월 20일
댓글: mukesh bisht 2019년 12월 9일
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
JESUS DAVID ARIZA ROYETH 2019년 11월 20일
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일
편집: JESUS DAVID ARIZA ROYETH 2019년 11월 20일
please formally accept my answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by