class CameraRuby::WebCam

Webcamera class.

Public Class Methods

take_snapshot() click to toggle source

Instruct webcam to take snapshot based on configuration settings.

# File lib/camera_ruby.rb, line 10
def self.take_snapshot
  image_name = File.read("image_config/image_name.txt").strip
  image_num  = File.read("image_config/image_num.txt").strip.to_i
  image_num  = image_num + 1

  system("cd images; fswebcam -d /dev/video1 -p YUYV -r 1600x1200 --jpeg 85 -D 2 -F 15 #{image_name}_#{image_num}.jpeg")

  open("image_config/image_num.txt", "w") { |f|
    f.print image_num
  }
end