MATLAB Answers

Medical Image Segmentation Canny Edge Detection

74 views (last 30 days)
Samuel Leeney
Samuel Leeney on 1 Dec 2020
Answered: Madhav Thakker on 21 Dec 2020
Hi Guys,
I am trying to segment the attached image (and many similar ones) so that the segment encloses the large dark capsule in the center.
I have got fairly close using the edge function using 'canny', however I am unable to connect all the edges.
I am wondering if there is a) an effective way to join edges like this, or b) is there any more processing I can do to the image to improve the accuracy of the edge detection. The image I have chosen is particualry difficult because there is a dark shadow going over the top, however this happens sometimes so cant be ignored.
I have tried closing and dilating the edge lines however some of the gaps are just too big.
Thanks in advance!
%Read Image
clear all
im = imread('LN034_T95.png');
im_original = im;
im = double(im2gray(im)); %set image to grey
im = imresize(im,[3200,3200]);%resize
%Remove Background
I = RemoveBackground(im);
figure(1)
imshow(I,[])
%Remove gaussian noise (IE random noise in image)
figure(2)
DoS = 500; %degree of smoothing
I = imbilatfilt(I,DoS);
imshow(I,[])
%Apply filter to remove salt and pepper noise (white / black 'dots' in
%image)
%A median filter should do this.
m = 25; n = 25; %sets size of filter
I = medfilt2(I,[m,n]);
figure(3)
imshow(I,[])
%gradient across image to highlight edges
figure(4)
I = imgradient(I,'sobel');
imshow(I,[])
%find edge using canny filter
figure(5)
I = edge(I,'Canny',[0 0.15]); %compared this with 'prewitt' filter and this one was much better
imshow(I,[])

  0 Comments

Sign in to comment.

Answers (1)

Madhav Thakker
Madhav Thakker on 21 Dec 2020
Hi Samuel,
I understand you want to close the edges in the binary output image.
Since you have enough number of points for the outer edges, you can try something like convex hull for each capsule in the image.
Hope this helps.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!