Vitt Volt
Vitt Volt

Reputation: 337

OpenCV Sample Project Cannot Properly Shutdown

I'm following the tutorial from the official website of OpenCV: http://docs.opencv.org/3.0-beta/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html.

Even though I could successfully run the program, when I tried to close the console window, it took endless time to respond and the program is never closed. I had to shutdown Visual Studio, delete the exe file and rebuild the project in order to run it again.

I have even tried setting the while loop to run for a limited number of times, the result is the same.

I am just confused what might have caused the problem? Does it have something to do with the memory over-allocation?

Upvotes: 0

Views: 80

Answers (1)

Humam Helfawi
Humam Helfawi

Reputation: 20324

This code makes the problem:

int c = waitKey(10);
if( (char)c == 27 ) { break; } // escape

You should press ESC in order to terminate the program safely

Upvotes: 0

Related Questions