필터 지우기
필터 지우기

how to read a folder of images in matlab and how Labels the images like human with bag and with out

조회 수: 3 (최근 30일)
i want to read the multiples images in the folder and i am using imgSet function in matlab 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.
here is my code
classes = {'human with bag', 'human without bag'}; %
trainingDataSizePercent = 30;
numberOfClusters = 500;
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

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 7월 28일
편집: KALYAN ACHARJYA 2019년 7월 28일
i want to read the multiples images in the folder?
how to read a folder of images in matlab?
Images=dir('C:\complete_folder_path\folder_name\*.png');
%.................................................^^ Note of image format
for i=1:length(Images)
ImgName=strcat('C:\Research\IIT D Lab\hand_2101\',Images(i).name);
InputImage=imread(ImgName);
%Do operation
end
Hope it helps!
Any issue let me know?

추가 답변 (1개)

Mrutyunjaya Hiremath
Mrutyunjaya Hiremath 2020년 8월 26일
% imgSets = [];
imgFolder = fullfile(matlabroot, 'toolbox', 'vision', 'visiondata','imageSets');
imgSets = imageSet(imgFolder,'recursive');
for i = 1:length(imgSets)
for j = 1:length(imgSets(i).ImageLocation)
% imgSets = [ imgSets, imageSet(fullfile('imgSets', classes{i})) ];
imgName = cell2mat(imgSets(i).ImageLocation(j));
inputImage=imread(imgName);
figure(1), imshow(inputImage);
end
end

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by