I'm debugging some C++ code that use OpenCV on Ubuntu 14, which is known to work On Ubuntu 12 and maybe with other OpenCV library build.
What was before
int key_pressed = waitKey(0);
cout << "key_pressed " << int(key_pressed) << endl;
switch( key_pressed )
{
case 27: //esc
{
//close all windows and quit
destroyAllWindows();
}
...
But this code is not working and in output I have key_pressed 1048603
This code work:
char key_pressed = cv::waitKey();
cout << "key_pressed " << int(key_pressed) << endl;
switch( key_pressed )
{
case 27: //esc
{
//close all windows and quit
destroyAllWindows();
}
...
This code is working and in output I have key_pressed 27
What can be reason of such behaviour?
P.S. documentation says that cv::waitKey() return int
, so why we should convert it to char
?