close all
clear all
clc
addpath('Optic_disc_Segmetation')
addpath('Retinal_Blood_Vessel_Extraction')
%% Input
[file path] = uigetfile('*.*','Select the image');
if file==0
return
end
I = imread([path file]) ;
figure, imshow(I)
%% Rescaling
II=rgb2gray(I);
mask = zeros(size(II));
mask(10:end-10,10:end-10) = 1;
figure, imshow(mask);
title('Initial Contour Location');
ext_mask = activecontour(II,mask,300);
%% External Mask Segmentation
reg1=regionprops(ext_mask,'all');
ext_mask(reg1(find([reg1.Area]<100)).PixelIdxList)=0;
reg=regionprops(ext_mask,'all');
diamtr=round(reg.EquivDiameter);
J = imresize(I,[diamtr diamtr],'bicubic');
figure,imshow(J)
mask = zeros(size(rgb2gray(J)));
mask(10:end-10,10:end-10) = 1;
ext_mask = activecontour(rgb2gray(J),mask,300);
figure, imshow(ext_mask);
title('Segmented Image');
%% Component Selection
R = J(:,:,1);
G = J(:,:,2);
B = J(:,:,3);
%% Filtering
F_r = medfilt2(R, [3 3]);
F_g = medfilt2(G, [3 3]);
F_b = medfilt2(B, [3 3]);
%% Structure Mask Segmentation
% Optic Disc segmentation
[od_mask]=OD_Seg(J);
% Vessel Segmentation
[vessel_mask]=Vessel_Seg(J);
vessel_mask=imresize(vessel_mask, [size(J,1) size(J,2)]);
vmask=im2bw(vessel_mask);
MASK=255*(imcomplement(od_mask).*imcomplement(vmask).*ext_mask);
%% Texture Descriptors
%LBP %VAR
xx1=F_r;
xx1(MASK==0)=0;
[LBP_r_1 LBP_IM_r_1]=LBP(xx1,1);
[VAR_r_1 VAR_IM_r_1]=VAR(xx1,1);
[LBP_r_2 LBP_IM_r_2]=LBP(xx1,2);
[VAR_r_2 VAR_IM_r_2]=VAR(xx1,2);
[LBP_r_3 LBP_IM_r_3]=LBP(xx1,3);
[VAR_r_3 VAR_IM_r_3]=VAR(xx1,3);
[LBP_r_5 LBP_IM_r_5]=LBP(xx1,5);
[VAR_r_5 VAR_IM_r_5]=VAR(xx1,5);
xx2=F_g;
xx2(MASK==0)=0;
[LBP_g_1 LBP_IM_g_1]=LBP(xx2,1);
[VAR_g_1 VAR_IM_g_1]=VAR(xx2,1);
[LBP_g_2 LBP_IM_g_2]=LBP(xx2,2);
[VAR_g_2 VAR_IM_g_2]=VAR(xx2,2);
[LBP_g_3 LBP_IM_g_3]=LBP(xx2,3);
[VAR_g_3 VAR_IM_g_3]=VAR(xx2,3);
[LBP_g_5 LBP_IM_g_5]=LBP(xx2,5);
[VAR_g_5 VAR_IM_g_5]=VAR(xx2,5);
xx3=F_b;
xx3(MASK==0)=0;
[LBP_b_1 LBP_IM_b_1]=LBP(xx3,1);
[VAR_b_1 VAR_IM_b_1]=VAR(xx3,1);
[LBP_b_2 LBP_IM_b_2]=LBP(xx3,2);
[VAR_b_2 VAR_IM_b_2]=VAR(xx3,2);
[LBP_b_3 LBP_IM_b_3]=LBP(xx3,3);
[VAR_b_3 VAR_IM_b_3]=VAR(xx3,3);
[LBP_b_5 LBP_IM_b_5]=LBP(xx3,5);
[VAR_b_5 VAR_IM_b_5]=VAR(xx3,5);
figure,subplot(131),imshow(imcomplement(LBP_IM_r_1),[])
subplot(132),imshow(imcomplement(LBP_IM_g_1),[])
subplot(133),imshow(imcomplement(LBP_IM_b_1),[])
figure,subplot(131),imshow(imcomplement(VAR_IM_r_1),[])
subplot(132),imshow(imcomplement(VAR_IM_g_1),[])
subplot(133),imshow(imcomplement(VAR_IM_b_1),[])
h1=imhist(uint8(LBP_IM_r_1));
h2=imhist(uint8(LBP_IM_g_1));
h3=imhist(uint8(LBP_IM_b_1));
h4=imhist(uint8(LBP_IM_r_2));
h5=imhist(uint8(LBP_IM_g_2));
h6=imhist(uint8(LBP_IM_b_2));
h7=imhist(uint8(LBP_IM_r_3));
h8=imhist(uint8(LBP_IM_g_3));
h9=imhist(uint8(LBP_IM_b_3));
h10=imhist(uint8(LBP_IM_r_5));
h11=imhist(uint8(LBP_IM_g_5));
h12=imhist(uint8(LBP_IM_b_5));
h13=imhist(uint8(VAR_IM_r_1));
h14=imhist(uint8(VAR_IM_g_1));
h15=imhist(uint8(VAR_IM_b_1));
h16=imhist(uint8(VAR_IM_r_2));
h17=imhist(uint8(VAR_IM_g_2));
h18=imhist(uint8(VAR_IM_b_2));
h19=imhist(uint8(VAR_IM_r_3));
h20=imhist(uint8(VAR_IM_g_3));
h21=imhist(uint8(VAR_IM_b_3));
h22=imhist(uint8(VAR_IM_r_5));
h23=imhist(uint8(VAR_IM_g_5));
h24=imhist(uint8(VAR_IM_b_5));
h=[h1';h2';h3';h4';h5';h6';h7';h8';h9';h10';h11';h12';h13';h14';h15';...
h16';h17';h18';h19';h20';h21';h22';h23';h24'];
f1=mean(h');
f2=std(h');
f3=median(h');
for i=1: size(h,1)
f4(i)=entropy(h(i,:));
end
f5=skewness(h');
f6=kurtosis(h');
f=[f1 f2 f3 f4 f5 f6];
VAR.rar_var
版权申诉
200 浏览量
2022-09-23
02:01:16
上传
评论
收藏 2KB RAR 举报
四散
- 粉丝: 54
- 资源: 1万+
最新资源
- 基于Java和Javascript的工程建设综合管理系统材料管理模块设计源码 - material
- c51_2_2.c
- ASCII American Standard Code for Information Interchange
- 一个chm格式的 SQL 函数手册-SQL语言手册文档
- 计算当前月份的天数和剩余天数
- 基于ARM的指令调度和延迟分支
- 基于Vue和TypeScript的极简聊天应用设计源码 - HasChat
- 基于Vue2全家桶和Zcool数据的图片收集网站设计源码 - cool-picture
- 基于C和C++的二维绘制工具设计源码 - DrawPro
- Object.defineProperty 的 IE 补丁object-defineproperty-ie-master.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0