Skip to content

Instantly share code, notes, and snippets.

@arirusso
Created March 28, 2012 00:36
Show Gist options
  • Save arirusso/2222155 to your computer and use it in GitHub Desktop.
Save arirusso/2222155 to your computer and use it in GitHub Desktop.
ruby-processing: video capture processing example
#!/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