jruby + processing + camera
これは非常にクールだ! GJ!と思い早速カメラが使えるか参考にして試してみた。
require "java" include_class "processing.core.PApplet" include_class "processing.video.Capture" class Sketch < PApplet def setup size(360,240) @cam = Capture.new(self, 360, 240, 12) end def draw if(@cam.available) @cam.read() end image(@cam, 0, 0) end end JFrame = javax.swing.JFrame def run applet frame = JFrame.new applet.class.to_s frame.content_pane.add applet frame.default_close_operation = JFrame::EXIT_ON_CLOSE applet.init frame.pack frame.visible = true end if $0 == __FILE__ run Sketch.new end
一応でけた。これでjirbからごにょっとできればさぞ面白いことになるなー