Ask Your Question

Program termination

asked 2013-04-19 11:42:17 -0500

daryllee gravatar image

I just installed OpenCV 2.4.5 on my Mac OSX (Mountain Lion) and ran the "lena" tutorial. It works fine except for termination. The last few lines of code in the tutorial are:

imshow( "Display Image", image );
return 0;

Based on the waitKey() documentation, it looks like any keystroke should get me out of the program. However, any key I type is echoed, but only Ctl-C terminates the program. The Quit item on the Menu doesn't terminate either, although I'm not as surprised by that.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-19 12:00:21 -0500

HD_Mouse gravatar image

Did you try clicking the displayed window and then pressing a key? The focus of your OS may still be with the terminal, so your keystrokes are being intercepted by your terminal, rather than the window created from imshow().

edit flag offensive delete link more


Well, duh! I was very careful to click the terminal window that I launched the program from; it just never occurred to me that the display window needed focus. Thanks for the pointer!

daryllee gravatar imagedaryllee ( 2013-04-19 18:03:32 -0500 )edit

Question Tools


Asked: 2013-04-19 11:42:17 -0500

Seen: 294 times

Last updated: Apr 19 '13