Created
March 28, 2012 00:36
-
-
Save arirusso/2222155 to your computer and use it in GitHub Desktop.
ruby-processing: video capture processing example
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 | |
# this is a test of ruby-processing (https://github.com/jashkenas/ruby-processing) with video capture | |
# use "rp5 unpack library" at a command line to install the video library, among others | |
# tested with Ruby 1.9.2 on OSX with built in web cam | |
class VideoCaptureTest < Processing::App | |
load_library :video | |
include_package "processing.video" | |
def setup | |
smooth | |
size(720, 576, P2D) | |
@video = Capture.new(self, width, height, 30) | |
end | |
def draw | |
tint(*Array.new(3) { rand(256) }) | |
@video.read if @video.available? | |
image(@video, 0, 0) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment