Method: Processing::Capture#initialize

Defined in:
lib/processing/capture.rb

#Capture.newCapture #Capture.new(cameraName) ⇒ Capture #Capture.new(requestWidth, requestHeight) ⇒ Capture #Capture.new(requestWidth, requestHeight, cameraName) ⇒ Capture

Initialize camera object.

Parameters:

  • requestWidth (Integer)

    captured image width

  • requestHeight (Integer)

    captured image height

  • cameraName (String)

    camera device name



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/processing/capture.rb', line 29

def initialize(*args)
  width, height, name =
    if args.empty?
      [-1, -1, nil]
    elsif args[0].kind_of?(String)
      [-1, -1, args[0]]
    elsif args[0].kind_of?(Numeric) && args[1].kind_of?(Numeric)
      [args[0], args[1], args[2]]
    else
      raise ArgumentError
    end
  @camera = Rays::Camera.new width, height, device_name: name
end