How do I arrange folders before using HOG
Afficher commentaires plus anciens
Folder = 'D:\Project\DB\train\';
FileList1 = dir(fullfile(Folder, '**', '*.tif'));
FileList = sort_nat( FileList1 );
Feature = cell(1, numel(FileList)); % Pre-allocation
for iFile = 1:numel(FileList)
File = fullfile(FileList(iFile).folder, FileList(iFile).name);
Img = imread(File);
Img = imresize(Img, [200, 50]);
Feature{iFile} = hog_feature_vector(Img);
end
% Maybe:
Feat1 = cat(1, Feature{:}); % Or cat(2, ...) ?!
save('featurs_T.mat', 'Feat1');
Folder2 = 'D:\Project\DB\test\';
FileList22 = dir(fullfile(Folder2, '**', '*.tif'));
FileList2 = sort_nat( FileList22 );
Feature2 = cell(1, numel(FileList2)); % Pre-allocation
for iFile2 = 1:numel(FileList2)
File2 = fullfile(FileList2(iFile2).folder, FileList2(iFile2).name);
Img2 = imread(File2);
Img2 = imresize(Img2, [200, 50]);
Feature2{iFile2} = hog_feature_vector(Img2);
end
% Maybe:
Feat2 = cat(1, Feature2{:}); % Or cat(2, ...) ?!
save('featurs_S.mat', 'Feat2');
>> HOG_NEW
Error using regexprep
The 'STRING' input must be either a char row vector, a cell array of char row vectors, or a string
array.
Error in sort_nat (line 46)
c2 = regexprep(c,'\d+','0');
Error in HOG_NEW (line 7)
FileList = sort_nat( FileList1 );
>>
Réponses (0)
Catégories
En savoir plus sur Function Creation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!