Skip to content

Instantly share code, notes, and snippets.

@ahmadina
Created September 28, 2017 20:22
Show Gist options
  • Save ahmadina/0663c1d35e96e064a93404f32b880af9 to your computer and use it in GitHub Desktop.
Save ahmadina/0663c1d35e96e064a93404f32b880af9 to your computer and use it in GitHub Desktop.
using webcam with OpenCV
#!/usr/bin/env ruby
require 'opencv'
include OpenCV
FPS = 30
input = CvCapture.open
win = GUI::Window.new 'video'
loop do
img = input.query
win.show img
key = GUI.wait_key 1000 / FPS
break if key and key.chr == "\e"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment