Save data in jpg format in special folder
Mostrar comentarios más antiguos
Hello.
I wanted to make imagedatastore from .mat file.,(it consist of 1x1 struct:Data with 150x10000double and Labels with 150x1cell.)
My target was save figures in special format(for example, .j,pg, 224x224pixel) in special folder. Actually there are 3 subfolder(name of 3 category).
So i tried codes like this
load(fullfile(tempdir,'ECG','Data.mat')
parentDir = tempdir
dataDir = 'data'
imageRoot = fullfile(parentDir,)dataDir;
data = Data.Data
labels = Data.Labels
r = size(data,1)
for i = 1:r
cfs = abs(data(i,1:1000)
im = ind2rgb(im2uint8(rescale())cfs,jet(128))
imgLoc= fullfile(imageroot,char(labels()))i
imFileName= strcat(char(labels(i)),'_',num2str()i,''jpg)
imwrite(imresize(im,[224 224],fullfile(imgLoc,))
end
imFileName
1 comentario
khadicha amonova
el 19 de Mzo. de 2019
Editada: khadicha amonova
el 19 de Mzo. de 2019
Respuestas (0)
Categorías
Más información sobre Data Import and Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!