Skip to content

Instantly share code, notes, and snippets.

@RDCH106
Last active January 20, 2016 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RDCH106/0cc39e396e702ce06797 to your computer and use it in GitHub Desktop.
Save RDCH106/0cc39e396e702ce06797 to your computer and use it in GitHub Desktop.
Load numerated images from a folder using OpenCV
void OpenCV_loadImages( const std::string &folder, const std::string &tag, const std::string format, std::vector<cv::Mat> &images ){
images.clear();
std::string fileName;
int index = 1;
while( true ){
fileName = folder + "/" + tag + std::to_string( (long long) index) + "." + format;
cv::Mat newImage = cv::imread( fileName );
if( newImage.empty() ) break;
images.push_back( newImage );
++index;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment