Drawing a circle around optic disk
Show older comments
Hi,
I'm a new bee to Matlab. In my project, I'm supposed to draw a circle along the border of the Optic disk found in the retinal image. (Actually, I want to detect optic disk). I did some work and the
I = imread('I.png');
% gradient filter applied
[Gmag Gdir] = imgradient(I, 'prewitt');
figure, imshow(Gmag, []), title('Gradient magnitude')
figure, imshow(Gdir, []), title('Gradient direction')
% Binary image gerated with threshold
bi = Gmag > 70;
Gx = [1 +2 +1; 0 0 0; -1 -2 -1]; Gy = Gx';
temp_x = conv2(bi, Gx, 'same');
temp_y = conv2(bi, Gy, 'same');
b2 = sqrt(temp_x.^2 + temp_y.^2);
figure, imshow(b2);
%image opened horizontally and vertically
se90 = strel('line',3,90);
se0 = strel('line',3,0);
BWdil = imdilate(b2, [se90 se0]);
figure, imshow(BWdil);
% Boarders are cleared
BWnobo = imclearborder(BWdil,4);
figure, imshow(BWnobo);
% Refined the edges
SeD = strel('diamond',1);
BWf = imerode(BWnobo, SeD);
BWfinal = imerode(BWf,SeD);
figure, imshow(BWf),
% dege detection done with im2bw
x = im2bw(BWf,0.5);
figure, imshow(x),title('X Image');
Now I'm having a dotted line around the optic disk. Could anyone help me to draw a proper circle along the border of the optic disk and to get the coordinates of the centre point with the radius of the circle drawn?
Images attached I = original grayscale image
<<
<<

>> x = final output of the code

>>
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Optics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!