Class: Rupi::Camera
- Inherits:
-
Object
- Object
- Rupi::Camera
- Defined in:
- lib/rupi/camera.rb
Constant Summary collapse
- CONFIGURATION =
{ :width => 640, :height => 480, :gain => 80, :brightness => 80, :contrast => 80, :saturation => 80 }
Class Method Summary collapse
Class Method Details
.capture(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rupi/camera.rb', line 18 def self.capture( = {}) cfg = CONFIGURATION.merge() path = [:path] if path.nil? file = Tempfile.new('snap') path = file.path end command = "uvccapture -S#{cfg[:saturation]} -B#{cfg[:brightness]} -C#{cfg[:contrast]} -G#{cfg[:gain]} -x#{cfg[:width]} -y#{cfg[:height]}" system("#{command} -o#{path}") file || File.new(path) end |
.configure(options = {}) ⇒ Object
14 15 16 |
# File 'lib/rupi/camera.rb', line 14 def self.configure( = {}) CONFIGURATION.merge!() end |