Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered Jul 12 '14

Witek gravatar image

If you are working in Windows and don't wane to use boost you can do it like that (include Windows.h beforehand):

WIN32_FIND_DATA found;
HANDLE hfind;

vector<Mat> images;
int fileCount=0; 

hfind=FindFirstFile("C:\\path\\baseFilename???.jpg",&found);
if(hfind!=INVALID_HANDLE_VALUE)
    do
    {
        fileCount++;
        images.push_back(imread(found.cFileName)); 
    }while(FindNextFile(hfind,&found));

Hope someone will find it useful.

click to hide/show revision 2
No.2 Revision

If you are working in Windows and don't wane to use boost you can do it like that (include Windows.h beforehand):

WIN32_FIND_DATA found;
HANDLE hfind;

vector<Mat> images;
int fileCount=0; 

hfind=FindFirstFile("C:\\path\\baseFilename???.jpg",&found);
if(hfind!=INVALID_HANDLE_VALUE)
    do
    {
        fileCount++;
        images.push_back(imread(found.cFileName)); 
    }while(FindNextFile(hfind,&found));

Hope someone will find it useful.useful. I wish VideoCapture worked like that. I mean, it would use wildcards and load all the files in the directory in alphabetical order even if some consecutive files are missing.

click to hide/show revision 3
No.3 Revision

If you are working in Windows and don't wane want to use boost you can do it like that (include Windows.h beforehand):

WIN32_FIND_DATA found;
HANDLE hfind;

vector<Mat> images;
int fileCount=0; 

hfind=FindFirstFile("C:\\path\\baseFilename???.jpg",&found);
if(hfind!=INVALID_HANDLE_VALUE)
    do
    {
        fileCount++;
        images.push_back(imread(found.cFileName)); 
    }while(FindNextFile(hfind,&found));

Hope someone will find it useful. I wish VideoCapture worked like that. I mean, it would use wildcards and load all the files in the directory in alphabetical order even if some consecutive files are missing.