Load all the images from a directory

前端 未结 4 1749
慢半拍i
慢半拍i 2020-11-29 11:25

I have certain images in a directory and I want to load all those images to do some processing. I tried using the load function.

imagefiles = di         


        
4条回答
  •  情话喂你
    2020-11-29 12:22

    The full path (inc. directory) is not held in imgfiles.name, just the file name, so it can't find the file because you haven't told it where to look. If you don't want to change directories, use fullfile again when reading the file.

    You're also using the wrong function for reading the images - try imread. Other notes: it's best not to use i for variables, and your loop is overwriting I2 at every step, so you will end up with only one image, not four.

提交回复
热议问题