How do I arrange folders before using HOG
조회 수: 1 (최근 30일)
이전 댓글 표시
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 );
>>
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!