Ask Your Question

Revision history [back]

What probably is happing is that your processing doesn't take that much time, processing happens and then your debugger gets to the end of your program. What you can do to see if anything goes wrong is adding the following code to your project.

// If you have no namedWindow defined yet, make a dummy at the end of your code, else ignore the first line
// It makes sure that the waitKey() event works.
namedWindow("dummy");
// Wait untill a key is pressed
waitKey(0);

This will keep your program and command prompt open until you hit enter. It is typical for VS to close down a window in debug mode, the moment you reach the end of your code and you have return 0. What you can also do is add a breakpoint before debugging, just at the return line. This will do the same in debug as the above code.