Ask Your Question

cv::waitKey() upper-/lowercase difference

asked 2012-11-17 06:13:08 -0600

Storm gravatar image

updated 2012-11-18 04:37:35 -0600

Hi! Is there a simple method to determine whether the Shift key was pressed together with another one? For example, I want to do different actions on 'u' and 'U'.

UPD: cv::getBuildInformation() output

edit retag flag offensive close merge delete


This might not be possible with opencv only on all platforms. Consider using another library (or win32/X11 API)

a739 gravatar imagea739 ( 2020-06-09 04:59:16 -0600 )edit

4 answers

Sort by ยป oldest newest most voted

answered 2012-11-17 07:35:58 -0600

sammy gravatar image

waitKey returns the ASCII code for the letter. It is different for uppercase and lowercase letters.

char c = cv::waitKey();
if(c == 'u') {}
if(c == 'U') {}
edit flag offensive delete link more



It was first, what I've tried, but I am getting 'u' (117) in both cases. I've added OpenCV build info in my question.

Storm gravatar imageStorm ( 2012-11-18 04:41:28 -0600 )edit

answered 2013-02-13 05:27:58 -0600

big_mu5 gravatar image

updated 2013-02-13 05:28:19 -0600

I have similar problem, in my case, cvWaitKey does not really capture the difference between lower and upper case letters. A colleague told me that he solved this problem by compiling openCV from sources. I guess it might have smth to do with 64bit

edit flag offensive delete link more

answered 2013-02-13 09:08:06 -0600

unxnut gravatar image

I just tried it using build 2.4.3 and I received uppercase and lowercase letters as typed.

edit flag offensive delete link more

answered 2012-11-18 08:39:45 -0600

Victor1234 gravatar image

As i know key code return qt, not OpenCV, try to set it up, i have some strange result too at once.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2012-11-17 06:13:08 -0600

Seen: 4,177 times

Last updated: Feb 13 '13