Hello my project showing Following errors please somebody help me with that
Show older comments
function varargout = retinmain(varargin)
% RETINMAIN M-file for retinmain.fig
% RETINMAIN, by itself, creates a new RETINMAIN or raises the existing
% singleton*.
%
% H = RETINMAIN returns the handle to a new RETINMAIN or the handle to
% the existing singleton*.
%
% RETINMAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in RETINMAIN.M with the given input arguments.
%
% RETINMAIN('Property','Value',...) creates a new RETINMAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before retinmain_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to retinmain_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 help retinmain
% Last Modified by GUIDE v2.5 24-Apr-2013 13:16:19
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @retinmain_OpeningFcn, ...
'gui_OutputFcn', @retinmain_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if 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 retinmain is made visible.
function retinmain_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 retinmain (see VARARGIN)
% Choose default command line output for retinmain
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes retinmain wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = retinmain_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global filename
global pathname
global name
global image
[filename pathname]=uigetfile('*.jpg','Select An Image');
% [pathstr, name, ext, versn] = fileparts(filename);
name = str2num(filename(1:end-4));
image = imread([pathname filename]);
axes(handles.axes1);
imshow(image);
title('Original Image1','fontsize',14,...
'fontname','monotype corsiva',...
'color','red');
axis equal;axis off;
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image gimage
rimage=image(:,:,1);
gimage=image(:,:,2);
bimage=image(:,:,3);
gray=rgb2gray(image)
figure,imshow(rimage);title('red channel');
figure,imshow(bimage);title('Blue channel');
axes(handles.axes2)
imshow(gimage);title('green channel','fontsize',14,'fontname','monotype corsiva','color','red');
axes(handles.axes3)
imshow(gray);title('Gray Image','fontsize',14,'fontname','monotype corsiva','color','red');
axis off;
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image gimage
[m n c]=size(image);
if c==3
gimage=rgb2gray(image);
else
gimage=image;
end
x=gimage;
GLCM2 = graycomatrix(x,'Offset',[2 0;0 2]);
stats = GLCM_Features1(GLCM2,0);
v1=stats.autoc(1);
v2=stats.contr(1);
v3=stats.corrm(1);
v4=stats.corrp(1);
v5=stats.cprom(1);
v6=stats.cshad(1);
v7=stats. dissi(1);
v8=stats.energ(1);
v9=stats.entro(1);
v10=stats. homom(1);
v11=stats.homop(1);
v12=stats.maxpr(1);
testfea(1,1:12)=[v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12];
save testfea testfea
set(handles.uitable1,'Data',testfea);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global class gimage
load Trainfea_new
load target
load testfea
% input=trainfea';
% numHiddenNeurons = 20; % Adjust as desired
% net = cascade(input,target,numHiddenNeurons);
% net.divideParam.trainRatio = 80/100; % Adjust as desired
% net.divideParam.valRatio = 10/100; % Adjust as desired
% net.divideParam.testRatio = 10/100; % Adjust as desired
% % Train and Apply Network
% [network,tr] = train(net,input,target);
% load network
% prediction = sim(network,testfea');
% class=round(prediction);
% if class==0
% msgbox('Hemorrhages');
% end
% if class==1
% msgbox('Microneursym');
% end
train = gimage;
addpath('CNN\')
addpath('CNN\util\')
train = imresize(train,[256 256]);
label = 1:600;
train_x = double(reshape(train(:,1:256),16,16,256))/255;
test_x = double(reshape(train(:,1:100),16,16,100))/255;
train_y = double(label(1:600));
test_y = double(label(1:100));
rand('state',0)
cnn.layers = {
struct('type', 'i') %input layer
struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer
struct('type', 's', 'scale', 2) %sub sampling layer
struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer
struct('type', 's', 'scale', 2) %subsampling layer
};
opts.alpha = 1;
opts.batchsize = 50;
opts.numepochs = 1;
cnn = cnnsetup(cnn, train_x, train_y);
cnn = cnntrain(cnn, train_x, train_y, opts);
[er, bad] = cnntest(cnn, test_x, test_y);
Features_R = [testfea cnn.ffW cnn.rL];
Trainfeature = Trainfea_new;
testfea = Features_R;
% target = target;
[m1,n1] = size(Trainfeature);
[m2,n2] = size(testfea);
ZMat = zeros(m1,n1);
for i = 1:m1
for j = 1:m2
Temp = testfea(j,:);
TTemp = Trainfeature(i,:);
end
end
for i = 1:m1
for j = 1:m2
Temp = testfea(j,:);
TTemp = Trainfeature(i,:);
L = length(Temp);
if (Temp - TTemp) == 0
ZMat(i,:) = 1;
end
end
end
for z = 1:size(ZMat,1)
if ZMat(z) == 1
Tempclass(z) = z;
Tempclass1 = Tempclass;
end
end
aa = find(Tempclass1 ~= 0);
for SM = 1: length(aa)
result(SM) = target(aa(SM));
end
if result==0
msgbox('Hemorrhages');
end
if result==1
msgbox('Microneursym');
end
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global class image name
global maskErode
fim=mat2gray(image);
level=graythresh(fim);
bwfim=im2bw(fim,0.1);
[bwfim0,level0]=adaptivethresh(fim,0);
[bwfim1,level1]=adaptivethresh(fim,1);
if class==0
gray=rgb2gray(image);
rimage=image(:,:,1);
gimage=image(:,:,2);
bimage=image(:,:,3);
im1=medfilt2(gimage);
figure,imshow(im1);
title('Green channel with Median filter','fontsize',14,'fontname','monotype corsiva','color','red');
img=imsubtract(gray,im1);
figure,imshow(img);
title('Subtracted Image','fontsize',14,'fontname','monotype corsiva','color','red');
% img1=im2bw(img);
% figure,imshow(img1);
e = find(img>30);
mask = zeros(size(img));
mask(e) = 255;
% Region erosion through math morph
se = strel('disk',3);
maskErode = imerode(mask,se);
figure,imshow(maskErode);
title('Final Result','fontsize',14,'fontname','monotype corsiva','color','red');
end
if class==1
detecmicro(image,name)
end
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global class
global maskErode
global filename;
load trainfea
set(handles.uitable2,'Data',trainfea);
load trainfea
load target
E=filename;
input=trainfea';
numHiddenNeurons = 20; % Adjust as desired
net = cascade(input,target,numHiddenNeurons);
net.divideParam.trainRatio = 80/100; % Adjust as desired
net.divideParam.valRatio = 10/100; % Adjust as desired
net.divideParam.testRatio = 10/100; % Adjust as desired
% Train and Apply Network
[network,tr] = train(net,input,target);
load network
load TP
outputs = sim(network,input);
outputs=round(outputs);
E=str2num(E(1));
plotperf(tr)
plotconfusion(target,outputs)
sen=0;
spe=0;
if class==0
[m n]=size(maskErode);
k=1;
for i=1:m
for j=1:n
if maskErode(i,j)==255
k=k+1;
end
end
end
TP=TP(E);
TN=(m*n)-TP;
FP=k;
FN=((m*n)-k)-(TN);
sen=TP/(TP+FN);
spe=TN/(TN+FP);
end
set(handles.text7,'string',num2str(sen));
set(handles.text9,'string',num2str(spe));
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.uitable1,'Data',0);
set(handles.uitable2,'Data',0);
axes(handles.axes1)
imshow(0);
axes(handles.axes2)
imshow(0);
axes(handles.axes3)
imshow(0);
1 Comment
Navgire Om
on 16 Apr 2020
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!