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