Exclude blood vessels from the retina image

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

enter image description here

+4
source share
1 answer

, , , , , , , .:)

1:

input = imread('retina.jpg');
image = double(input(:,:,2));

interior_mask = zeros(size(image));
interior_mask(image >= 10) = 1.0;

% a lot of eroding
for i=1:30
    interior_mask = imfilter(interior_mask, fspecial('average'));
end

interior_mask(interior_mask < 1.0) = 0;

: .

enter image description here enter image description here

2:

masked_mean = mean2(image(interior_mask > 0));
threshold = masked_mean + 40;
discexu_mask = zeros(size(image));
discexu_mask(image > threshold) = 1.0;

% Dilations
for i=1:10
    discexu_mask = imfilter(discexu_mask, fspecial('average'));
end

discexu_mask(discexu_mask > 0) = 1;

: , . : , /.

enter image description here enter image description here

3:: /.

% Laplace of Gaussians
fsmall= fspecial('gaussian',[10 10], 3);
flarge = fspecial('gaussian',[30 30], 10);

lightly_filtered = imfilter(image, fsmall);
heavily_filtered = imfilter(image, flarge);

% Blood vessels get blurred-out on heavily filtered image.
% Blood vessels are always darker than their surroundings.
% That why vessels will be bright after this subtraction: 
lofg = heavily_filtered - lightly_filtered;

% Blood vessels are now bright; eliminate negative values.
lofg(lofg < 0) = 0;
lofg(interior_mask == 0) = 0;

% Mean of non-zero lofg elements
mean_of_nonzero_lofg = mean2(lofg(lofg>0));

lofg_threshold_mask = zeros(size(image));
lofg_threshold_mask(lofg > mean_of_nonzero_lofg) = 1;

% mean of image elements from positions where lofg values are high:
image_threshold = mean2(image(lofg_threshold_mask == 1));

vessels0 = image;
vessels0(image > image_threshold) = 0;
vessels0(interior_mask == 0) = 0;
vessels0(discexu_mask == 1) = 0;

:

enter image description here

4 / .

3 . , , , / ( , ). , , .

: , ( ). : (, , ).

enter image description here enter image description here

, :

enter image description here

, / - . , LoG . , , ( ).

0

Source: https://habr.com/ru/post/1677719/


All Articles