MATLAB Answers

Unable to draw just the boundary of an image

조회 수: 1(최근 30일)
Warid Islam
Warid Islam 2021년 7월 19일
댓글: Warid Islam 2021년 7월 19일
Hi,
I want to draw just the boundary of a ROI. segFP1.jpg is the original image. I applied the code below but I don't get the desired result. My result is displayed in e1.jpg. Any suggestions would be appreciated. Thank you.
I=imread('segFP1.jpg');
figure,imshow(I)
I1=bwperim(I,8);
figure,imshow(I1)

채택된 답변

DGM
DGM 2021년 7월 19일
편집: DGM 2021년 7월 19일
Well, you're loading a grayscale image subject to destructive compression as a jpg file. At no point do you explicitly threshold the image, so it's probably just getting thresholded at I>0, and so a bunch of compression artifacts are part of the binarized image.
I=imread('segFP1.jpg'); % this is not a binary image
I = I>128; % threshold it somewhere
I1=bwperim(I,8); % otherwise this will
subplot(2,1,1)
imshow(I)
subplot(2,1,2)
imshow(I1)
  댓글 수: 3
Warid Islam
Warid Islam 2021년 7월 19일
Hi @DGM,
That worked perfectly. Thanks a lot.

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

추가 답변(0개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by