Skip to content

kjunichi/mruby-webcam

Repository files navigation

mruby-webcam Build Status Build status

mruby-webcam

install by mrbgems

  • add conf.gem line to build_config.rb
MRuby::Build.new do |conf|

    # ... (snip) ...

    conf.gem :github => 'kjunichi/mruby-webcam'
end

example

cam = Webcam.new
cam.set_size 300, 300
cam.capture {|img|
  # img : JPEG format(default)
  puts img.length
}

# SPC : capture
# ESC : exit
cam.start
cam = Webcam.new
cam.set_size 300, 300
cam.each {|img|
  # img : JPEG format(default)
  puts img.length
}

how to put ppm image

cam = Webcam.new
cam.set_fmt "ppm"
cam.capture {|img|
  # img : PPM format(P6)
  puts img
}

# SPC : capture
# ESC : exit
cam.start

License

under the MIT License:

  • see LICENSE file