Last active
January 20, 2016 13:10
-
-
Save RDCH106/0cc39e396e702ce06797 to your computer and use it in GitHub Desktop.
Load numerated images from a folder using OpenCV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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