I try to exclude blood vessels from the retina image and remain exudates using Kirsch Patterns edge detection technology, but still some parts of the unwanted blood vessels and the “round shape” optical disc on the left side of the image remain. I wonder if there is a better solution to completely eliminate these or add some other methods?
Home:
clc;
clear all;
close all;
%Read Input Retina Image
inImg = imread('image013b.png');
dim = ndims(inImg);
if(dim == 3)
%Input is a color image
inImg = rgb2gray(inImg);
end
%Extract Blood Vessels
Threshold = 6;
bloodVessels = VesselExtract(inImg, Threshold);
%Output Blood Vessels image
figure;
subplot(121);imshow(inImg);title('Input Image');
subplot(122);imshow(bloodVessels);title('Extracted Blood Vessels');
VesselExtract.m:
function bloodVessels = VesselExtract(inImg, threshold)
%Kirsch Templates
h1=[5 -3 -3;
5 0 -3;
5 -3 -3]/15;
h2=[-3 -3 5;
-3 0 5;
-3 -3 5]/15;
h3=[-3 -3 -3;
5 0 -3;
5 5 -3]/15;
h4=[-3 5 5;
-3 0 5;
-3 -3 -3]/15;
h5=[-3 -3 -3;
-3 0 -3;
5 5 5]/15;
h6=[ 5 5 5;
-3 0 -3;
-3 -3 -3]/15;
h7=[-3 -3 -3;
-3 0 5;
-3 5 5]/15;
h8=[ 5 5 -3;
5 0 -3;
-3 -3 -3]/15;
%Spatial Filtering by Kirsch Templates
t1=filter2(h1,inImg);
t2=filter2(h2,inImg);
t3=filter2(h3,inImg);
t4=filter2(h4,inImg);
t5=filter2(h5,inImg);
t6=filter2(h6,inImg);
t7=filter2(h7,inImg);
t8=filter2(h8,inImg);
s=size(inImg);
bloodVessels=zeros(s(1),s(2));
temp=zeros(1,8);
%
for i=1:s(1)
for j=1:s(2)
temp(1)=t1(i,j);temp(2)=t2(i,j);temp(3)=t3(i,j);temp(4)=t4(i,j);
temp(5)=t5(i,j);temp(6)=t6(i,j);temp(7)=t7(i,j);temp(8)=t8(i,j);
if(max(temp)>threshold)
bloodVessels(i,j)=max(temp);
end
end
end

source
share