Ask Your Question
1

Program termination

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

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 );
waitKey(0);
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
3

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

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

Comments

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 -0600 )edit

Question Tools

Stats

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

Seen: 616 times

Last updated: Apr 19 '13