how to solve a error?

My error is
Error in training (line 6)
I{a}=imread(['ImageDataSet/' num2str(a) '.tiff']);
Error in main (line 56)
[traindata, trainlabel]=training(no_of_Image);
function program
function [trdata, trlabel]=training(no_input)
I=cell(no_input,1);
trdata=[];
trlabel=[];
for a=1:no_input
I{a}=imread(['ImageDataSet/' num2str(a) '.tiff']);
end
k= 15;
option = 2;
for i=1:length(I)
[kn]=mkuan(I{i});
ad= anisodiff(kn,k,option);
[Y] = FLDA(ad);
data=reshape(Y,[1,size(Y,1)*size(Y,2)]);
Label=reshape(Y>=max(Y(:)),[1,size(Y,1)*size(Y,2)]);
trdata=[trdata data];
trlabel=[trlabel Label];
end

4 Commenti

Rik
Rik il 18 Dic 2017
You have a block of unreadable code (select your code and then click the {}Code button).
Without additional information, my best guess would be that the file doesn't exist.
while(1)
cc=menu('Segmentation',...
'Input image',...
'Preprocessing',...
'Feature extraction',...
'Training',...
'Segmentation',...
'Performance Measures',...
'Exit');
if(cc==7)
break;
end
if(cc==1)
%%%% Input image %%%%%%
[file,path]=uigetfile('*.*','select a input image');
s=imread([path file]);
if(size(s,3)==3)
s=rgb2gray(s);
end
figure;imshow(s);title('Input Image')
end
if(cc==2)
%%%%%%% Preprocessing %%%%%%%%
% Applying Kuan Filtering for removal of Gaussian and Poisson noise
[kF,wKF]=kuan(s);
[MkF,wMKF]=mkuan(s);
k = 15;
option = 2;
disp('Preprocesng image please wait . . .');
[ADF,wADF] = anisodiff(s,k,option);
[mse, psnr_Value] = PSNR(s,kF,MkF,ADF);
weight=[wKF wMKF wADF];
t1=[mse;psnr_Value;weight];
t1=table(t1(:,1),t1(:,2),t1(:,3),'RowNames',{'MSE','PSNR','Weight Value'}...
,'VariableNames',{'KF','Proposed_MKF','ADF'});
fprintf('\n Table:1 Performance Measures for Preprocessing\n');
disp(t1);
figure;imshow(ADF,[]);title('Preprocessed Image');
end
if(cc==3)
%%%%%%%% Feature extracion %%%%%%%
[Y,stats] = FLDA(ADF);
fprintf('\nGLCM based statistical features\n');
disp(stats);
figure,imshow(Y,[]);title('Feature Extracted Image');
end
if(cc==4)
%%%%%% Training using fuzzy - Neuron Network%%%%%%%%
[traindata, trainlabel]=training(no_of_Image);
train_x = double(traindata)/255;
train_y = double(trainlabel);
% Initialize net
nn = newffd(train_x,train_y,no_of_Image);
nn = train(nn, train_x, train_y);
end
sruthi N
sruthi N il 18 Dic 2017
error is here
Error using imread>get_full_filename (line 516) File "ImageDataSet/1.tiff" does not exist.
Error in imread (line 340) fullname = get_full_filename(filename);
Error in training (line 6) I{a}=imread(['ImageDataSet/' num2str(a) '.tiff']);
Error in main (line 56) [traindata, trainlabel]=training(no_of_Image);
Walter Roberson
Walter Roberson il 18 Dic 2017
We, as outsiders, have no reason to expect that file ImageDataSet/1.tiff is definitely going to be there.
You should be testing to see that the files are present before attempting to read them, or else you should be putting in a try/catch to handle the situation of the files not being available.

Accedi per commentare.

Risposte (1)

Rik
Rik il 18 Dic 2017

0 voti

Then the answer is in the error message: the file does not exist. Note that your file separator depends on your system. That's the reason you shouldn't hardcode the slashes unless you're certain only 1 file system will handle this code. You can use filesep or fullfile instead. It might also be best to use an explicit path. You can use pwd to get the current directory, or use dbstack('-completenames') to get the folder of the function that is running.

Categorie

Scopri di più su Deep Learning Toolbox in Centro assistenza e File Exchange

Richiesto:

il 18 Dic 2017

Commentato:

il 18 Dic 2017

Community Treasure Hunt

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

Start Hunting!

Translated by