[英]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
I want to read images from a directory. 我想从目录中读取图像。 But it gives me error some images.
但这给了我一些图像错误。
Assignment has fewer non-singleton rhs dimensions than non-singleton subscripts
I use breakpoint to find which image has a problem. 我使用断点来查找哪个图像有问题。 When it gives error, I catch the index of the image and show this image.
当它给出错误时,我捕获图像的索引并显示该图像。
I find this image from this directory. 我从该目录中找到该图像。 it's order is 1061 (orders according to name) but value of jj is 1012.
它的顺序为1061(根据名称顺序),但jj的值为1012。
I have three Question. 我有三个问题。
getting the name of image, you can use code below; 获取图片名称,可以使用下面的代码;
imshow(read(imset(ii),jj)); a = select(imset(ii),jj); str = cellstr(a(1,1).ImageLocation); title(str);
Because imageset orders alphabetically but different way(name) For example. 因为imageset按字母顺序排序,但是方式(名称)不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.