Created
September 28, 2017 20:22
-
-
Save ahmadina/0663c1d35e96e064a93404f32b880af9 to your computer and use it in GitHub Desktop.
using webcam with OpenCV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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