Unable to draw just the boundary of an image
1 view (last 30 days)
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.
DGM on 19 Jul 2021
Edited: DGM on 19 Jul 2021
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