#include <iostream>
#include <vector>
#include <boost/filesystem>
#include <cv/core.hpp>
#include <cv/highgui.hpp>
std::vector<cv::Mat> read_images_from_dir(std::string dir_name) {
std::vector<cv::Mat> image_vec;
boost::filesystem::path p(dir_name);
std::vector<boost::filesystem::path> tmp_vec;
std::copy(boost::filesystem::directory_iterator(p),
boost::filesystem::directory_iterator(),
back_inserter(tmp_vec));
std::vector<boost::filesystem::path>::const_iterator it = tmp_vec.begin();
for (; it != tmp_vec.end(); ++it) {
if (is_regular_file(*it)) {
//std::cout << it->string() << std::endl;
image_vec.push_back(read_image(it->string()));
}
}
return image_vec;
}
std::vector<cv::Mat> compute(std::vector<cv::Mat>& image_vec) {
std::vector<cv::Mat> output_images(image_vec.size());
std::vector<cv::Mat> tmp_images(124);
processed_images = 0;
while (processed_images < image_vec.size()) {
// make computations and update the output_images
// for the images that are currently in processed
// remove the images that finished from the tmp_images
// and update the processed_images variable
// import new images to tmp_images unless there
// are no more in the input vector
}
return output_images;
}
void main(int argc, char* argv[]) {
std::vector<cv::Mat> input_images = read_images_from_dir(file_or_dir);
std::vector<cv::Mat> output_images = compute(input_images);
// save the output_images
}