How to show every image in every loop
I have such code
#include <opencv.hpp>
#include <filesystem>
using namespace cv;
using namespace std;
int main() {
for (auto mark_name : experimental::filesystem::directory_iterator("E:/test")) {
string filename = mark_name.path().string();
Mat testImg = imread(filename.c_str(), 0);
//Some steps about image-processing
imshow(filename.c_str(), testImg);
}
waitKey();
return 0;
}
Suppose I have 10 or more images in my driectory E:/test
. I found all image have to show noramlly after all evaluation is completed, before that all window is gray status like this
I want the imshow(filename.c_str(), testImg);
work to show the image directly in every loop, is possible?