我试图从视网膜图像中消除血管,并使用边缘检测技术'Kirsch's Templates'保留渗出液,但仍然是左侧不需要的血管和视盘“圆形”的某些部分。形象依旧。我想知道是否有更好的解决方案可以完全消除这些或添加其他技术?
主要:
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's 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's 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