[英]Matlab imageset method order of read and name of image?
%% Load images from folder
% Use imageSet to manage images stored in multiple folders
imset = imageSet('pet_images','recursive');
% Preallocate arrays with fixed size for prediction
imageSize = cnnModel.net.normalization.imageSize;
trainingImages = zeros([imageSize sum([imset(:).Count])],'single');
% Load and resize images for prediction
for ii = 1:numel(imset)
for jj = 1:imset(ii).Count
imshow(read(imset(ii),jj));
trainingImages(:,:,:,jj) = imresize(single(read(imset(ii),jj)),imageSize(1:2));
end
end
我想從目錄中讀取圖像。 但這給了我一些圖像錯誤。
Assignment has fewer non-singleton rhs dimensions than non-singleton subscripts
我使用斷點來查找哪個圖像有問題。 當它給出錯誤時,我捕獲圖像的索引並顯示該圖像。
我從該目錄中找到該圖像。 它的順序為1061(根據名稱順序),但jj的值為1012。
我有三個問題。
獲取圖片名稱,可以使用下面的代碼;
imshow(read(imset(ii),jj)); a = select(imset(ii),jj); str = cellstr(a(1,1).ImageLocation); title(str);
因為imageset按字母順序排序,但是方式(名稱)不同。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.