Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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.

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.