How to make matrix from images in folders
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Kong
el 11 de Mzo. de 2020
Respondida: Payas Bahade
el 16 de Mzo. de 2020
Hello.
I want to convert images in folders to CSV file.
(name of images : weighted2, weighted3, weighted4, weighted5,,,,)
0 comentarios
Respuesta aceptada
Payas Bahade
el 16 de Mzo. de 2020
Hi Kong,
I am assuming all images are of ‘.jpg’ format and located in same folder. If they are of different format, tweak below provided code as required.
Below mentioned code can be used for writing each image into separate CSV files:
for i=1:5
imName = strcat('weighted', num2str(i),'.jpg');
imVal = imread(imName);
fName=strcat('weightedimage',num2str(i),'.csv');
writematrix(imVal,fName);
end
And for saving images to different worksheets of a single excel file, use below mentioned code:
for i=1:5
imName = strcat('weighted', num2str(i),'.jpg');
imVal = imread(imName);
writematrix(imVal, 'weightedimages.xlsx','Sheet',i);
end
Hope this helps!
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!