Matlab code for Glaucoma Detection
₹3,000.00
Huge Price Drop : 50% Discount
Source Code + Demo Video
100 in stock
Description
- Denoising
- Poor resolution
- Poor contrast
- Identification and feature extraction
Proposed Algorithm for Glaucoma Detection
Matlab GUI for Glaucoma Detection
function varargout = testfinal(varargin)
% TESTFINAL M-file for testfinal.fig
% TESTFINAL, by itself, creates a new TESTFINAL or raises the existing
% singleton*.
%
% H = TESTFINAL returns the handle to a new TESTFINAL or the handle to
% the existing singleton*.
%
% TESTFINAL('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TESTFINAL.M with the given input arguments.
%
% TESTFINAL('Property','Value',...) creates a new TESTFINAL or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before testfinal_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to testfinal_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to axes2 testfinal
% Last Modified by GUIDE v2.5 07-Feb-2007 16:11:38
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @testfinal_OpeningFcn, ...
'gui_OutputFcn', @testfinal_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
endif nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before testfinal is made visible.
function testfinal_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to testfinal (see VARARGIN)% Choose default command line output for testfinal
handles.output = hObject;a=ones(256,256);
b=imread('new.bmp');
axes(handles.axes3);
imshow(b);axes(handles.axes2);
imshow(a);axes(handles.axes1);
imshow(a);
%Update handles structure
guidata(hObject, handles);% UIWAIT makes testfinal wait for user response (see UIRESUME)
% uiwait(handles.STATUS);
% --- Outputs from this function are returned to the command line.
function varargout = testfinal_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in Browse.
function Browse_Callback(hObject, eventdata, handles)
% hObject handle to Browse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)[file, pathname] = uigetfile('*.bmp', 'Pick an Image');
if isequal(file,0) | isequal(pathname,0)warndlg('User pressed cancel')
else
a=imread(file);
axes(handles.axes1);
imshow(a);
handles.file=file;
%Update handles structure
guidata(hObject, handles);
end% --- Executes on button press in IMAGENHANCEMENT.
function IMAGENHANCEMENT_Callback(hObject, eventdata, handles)
% hObject handle to IMAGENHANCEMENT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)file = handles.file;
a =imread(file);[r c p]=size(a); % If it is color, convert to gray....
if p==3
a=rgb2gray(a);
endb=histeq(a); % Applying the Histogram
imwrite(b,'enhanced.bmp');
axes(handles.axes2);
imshow(b);% --- Executes on button press in THRESHOLDING.
function THRESHOLDING_Callback(hObject, eventdata, handles)
% hObject handle to THRESHOLDING (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)file = handles.file;
a=imread(file);
[r c p]=size(a);
b=a;
if p==3
b=rgb2gray(a);
end
Out =zeros(r,c);for i=1:r
for j=1:c
if b(i,j) >150
Out(i,j)=1;
else
Out(i,j)=0;
end
end
endaxes(handles.axes2);
imshow(Out);
imwrite(Out,'thresholded.bmp');% --- Executes on button press in EROSION.
function EROSION_Callback(hObject, eventdata, handles)
% hObject handle to EROSION (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)file = handles.file;
Out=imread(file);
B1 = medfilt2(Out,[5 5]);axes(handles.axes2);
imshow(B1);
imwrite(B1,'eroded.bmp');% --- Executes on button press in AUTO_SEGMENTATION.
function AUTO_SEGMENTATION_Callback(hObject, eventdata, handles)
% hObject handle to AUTO_SEGMENTATION (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)file = handles.file;
file=imread(file);J = imcomplement(file);
figure(1);
imshow(J);
J=bwmorph(J,'FILL');
figure(2);
imshow(J);
%%%%%%%%%%%%%%%%%% anterior segmentation[r1 c1]=size(J); %% Here B&W image
[L2 NUM2] = bwlabel(J);
disp(NUM2);removed=0;
STATS = regionprops(L2,'area'); %Finds the number of pixels on each region
aA=[STATS.Area]; %Conversion from structure to array
for j=1:1:NUM2
bw= aA(j);
if bw <1500
L2(L2==j)=0;
removed = removed + 1;
end
endNUM2=NUM2-removed;
[L3 NUM3] = bwlabel(L2);
STATS = regionprops(L3,'area');
disp(NUM3);stats1 = regionprops(L3, 'PixelList'); %getting the pixel co-ordinates
CC=[];
for j=1:1:NUM3 %NUM3
aA1=stats1(j);
CC{j} = [aA1.PixelList]; %Conversion from structure to array
endremoved1=0;
tmp = [];for j=1:NUM3 % THIS LOOP FORMS THE TRI_ANGLE
tmp = CC{j}(:);
B=find(tmp(:,1)==1);%%%%%%%%%
disp(B);
if isempty(B)
imshow(L3==j);
else
L3(L3==j)=0;
removed1=removed1+1;
end
endNUM3=NUM3-removed1;
disp(NUM3);
[L4 NUM4] = bwlabel(L3);for i=1:NUM4
[r,c] = find(L4 == i);
BW2 = bwselect(L3,c,r,4);
imwrite(BW2,'SEGMENTED.BMP');
end
% figure(7);
% imshow(L4);if NUM4~=0
Image=BW2;th1=1;
th2=0;[rows columns]=size(Image);
len=rows;
Rimage = Image;OutputImage=ones(rows,columns);
Boundary_Pixel=[];
%detecting ones
h = waitbar(0,'Please wait...');
index=1;
for y= 1:columns
for x=1:rows
%for left top corner
if (x==1 & y==1)
if (Rimage(x, y+1)==th1)
if (Rimage(x+1, y+1)==th1)
if (Rimage(x+1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for right top corner
elseif (x==1 & y==len)
if (Rimage(x+1, y)==th1)
if (Rimage(x+1, y-1)==th1)
if (Rimage(x,y-1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for bottom left corner[2,3,4]
elseif (x==len & y==1)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y+1) ==th1)
if (Rimage(x,y+1) ==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for bottom right corner[8,1,2]
elseif (x==len & y==len)
if (Rimage(x, y-1)==th1)
if (Rimage(x-1, y-1)==th1)
if (Rimage(x-1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for top edge[8,7,6,5,4]
elseif (x==1)
if (Rimage(x, y-1)==th1)
if (Rimage(x+1, y-1)==th1)
if (Rimage(x+1, y)==th1)
if (Rimage(x+1, y+1)==th1)
if (Rimage(x,y+1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for right edge[2,1,8,7,6]
elseif (y==len)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y-1)==th1)
if (Rimage(x, y-1)==th1)
if (Rimage(x+1, y-1)==th1)
if (Rimage(x+1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for bottom edge[8,1,2,3,4]
elseif (x==len)
if (Rimage(x, y-1)==th1)
if (Rimage(x-1, y-1)==th1)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y+1)==th1)
if (Rimage(x,y+1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for left edge[2,3,4,5,6]
elseif (y==1)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y+1)==th1)
if (Rimage(x, y+1)==th1)
if (Rimage(x+1, y+1)==th1)
if (Rimage(x+1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for remaining pixels
else
if (Rimage(x-1,y-1)==th1)
if (Rimage(x-1,y)==th1)
if (Rimage(x-1,y+1)==th1)
if (Rimage(x,y+1)==th1)
if (Rimage(x+1,y+1)==th1)
if (Rimage(x+1,y)==th1)
if (Rimage(x+1,y-1)==th1)
if (Rimage(x,y-1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
end
end
end
end
end
end% figure(221);
% imshow(OutputImage);
%detecting zeros
index=1;
for y=1:columns
for x=1:rows
%for left top corner[4,5,6]
if (x==1 & y==1)
if (Rimage(x, y+1)==th2)
if (Rimage(x+1, y+1)==th2)
if (Rimage(x+1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for right top corner[8,7,6]
elseif (x==1 & y==len)
if (Rimage(x+1, y)==th2)
if (Rimage(x+1, y-1)==th2)
if (Rimage(x,y-1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for bottom left corner[2,3,4]
elseif (x==len & y==1)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y+1) ==th2)
if (Rimage(x,y+1) ==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for bottom right corner[8,1,2]
elseif (x==len & y==len)
if (Rimage(x, y-1)==th2)
if (Rimage(x-1, y-1)==th2)
if (Rimage(x-1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
%for top edge[8,7,6,5,4]
elseif (x==1)
if (Rimage(x, y-1)==th2)
if (Rimage(x+1, y-1)==th2)
if (Rimage(x+1, y)==th2)
if (Rimage(x+1, y+1)==th2)
if (Rimage(x,y+1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for right edge[2,1,8,7,6]
elseif (y==len)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y-1)==th2)
if (Rimage(x, y-1)==th2)
if (Rimage(x+1, y-1)==th2)
if (Rimage(x+1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for bottom edge[8,1,2,3,4]
elseif (x==len)
if (Rimage(x, y-1)==th2)
if (Rimage(x-1, y-1)==th2)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y+1)==th2)
if (Rimage(x,y+1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for left edge[2,3,4,5,6]
elseif (y==1)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y+1)==th2)
if (Rimage(x, y+1)==th2)
if (Rimage(x+1, y+1)==th2)
if (Rimage(x+1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
%for remaining pixels
else
if (Rimage(x-1,y-1)==th2)
if (Rimage(x-1,y)==th2)
if (Rimage(x-1,y+1)==th2)
if (Rimage(x,y+1)==th2)
if (Rimage(x+1,y+1)==th2)
if (Rimage(x+1,y)==th2)
if (Rimage(x+1,y-1)==th2)
if (Rimage(x,y-1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
end
end
end
end
waitbar(y/columns,h)
end
end
close(h);% figure(224);
% imshow(OutputImage);
% DETECTION OF BOUNDARY DETECTED IMAGE
% imshow(OutputImage)
imwrite(OutputImage,'Bound1.bmp');% save a
% load aOut1=OutputImage;
[m n]=size(Out1);Out2=zeros(m,n);
for i=1:m
for j=1:n
if Out1(i,j)>=1
Out2(i,j)=255;
end
end
endindex=1;
for x = 1:256
for y=1:256
bb=Out2(x,y);
if bb>=10
Boundary_Pixel{index}=[x,y];
X1(index)=x;
Y1(index)=y;
index=index+1;
end
end
end
% save a1
% load a1X = X1; %X co-ordinates
Y =Y1; %Y co-ordinates% XAA = X1;
% YAA =Y1;save X X
save Y YX1=X;
Y1 =Y;XB=X;
YB =Y;Xmin = min(XB);
[Ymin Ind] = min(YB); %FIND OUT THE CORNER FIRST POINTS OF TRI_ANGLE
Dec=X(Ind);Xmax = max(XB);
Ymax = max(YB);
[Ymax Ind] = max(YB);
Dec1=X(Ind);axes(handles.axes2);
% X = [Xmin Xmax];
X = [Dec Dec1];
Y = [Ymin Ymax];
line(Y,X) ;X = [Dec Dec];
Y = [Ymin Ymax];
line(Y,X) ;X = [Dec Dec1];
Y = [Ymax Ymax];
line(Y,X) ;X = [Dec Xmax];
Y = [Ymax Ymax];
line(Y,X) ;X = [Dec Xmax];
Y = [Ymin Ymax];
b=ones(256,256);
line(Y,X) ;
handles.Xmin=Xmin;
handles.Xmax=Xmax;
handles.Dec=Dec;
handles.Dec1=Dec1;
handles.Ymin=Ymin;
handles.Ymax=Ymax;else
bb='0'
set(handles.ANGLE,'String',bb);
warndlg('anterior chamber is almost closed ... glaucoma detected..no further processing');
bb='GLAUCOMA DETECTED'
set(handles.STATUS1,'String',bb);
disp('no anterior chamber');
end
% Update handles structure
guidata(hObject, handles);% --- Executes on button press in CLEAR.
function CLEAR_Callback(hObject, eventdata, handles)
% hObject handle to CLEAR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=ones(256,256);
axes(handles.axes1);imshow(a);
axes(handles.axes2);imshow(a);
bb='0'
set(handles.ANGLE,'String',bb);
bb='0'
set(handles.STATUS1,'String',bb);% --- Executes on button press in EXIT.
function EXIT_Callback(hObject, eventdata, handles)
% hObject handle to EXIT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)exit;
% --- Executes on button press in HOLEFILLING.
function HOLEFILLING_Callback(hObject, eventdata, handles)
% hObject handle to HOLEFILLING (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)file = handles.file;
bw1=imread(file);
BW15 = imfill(bw1,8,'holes');
axes(handles.axes2);
imshow(BW15);BW15=uint8(BW15);
imwrite(BW15,'FILLED.bmp');uiwait(msgbox('Process completed','Hole filling Status','modal'));
% --- Executes on button press in masking11.
function masking11_Callback(hObject, eventdata, handles)
% hObject handle to masking11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLABXmin =handles.Xmin;
Xmax =handles.Xmax;Dec =handles.Dec;
Dec1 =handles.Dec1;Ymin =handles.Ymin;
Ymax =handles.Ymax;file = handles.file;
aa=imread(file);%%%%%%%%%%%%%%%%%%% CALCUATING BOUNDNG BOX
X1=Ymin;
Y1=Dec;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LTX1=X1-25;
LTY1=Y1-25;RTX1=X1-25;
RTY1=Y1+25;LBX1=X1+25;
LBY1=Y1-25;RBX1=X1+25;
RBY1=Y1+25;ROIIMAGE11=aa(LTY1:RBY1,LTX1:LBX1);
axes(handles.axes2);
imshow(ROIIMAGE11);imwrite(ROIIMAGE11,'masked.bmp');
% --- Executes on button press in AOD_500.
function AOD_500_Callback(hObject, eventdata, handles)
% hObject handle to AOD_500 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)file=handles.file;
a=imread(file);a=uint8(a);
b=histeq(a);
figure(2);
imshow(b);
%pixval on;[r c]=size(a);
for i=1:r
for j=1:c
if b(i,j) >50
aOut2(i,j)=1;
aOut21(i,j)=0;
else
aOut2(i,j)=0;
aOut21(i,j)=1;
end
end
endaOut22 = imcomplement(imfill(imcomplement(aOut2),'holes'));
% imshow(aOut22);
aOut22 = imfill(aOut22,'holes');aJ2 = imcomplement(aOut22);
% INVERTED IMAGE
[L2 NUM2] = bwlabel(aJ2);
% disp(NUM2);
removed=0;
removed1=0;
STATS = regionprops(L2,'area');
%STATS1 = imfeature(L2,'all');aA=[STATS.Area];
for j=1:1:NUM2
bw= aA(j);
if bw <150
L2(L2==j)=0;
removed = removed + 1;
end
endNUM2=NUM2-removed;
[L3 NUM3] = bwlabel(L2);
imshow(L3==1);
[r,c] = find(L3 == 1);% figure;
BW2 = bwselect(L3,c,r,4);
% a=imread(filename);Image=BW2;
imshow(Image);% pixval on;
th1=1;
th2=0;
[rows columns]=size(Image);
len=rows;
Rimage = Image;
j=columns;
Num=[];
index1=1;for i=1:r
if Image(i,j)==1
Boundary_Pixel_1{index1}=[i,j];
Num(index1)=i;
index1=index1+1;
end
endMini=min(Num);
Maxi=max(Num);OutputImage=ones(rows,columns);
Boundary_Pixel=[];
% Boundary_y=[];
% detecting ones
h = waitbar(0,'Please wait...');
index=1;for y= 1:columns
for x=1:rows
% for left top corner[4,5,6]
if (x==1 & y==1)
if (Rimage(x, y+1)==th1)
if (Rimage(x+1, y+1)==th1)
if (Rimage(x+1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for right top corner[8,7,6]
elseif (x==1 & y==len)
if (Rimage(x+1, y)==th1)
if (Rimage(x+1, y-1)==th1)
if (Rimage(x,y-1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for bottom left corner[2,3,4]
elseif (x==len & y==1)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y+1) ==th1)
if (Rimage(x,y+1) ==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for bottom right corner[8,1,2]
elseif (x==len & y==len)
if (Rimage(x, y-1)==th1)
if (Rimage(x-1, y-1)==th1)
if (Rimage(x-1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for top edge[8,7,6,5,4]
elseif (x==1)
if (Rimage(x, y-1)==th1)
if (Rimage(x+1, y-1)==th1)
if (Rimage(x+1, y)==th1)
if (Rimage(x+1, y+1)==th1)
if (Rimage(x,y+1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
% for right edge[2,1,8,7,6]
elseif (y==len)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y-1)==th1)
if (Rimage(x, y-1)==th1)
if (Rimage(x+1, y-1)==th1)
if (Rimage(x+1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
% for bottom edge[8,1,2,3,4]
elseif (x==len)
if (Rimage(x, y-1)==th1)
if (Rimage(x-1, y-1)==th1)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y+1)==th1)
if (Rimage(x,y+1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
% for left edge[2,3,4,5,6]
elseif (y==1)
if (Rimage(x-1, y)==th1)
if (Rimage(x-1, y+1)==th1)
if (Rimage(x, y+1)==th1)
if (Rimage(x+1, y+1)==th1)
if (Rimage(x+1,y)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
else
% for remaining pixels
if (Rimage(x-1,y-1)==th1)
if (Rimage(x-1,y)==th1)
if (Rimage(x-1,y+1)==th1)
if (Rimage(x,y+1)==th1)
if (Rimage(x+1,y+1)==th1)
if (Rimage(x+1,y)==th1)
if (Rimage(x+1,y-1)==th1)
if (Rimage(x,y-1)==th1)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
end
end
end
end
end
end%detecting zeros
index=1;
for y=1:columns
for x=1:rows
% for left top corner[4,5,6]
if (x==1 & y==1)
if (Rimage(x, y+1)==th2)
if (Rimage(x+1, y+1)==th2)
if (Rimage(x+1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for right top corner[8,7,6]
elseif (x==1 & y==len)
if (Rimage(x+1, y)==th2)
if (Rimage(x+1, y-1)==th2)
if (Rimage(x,y-1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for bottom left corner[2,3,4]
elseif (x==len & y==1)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y+1) ==th2)
if (Rimage(x,y+1) ==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for bottom right corner[8,1,2]
elseif (x==len & y==len)
if (Rimage(x, y-1)==th2)
if (Rimage(x-1, y-1)==th2)
if (Rimage(x-1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
% for top edge[8,7,6,5,4]
elseif (x==1)
if (Rimage(x, y-1)==th2)
if (Rimage(x+1, y-1)==th2)
if (Rimage(x+1, y)==th2)
if (Rimage(x+1, y+1)==th2)
if (Rimage(x,y+1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
% for right edge[2,1,8,7,6]
elseif (y==len)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y-1)==th2)
if (Rimage(x, y-1)==th2)
if (Rimage(x+1, y-1)==th2)
if (Rimage(x+1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
% for bottom edge[8,1,2,3,4]
elseif (x==len)
if (Rimage(x, y-1)==th2)
if (Rimage(x-1, y-1)==th2)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y+1)==th2)
if (Rimage(x,y+1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
% for left edge[2,3,4,5,6]
elseif (y==1)
if (Rimage(x-1, y)==th2)
if (Rimage(x-1, y+1)==th2)
if (Rimage(x, y+1)==th2)
if (Rimage(x+1, y+1)==th2)
if (Rimage(x+1,y)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
else
% for remaining pixels
if (Rimage(x-1,y-1)==th2)
if (Rimage(x-1,y)==th2)
if (Rimage(x-1,y+1)==th2)
if (Rimage(x,y+1)==th2)
if (Rimage(x+1,y+1)==th2)
if (Rimage(x+1,y)==th2)
if (Rimage(x+1,y-1)==th2)
if (Rimage(x,y-1)==th2)
Boundary_Pixel{index}=[x,y];
OutputImage(x,y)=0;
index=index+1;
end
end
end
end
end
end
end
end
end
waitbar(y/columns,h)
end
end
close(h);% DETECTION OF BOUNDARY DETECTED IMAGE
% imshow(OutputImage)
% imwrite(OutputImage,'Bound1.bmp')Out1=OutputImage;
[m n]=size(Out1);
% pixval onOut2=zeros(m,n);
for i=1:m
for j=1:n
if Out1(i,j)>=1
Out2(i,j)=255;
end
end
end
% imshow(Out2,[]);
% pixval on
index=1;
threshold=255;for x = 1:rows
for y=1:columns
bb=Out2(x,y);
if bb>=10
Boundary_Pixel{index}=[x,y];
X1(index)=x;
Y1(index)=y;
index=index+1;
end
end
end
save a11
load a11
%
% X = X1;
% Y =Y1;
% XAA = X1;
% YAA =Y1;
%
% save XAA XAA
% save YAA YAA
%
X1=X;
Y1 =Y;
XB=X;
YB =Y;
Xmin = min(XB);
[Ymin Ind] = min(YB);
Dec=X(Ind);Xmax = max(XB);
Ymax = max(YB);
[Ymax Ind] = max(YB);
Dec1=X(Ind);aa=imread(file);
axes(handles.axes2);
imshow(aa);
% X = [Xmin Xmax];
X = [Dec Mini];
Y = [Ymin Ymax];
line(Y,X) ;X = [Dec Dec];
Y = [Ymin Ymax];
line(Y,X) ;X = [Dec Dec1];
Y = [Ymax Ymax];
line(Y,X) ;
X = [Dec Xmax];
Y = [Ymax Ymax];
line(Y,X) ;X = [Dec Maxi];
Y = [Ymin Ymax];
b=ones(256,256);
line(Y,X) ;
% pixval onDistance1=sqrt((Dec-Mini)^2+(Ymin-Ymax)^2);%opposite of traingle 1hyp
disp(Distance1);
Distance2=sqrt((Dec-Maxi)^2+(Ymin-Ymax)^2);%opposite of traingle 1hyp2
disp(Distance2);
Distance3=sqrt((Dec-Dec)^2+(Ymin-Ymax)^2);%adjacet of traingle 1
disp(Distance3);%tan=opp/adj
Thete1=acos(Distance3/Distance1);
Thete2=acos(Distance3/Distance2);AA=Thete1+Thete2;
BB=(180/pi)*AA;% Thete=atan(Distance1/Distance3);
% Theta=acos(adjacent/hyp);Theta1=(180/pi)*Thete1;
Theta2=(180/pi)*Thete2;disp(Theta1);
disp(Theta2);% Theta=Theta1-Theta2;
Theta3=Theta1-Theta2;Theta13=num2str(Theta3);
set(handles.ANGLE,'String',Theta13);
% disp(Theta);
Theta3=round(Theta3);
if Theta3 > 19
bb='NORMAL EYE'
set(handles.STATUS1,'String',bb);
else
bb='GLAUCOMA DETECTED'
set(handles.STATUS1,'String',bb);
end
% --- Executes during object creation, after setting all properties.
function ANGLE_CreateFcn(hObject, eventdata, handles)
% hObject handle to ANGLE (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function ANGLE_Callback(hObject, eventdata, handles)
% hObject handle to ANGLE (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of ANGLE as text
% str2double(get(hObject,'String')) returns contents of ANGLE as a double
% --- Executes during object creation, after setting all properties.
function STATUS1_CreateFcn(hObject, eventdata, handles)
% hObject handle to STATUS1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
endfunction STATUS1_Callback(hObject, eventdata, handles)
% hObject handle to STATUS1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of STATUS1 as text
% str2double(get(hObject,'String')) returns contents of STATUS1 as a double
% --- Executes on button press in Radian.
function Radian_Callback(hObject, eventdata, handles)
% hObject handle to Radian (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of Radian
% --- Executes on button press in Degree.
function Degree_Callback(hObject, eventdata, handles)
% hObject handle to Degree (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of Degree
% --- Executes on button press in Delete.
function Delete_Callback(hObject, eventdata, handles)
% hObject handle to Delete (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[file, pathname] = uigetfile('*.bmp', 'Pick an Image');
if isequal(file,0) | isequal(pathname,0)
warndlg('User pressed cancel')
else
a=file;
delete(a);
uiwait(msgbox('File Deleted Succesfully','Message','modal'));end
% --- Executes on button press in Help.
function Help_Callback(hObject, eventdata, handles)
% hObject handle to Help (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)helpwin ch1;
References
[1] Deng G., Cahill L.W., Image Enhancement Using the Log-ratio Approach, Signals Systems and Computers, Vol.1, pp. 198-202, Nov1994
[2] Deng G., Cahill L.W, Multiscale image enhancement using the logarithmic image processing model, ElectronicsLetters, Vol.29, No.3, pp. 803-804, Apr1993
[3] J.S. Lim, Two-dimensional Signal and Image processing, Englewoods Cliffs, NJ: Prentice-Hall, pp. 536-540, 1990[4] Daneshvar H., Brownstein S., Mintsioulis G., ChialantD., Punja K., Damji KF., Epithelial ingrowth following penetrating keratoplasty:A Clinical, UltrasoundBiomicroscopic and Histopathological Correlation,Canadian Journal of Ophthalmology, Vol. 35, No.4, pp.222-224, Jun 2000
[5] Nishijima K., Takahashi K., Yamakawa R., Ultrasound Biomicroscopy of the Anterior Segment after Congenital Cataract Surgery, American Journal of Ophthalmology, Vol.130, No.4, Oct2000
[6] Pavlin C.J., Harasiewicz K., Sherar M.D., Foster F.S, Clinical Use of Ultrasound Biomicroscopy, Ophthalmology, Vol. 98, No.3, Mar1991
[7] Polesel, A.; Ramponi, G.; Mathews, V.J., Adaptive unsharp masking for contrast enhancement, Image Processing, 1997 Proceedings, International Conference on, Vol.1, No.26, pp. 267 – 270, Oct1997
Reviews
There are no reviews yet.