How to retrieve a sequence of images from a folder, such that the images will represent a movement?
opencv c++
if your images are numbered (001.png, 002.png,..), you can use
cv::VideoCapture cap("/path/to/files/%d.png");
while(cap.isOpened()) {
Mat img;
if (! cap.read(img))
break; // end of sequence
cv::imshow("img", img);
if (cv::waitKey(1000) > 0) // 1000 millis == 1 second
break;
}
if your images can be sorted lexically (aaa.png, aab.png,..), you can also use:
vector<String> files;
cv::glob( "/path/to/files/*.png", files);
for (size_t i=0; i<files.size(); i++) {
Mat img = imread(files[i]);
}
Asked: 2016-12-18 05:02:47 -0600
Seen: 124 times
Last updated: Dec 18 '16
Yes..in order