I have used following code to segment a fundus image but the results are not very clear. The test4.jpeg fill is the original fundus images that I have used .please help

2 ビュー (過去 30 日間)
I = imread(test4.jpeg);
Unable to resolve the name 'test4.jpeg'.
L = I(:,:,2);
ig = adapthisteq(L,'Numtiles',[100 10],'ClipLimit',0.005);
ig1 = imcomplement(ig);
se = strel('ball',100,100);
godisk = ig1 - imopen(ig1,se);
Si = size(ig);
ig = godisk*10;
ig = double(ig);
ig(ig>255)=255;
orig(:,:,:) = ig;
result = imbinarize(fmd(orig));
x = bwareaopen(result,3000);
result2 = bwmorph(x,'spur',inf);
figure
imshowpair(result2,I,'montage');
imwrite(result2,'fmd/P1_LF.tif');
%%%% following is the output result of this code
%
%%%%%%%%%% FMD function used in the above code %%%%%%%%%%%%%
function result = fmd(I)
%imshow(I);
% Settings
plot_results = true;
maximalized_plot = true;
count = 4;
%% Preparing input signals
s = size(I);
m1 = mod(s(1),8);
m2 = mod(s(2),8);
q = 0;
if s(1)>s(2)
if m1 == 0
ca = 1;
p = ceil(s(1)-s(2));
X = zeros(s(1),s(1));
X(:,p+1:p+s(2)) = I(:,:);
else
rem = 1;
ss = s(1);
while(rem ~= 0)
ss = ss + 1;
rem = mod(ss,8);
end
ca = 1;
p = ceil(ss-s(2));
q = ceil(ss-s(1));
X = zeros(ss,ss);
X(q+1:q+s(1),p+1:p+s(2)) = I(:,:);
end
else
if m2 == 0
ca = 2;
p = ceil(s(2)-s(1));
X = zeros(s(2),s(2));
X(p+1:p+s(1),:) = I(:,:);
else
rem = 1;
ss = s(2);
while(rem ~= 0)
ss = ss + 1;
disp(ss);
rem = mod(ss,8);
end
ca = 2;
p = ceil(ss-s(1));
q = ceil(ss-s(2));
X = zeros(ss,ss);
X(p+1:p+s(1),q+1:q+s(2)) = I(:,:);
end
end
in2D = im2double(uint8(X));
% imshow(in2D);
% figure;
%% DMWT2D and IDMWT2D Example
[out2D, winsize] = DMWT2D(in2D, 'DB2');
% if plot_results
% f = figure(4);
% if maximalized_plot
% f.WindowState = 'maximized';
% end
% t = tiledlayout(2, 1);
% title(t, "DMWT2D and IDMWT2D Example");
% nexttile;
% imshow(in2D);
% title("Original image");
%
% nexttile;
% imshow(abs(out2D));
% title("Transformed image");
% end
for i = 1:count
coeff(:,:,i) = out2D((i-1)*winsize+1:i*winsize,:);
end
for i = 1:count
for j = 1:count
subims(:,:,i,j) = coeff(:,(j-1)*winsize+1:j*winsize,i);
end
end
for i = 1:count
for j = 1:count
vecs(:,i,j) = reshape(subims(:,:,i,j).',1,[]);
end
end
Fs=100e6;
t = 0:(1/Fs):1-(1/Fs);
%b = zeros(4096,30,4,4);
for i = 1:count
for j = 1:count
[CutFrq1] = sp_SetCutOffFreq(vecs(:,i,j),Fs,'ub',10); %uniform filter bank 10
ImfByFilter = sp_DFTOrthogonalOrFIR_IIR_LINOEP(vecs(:,i,j),t,Fs,CutFrq1,'dct');
for k=1:length(CutFrq1)-1
b(:,k)=ImfByFilter{k};
end
% [a,b,EnergyLekage]=FMD_Low2High_High2LowSacnning(vecs(:,i,j),Fs,t);
c = sum(b,2);
d(:,:,i,j) = reshape(c,[winsize,winsize]);
end
end
d = permute(d,[2 1 3 4]);
%d = abs(d);
for i = 1:count
row1(:,:,i) = d(:,:,1,i);
row2(:,:,i) = d(:,:,2,i);
row3(:,:,i) = d(:,:,3,i);
row4(:,:,i) = d(:,:,4,i);
end
col1 = [row1(:,:,1) row1(:,:,2) row1(:,:,3) row1(:,:,4)];
col2 = [row2(:,:,1) row2(:,:,2) row2(:,:,3) row2(:,:,4)];
col3 = [row3(:,:,1) row3(:,:,2) row3(:,:,3) row3(:,:,4)];
col4 = [row4(:,:,1) row4(:,:,2) row4(:,:,3) row4(:,:,4)];
img =[col1;col2;col3;col4];
out = IDMWT2D(img, 'DB2');
% figure;
% imshow(imbinarize(out));
if ca == 1
out = out(q+1:q+s(1),p+1:p+s(2));
else
out = out(p+1:p+s(1),q+1:q+s(2));
end
result = out;
end
%%%%%%the test4.jpeg file used is attached below
  5 件のコメント
Kanika
Kanika 2023 年 1 月 3 日
編集済み: Kanika 2023 年 1 月 3 日
I have attached some of the files.This website is not allowing me to attached all the file today .It is telling me to wait for 24 hours .will upload all the files by tommorrow. I am using my own data which I have captured in lab.I have also attached a sample image(test4.jpeg). Thanks for putting afforts.
Kanika
Kanika 2023 年 1 月 4 日
All the useful files are in used.zip .I have attached it

サインインしてコメントする。

回答 (2 件)

Vijeta
Vijeta 2023 年 3 月 28 日
Hello Kanika,
It seems like the output segmentation result is not very clear and might require some further processing. Here are a few suggestions that might help improve the segmentation result:
  1. Try adjusting the parameters of the adapthisteq function to obtain better contrast enhancement. For example, you could try increasing or decreasing the ClipLimit parameter or changing the size of the tiles using the NumTiles parameter.
  2. Instead of using a fixed structuring element for morphological operations, try using adaptive structuring elements that can better adapt to the local image features. MATLAB's strel function allows you to create structuring elements of various shapes, sizes, and orientations. For example, you could use a disk-shaped structuring element with a radius that is proportional to the size of the blood vessels in the image.
  3. Consider using a combination of morphological operations and other image processing techniques such as edge detection or thresholding to enhance the blood vessels and other features of interest in the image.
  4. Try using other segmentation algorithms that are specifically designed for fundus images, such as the Frangi filter, which is a vessel enhancement filter that can be followed by a thresholding step to segment the blood vessels.
Thanks.

Image Analyst
Image Analyst 2023 年 3 月 28 日

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by