Index exceeds array bounds.
Mostra commenti meno recenti
this is the part of my code. i am trying to use matlab to train data. there is a folder named (label) and there are 400 pictures in this folder. and errors happen...
my english isnt that well. sorry..
hope someone can help me. thx a lot
------------------------------------------------------------------
%% generate data
filepaths = dir(fullfile(folder,'*.bmp'));
labelpaths = dir(fullfile(folder,'*.bmp'));
for i = 1 : 380 %length(filepaths)
im_input = im2double(imread(fullfile(folder,filepaths(i).name)));
im_label = im2double(imread(fullfile(labelfold,labelpaths(i).name)));
[hei,wid] = size(im_label);
for x = 1 : stride : hei-size_input+1
for y = 1 :stride : wid-size_input+1
subim_input = im_input(x : x+size_input-1, y : y+size_input-1);
subim_label = im_label(x+padding : x+padding+size_label-1, y+padding : y+padding+size_label-1);
count=count+1;
data(:, :, 1, count) = subim_input;
label(:, :, 1, count) = subim_label;
end
end
end
order = randperm(count);
data = data(:, :, 1, order);
label = label(:, :, 1, order);

my version is R2018b
1 Commento
Walter Roberson
il 1 Apr 2019
You did not have at least 380 different .bmp files in the folder.
Note: you use the same folder for filepaths and labelpaths when doing the dir(), but you use different folder names when duing the fullfile for imread purposes.
Risposte (0)
Categorie
Scopri di più su Startup and Shutdown in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!