whats wrong with this code when it read images from folder it gives me the following error. Error in Untitled8 (line 14) filename2 = strrep(filename,pathname);
Show older comments
clear all;
clc;
close all;
[filenameList, pathnameList] = uigetfile(...
{'*.jpg;*.tif;*.png;*.gif;*.bmp','All Image Files'},'mytitle',...
'MultiSelect', 'on', ...
'c:/DatasetResultsNew/');
pathname = pathnameList;
for iFile=8:10 % 1:28 %check out here
filename = filenameList{iFile-7};
filename2 = strrep(filename,pathname);
fprintf('Processing image %s\n', filename);
im_GroundTruth = imread([pathname,filename]); % object=1; backgroud = 0;
im_GroundTruth(im_GroundTruth>0)=255;
im_segmentaion = im2uint8(imread([pathname,filename2])); % object=1; backgroud = 0;
Conf = confusionmat(im_GroundTruth(:),im_segmentaion(:));
recall = Conf(2,2)/sum(Conf(2,:))*100;
precision = Conf(2,2)/sum(Conf(:,2))*100;
f_measure = 2*recall*precision/(recall+precision);
metricsMatrix(iFile).recall=recall;
metricsMatrix(iFile).precision=precision;
metricsMatrix(iFile).f_measure=f_measure;
end
3 Comments
What do you expect this to do?:
filename2 = strrep(filename,pathname);
The strrep help clearly shows that the function requires three input arguments, but you only have two. It is not clear what your invented syntax is supposed to do, but I strongly suspect that strrep will not be the correct tool for the job.
Please explain what you expect that line of code to do.
Arshad Ali
on 14 Jan 2019
Edited: Arshad Ali
on 14 Jan 2019
Arshad Ali
on 14 Jan 2019
Answers (0)
Categories
Find more on Image Transforms 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!