Ask Your Question

Revision history [back]

this is not a serious problem but you can avoid it by using destroyAllWindows() before imshow()

#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace cv;
using namespace std;

int main()
{
    String folder = "F:/8TH SEMESTER/Traffic Sign Dectection/30speed/*.ppm";
    //string folder = ("F:/Hammad Profile/FYP/German/GTSDB/FullIJCNN2013/*.ppm");
    vector<String> filenames;

    glob(folder, filenames);

    Mat myImage;

    for (size_t i = 0; i < filenames.size(); i++)
    {
        myImage = imread(filenames[i]);
        destroyAllWindows();  //****************************** add this line
        imshow("Sample Traffic signs", myImage);
        int c = cv::waitKey(400);
    }

    return 0;
}

this is not a serious problem but you can avoid it by using destroyWindow() or destroyAllWindows() before imshow()

#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <stdio.h>
#include <string>
 using namespace cv;
using namespace std;

int main()
{
{    String folder = "F:/8TH SEMESTER/Traffic Sign Dectection/30speed/*.ppm";
    //string folder = ("F:/Hammad Profile/FYP/German/GTSDB/FullIJCNN2013/*.ppm");
    vector<String> filenames;

    glob(folder, filenames);

    Mat myImage;
m1(50, 100, CV_8UC3, Scalar(255, 0, 0));
    Mat m2(100, 50, CV_8UC3, Scalar(0, 0, 255));
 for (size_t i = 0; i < filenames.size(); i++)
imshow("test", m1);
 {
waitKey(0);
 imshow("test", m2);
 myImage = imread(filenames[i]);
waitKey(0); 

 imshow("test", m1);
 destroyAllWindows();  //****************************** add this line
waitKey(0);
 destroyWindow("test"); // or    destroyAllWindows();
 imshow("Sample Traffic signs", myImage);
imshow("test", m2);
     int c = cv::waitKey(400);
    }
waitKey(0);

    return 0;
}

this is not a serious problem but you can avoid it by using destroyWindow() or destroyAllWindows() before imshow()

#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main()
{   
    Mat m1(50, 100, CV_8UC3, Scalar(255, 0, 0));
    Mat m2(100, 50, CV_8UC3, Scalar(0, 0, 255));

    imshow("test", m1);
    waitKey(0);
    imshow("test", m2);
    waitKey(0); 

    imshow("test", m1);
    waitKey(0);
    destroyWindow("test"); // or    destroyAllWindows();
    imshow("test", m2);
    waitKey(0);

    return 0;
}

image description ......... image description

image description ......... image description

this is not a serious problem but you can avoid it by using destroyWindow() or destroyAllWindows() before imshow()

TEST CODE:

#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main()
{   
    Mat m1(50, 100, CV_8UC3, Scalar(255, 0, 0));
    Mat m2(100, 50, CV_8UC3, Scalar(0, 0, 255));

    imshow("test", m1);
    waitKey(0);
    imshow("test", m2);
    waitKey(0); 

    imshow("test", m1);
    waitKey(0);
    destroyWindow("test"); // or    destroyAllWindows();
    imshow("test", m2);
    waitKey(0);

    return 0;
}

image description ......... image description

image description ......... image description