Create a single 4D uint array from a image folder

조회 수: 1 (최근 30일)
BabaOzone
BabaOzone 2019년 9월 9일
답변: darova 2019년 9월 10일
Hi everyone,
i have an image dataset with different classes (image, depth, labels, normal ... etc) and they all have their own folders.
i want to create a .mat file in which each of these folders are one single 4D uint arrays.
for example i want a image array with the following dimensions: 480 x 640 x 3 x 1000 that represents just one folder of the dataset (like image)
i have tried using "cat" but i could not make it work in a loop.
id appreciate a bit of help since im very new to matlab.

답변 (1개)

darova
darova 2019년 9월 10일
Example
n = 10; % number of images
I_many = zeros(480, 640, 3, n);
for i = 1:n
s = sprintf('Folder%d/image.png',i); % path to image
I = imread(s);
I_many(:,:,:,i) = I;
end

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by