how to load Image Datastore and make them of equal size

6 views (last 30 days)
i am trying to do this but facing this error
Error using imageSet/parseDirInput (line 131)
Input, imageLocation, must be a valid folder name or a cell array of image file locations.
Error in imageSet/parseInput (line 101)
this = this.parseDirInput(varargin{:});
Error in imageSet (line 306)
this = parseInput(this, varargin{:});
Error in bowexample (line 25)
imgSets = [ imgSets, imageSet(fullfile('imgSets', classes{i})) ];
here is my code
imgSets = [];
imgFolder = fullfile(matlabroot, 'toolbox', 'vision', 'visiondata','imageSets');
imgSets = imageSet(imgFolder,'recursive');
for i = 1:length(classes)
imgSets = [ imgSets, imageSet(fullfile('imgSets', classes{i})) ];
end
thanks

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 30 Jul 2019
Edited: KALYAN ACHARJYA on 30 Jul 2019
Images=dir('C:\complete_path\folder_name\*.png'); %Database Image folder
%...........................................^ note on format
outDirectory='C:\complete_path\resize_images\'; % To save resize images
%......................^ set valid path folder will create by Matlab itself
mkdir(outDirectory);
for i=1:length(Images)
ImgName=strcat('C:\complete_path\folder_name\',Images(i).name);
grayImage=imread(ImgName);
newImage=imresize(grayImage,[512 512],'bilinear');
%..............................^ choose as per your requirements, size and method
imwrite(newImage,strcat(outDirectory,Images(i).name));
end
Any issue let me know?
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!