Class: Artoo::Adaptors::OpencvCapture
- Inherits:
-
Adaptor
- Object
- Adaptor
- Artoo::Adaptors::OpencvCapture
- Defined in:
- lib/artoo/adaptors/opencv_capture.rb
Overview
Connect to a opencv device
Instance Attribute Summary collapse
-
#capture ⇒ Object
readonly
Returns the value of attribute capture.
Instance Method Summary collapse
-
#connect ⇒ Boolean
Creates a connection with device.
-
#disconnect ⇒ Boolean
Closes connection with device.
-
#finalize ⇒ Boolean
Closes connection with device if connected.
-
#method_missing(method_name, *arguments, &block) ⇒ Object
Uses method missing to call device actions.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
Uses method missing to call device actions
37 38 39 |
# File 'lib/artoo/adaptors/opencv_capture.rb', line 37 def method_missing(method_name, *arguments, &block) device.send(method_name, *arguments, &block) end |
Instance Attribute Details
#capture ⇒ Object (readonly)
Returns the value of attribute capture.
9 10 11 |
# File 'lib/artoo/adaptors/opencv_capture.rb', line 9 def capture @capture end |
Instance Method Details
#connect ⇒ Boolean
Creates a connection with device
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/artoo/adaptors/opencv_capture.rb', line 18 def connect require 'opencv' unless defined?(::OpenCV) source = additional_params[:source] || "" if source.to_s.empty? @capture = ::OpenCV::CvCapture::open else @capture = ::OpenCV::CvCapture::open source end super end |
#disconnect ⇒ Boolean
Closes connection with device
31 32 33 |
# File 'lib/artoo/adaptors/opencv_capture.rb', line 31 def disconnect super end |
#finalize ⇒ Boolean
Closes connection with device if connected
13 14 |
# File 'lib/artoo/adaptors/opencv_capture.rb', line 13 def finalize end |