how to store the image immediately after reading it in a for loop?

后端 未结 3 823
故里飘歌
故里飘歌 2021-01-25 02:07

I tried the following program for reading multiple images(about 300 images). Now I want to store these images immediately after reading each to some location by some name as

3条回答
  •  無奈伤痛
    2021-01-25 03:06

    Try this -

    for i=1:5
        img =imread(['C:\Users\shree\Desktop\1\im' num2str(i) '.jpg']);
        evalc(['g' num2str(i) '=img;']);
    end
    figure,imshow(g1);
    figure,imshow(g2);
    

    Another approach could be to use STRUCT and store those images as fields of a struct.

    Storing as a 4D matrix is another efficient way as suggested by herohuyongtao.

提交回复
热议问题