Download all images from the catalog

I have certain images in a directory and I want to upload all these images in order to do some processing. I tried to use a function load.

imagefiles = dir('F:\SIFT_Yantao\demo-data\*.jpg');      
nfiles = length(imagefiles);    % Number of files found
 for i=1:nfiles
 currentfilename=imagefiles(i).name;
 I2 = imread(currentfilename);
 [pathstr, name, ext] = fileparts(currentfilename);
 textfilename = [name '.mat'];
fulltxtfilename = [pathstr textfilename];
load(fulltxtfilename);
descr2 = des2;
frames2 = loc2;
do_match(I1, descr1, frames1, I2, descr2, frames2) ;
end

I get an error because I can not read xyz.jpg there is no such file or directory where xyz is my first image in this directory.
I also want to download all image formats from the catalog, not just jpg ... how can I do this?

+5
source share
4 answers

You can easily upload multiple images of the same type as follows:

function Seq = loadImages(imgPath, imgType)
    %imgPath = 'path/to/images/folder/';
    %imgType = '*.png'; % change based on image type
    images  = dir([imgPath imgType]);
    N = length(images);

    % check images
    if( ~exist(imgPath, 'dir') || N<1 )
        display('Directory not found or no matching images found.');
    end

    % preallocate cell
    Seq{N,1} = []

    for idx = 1:N
        Seq{d} = imread([imgPath images(idx).name]);
    end
end
+9
source

, imread, load. . .

+2

(. ) imgfiles.name, , , , . , .

- imread. : , I2 , , .

+1

imageSet . . .

+1

All Articles