how can i convert image datastore to 4DArrayData

Dear all,
i have an image datastore that load images as in the attached picture:
how can i convert the cell of images to 4DArrayData to have the same form of digitTrain4DArrayData??

回答 (1 件)

Nagwa megahed
Nagwa megahed 2021 年 12 月 17 日

0 投票

I solved the problem by trying this way :
datasetFolder = ' F:\Datasets\.......; // add the path of your images dataset
imds = imageDatastore(datasetFolder,IncludeSubfolders=true,LabelSource="foldernames");
X=readall(imds);
XTrain = reshape( cat(3,X{:}) , [105,105,1,3410]);
YTrain=imds.Labels;
dsXTrain = arrayDatastore(XTrain,'IterationDimension',4);
dsYTrain = arrayDatastore(YTrain);
dsTrain = combine(dsXTrain,dsYTrain);
and it works perfectly

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

製品

リリース

R2021b

質問済み:

2021 年 12 月 12 日

回答済み:

2021 年 12 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by