features extraction for images with different features size in a matrix error?
2 ビュー (過去 30 日間)
古いコメントを表示
yasmin almashagbah
2020 年 11 月 30 日
コメント済み: yasmin almashagbah
2020 年 12 月 9 日
I am trying to extract features from a dataset of images the problem that the features extraction algorithm gives different features size for each image, for example, the first image 1000 features and the second 2000. and it gives me an error because of that when I try to store them in a matrix. what should I do??
imds=imageDatastore('E:\dataset test','IncludeSubFolders',true,'LabelSource','foldernames');
trainingFeatures=[];
[imds_5k, imds_extra] = splitEachLabel(imds,15);
trainingLabels=imds_5k.Labels;
for i = 1:numel(imds_5k.Files) % Read images using a for loop
img = readimage(imds_5k,i);
trainingFeatures(i,:) = example(img);
end
this is the error: Unable to perform assignment because the size of the left side is 1-by-86386 and the size of the right side is 1-by-73638.
0 件のコメント
採用された回答
Ameer Hamza
2020 年 11 月 30 日
You can use a cell array
imds=imageDatastore('E:\dataset test','IncludeSubFolders',true,'LabelSource','foldernames');
[imds_5k, imds_extra] = splitEachLabel(imds,15);
trainingLabels=imds_5k.Labels;
trainingFeatures=cell(1,numel(imds_5k.Files));
for i = 1:numel(imds_5k.Files) % Read images using a for loop
img = readimage(imds_5k,i);
trainingFeatures{i} = example(img);
end
6 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Language Support についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!