load_library :video include_package 'processing.video' attr_reader :cam def setup size(960, 544) cameras = Capture.list fail 'There are no cameras available for capture.' if (cameras.length == 0) p 'Matching cameras available:' size_pattern = Regexp.new(format('%dx%d', width, height)) select = cameras.grep size_pattern # filter available cameras select.map { |cam| p cam } fail 'There are no matching cameras.' if (select.length == 0) start_capture(select[0]) end def start_capture(cam_string) # The camera can be initialized directly using an # element from the array returned by list: @cam = Capture.new(self, cam_string) p format('Using camera %s', cam_string) cam.start end def draw return unless (cam.available == true) cam.read image(cam, 0, 0) # The following does the same, and is faster when just drawing the image # without any additional resizing, transformations, or tint. # set(0, 0, cam) end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Saturday, 10 January 2015
Video capture with ruby-processing
Simple sketch to get you started with video capture on ruby-processing, makes sense to set sketch to dimensions you think that your camera can work with (use cameras instead of select for an unfiltered list, but it can be very long list as many low resolution cameras get listed, each with lots of fps settings).
Labels:
capture,
ruby-processing,
video
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2015
(51)
-
▼
January
(13)
- Installing netbeans ruby-plugin and jruby_art gem
- JRubyArt vs ruby-processing
- Netbeans, the perfect ide for jruby_art
- Cranky keyboard (unless you are a northern Europea...
- Another sound library example translated to ruby-p...
- Testing the new processing sound library in ruby-p...
- Mirror, a Dan Shiffman video capture sketch
- Experimenting with refinements
- Configuring ruby processing
- A Golan Levin video capture sketch translate to ru...
- A simplified ASCII video capture sketch in ruby pr...
- A Ben Fry video capture sketch in ruby-processing
- Video capture with ruby-processing
-
▼
January
(13)
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment