MATLAB Answers

How to convert images as array to images and save them in folder

5 views (last 30 days)
Laith Alzubaidi
Laith Alzubaidi on 21 Jul 2021
Commented: KSSV on 21 Jul 2021
Dear All,
I have worked on project and I got my results which are as one array or matrics when I plot them I can see them as shown in figure,
How can I built them as sparated images and save them in a folder
Could you please help with that,
Thank you

Answers (2)

KSSV
KSSV on 21 Jul 2021
  2 Comments
KSSV
KSSV on 21 Jul 2021
I gave you a link to refer on how to split your images into sub images.

Sign in to comment.


Jonas
Jonas on 21 Jul 2021
Edited: Jonas on 21 Jul 2021
for a matrix A with ynum images in y direction and xnum images in x direction with size height x width you can use
C = mat2cell(A,repelem(height,ynum),repelem(width,xnum));
this divides A into a bunch of cell arrays. you can then use cellfun or a ordinary double for loop with your own custom function to save each cell entry
alternatively you can use the function blockproc, to which you can give the block size (subimage size) and a custom function to save the subimages

Community Treasure Hunt

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

Start Hunting!