Module: OpenCV::GUI

Defined in:
ext/opencv/gui.cpp,
ext/opencv/window.cpp,
ext/opencv/trackbar.cpp,
ext/opencv/mouseevent.cpp

Defined Under Namespace

Classes: MouseEvent, Trackbar, Window

Class Method Summary collapse

Class Method Details

.wait_key(delay = 0) ⇒ Number

Waits for a pressed key.

Parameters:

  • delay (Integer) (defaults to: 0)

    Delay in milliseconds. 0 is the special value that means “forever”.

Returns:

  • (Number)

    The code of the pressed key or nil if no key was pressed before the specified time had elapsed.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'ext/opencv/gui.cpp', line 34

VALUE
rb_wait_key(int argc, VALUE *argv, VALUE self)
{
  VALUE delay;
  rb_scan_args(argc, argv, "01", &delay);
  int keycode = 0;
  try {
    keycode = cvWaitKey(IF_INT(delay, 0));
  }
  catch (cv::Exception& e) {
    raise_cverror(e);
  }
  return (keycode < 0) ? Qnil : INT2NUM(keycode);
}