我正在尝试将一组图像的文件路径拆分为trainingLabel
数组,因为图像名称包含其ID。但是此错误总是弹出“输入必须是字符的行向量”。
文件路径示例:'C:\...\Folhas_1\1.jpg'
代码:
imageDatabase = imageSet('Folhas_1','recursive');
[training, test] = partition(imageDatabase, [0.8, 0.2]);
trainingFeatures = zeros(training.Count,10404);
featureCount = 1;
for i=1:training.Count
sizeNormalizedImage = imresize(read(training(1),10),[150 150]);
trainingFeatures(featureCount,:) = extractHOGFeatures(sizeNormalizedImage);
[filepath,name,ext] = fileparts(training.ImageLocation(i));
trainingLabel{featureCount} = name;
featureCount = featureCount + 1;
end
您对此有何线索?谢谢。