Class: Artoo::Drivers::OpencvWindow
- Inherits:
-
Driver
- Object
- Driver
- Artoo::Drivers::OpencvWindow
- Defined in:
- lib/artoo/drivers/opencv_window.rb
Constant Summary collapse
- COMMANDS =
[:image=].freeze
Instance Attribute Summary collapse
-
#image ⇒ Object
Returns the value of attribute image.
-
#window ⇒ Object
Returns the value of attribute window.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ OpencvWindow
constructor
A new instance of OpencvWindow.
- #show_image ⇒ Object
-
#start_driver ⇒ Object
Start driver and any required connections.
Constructor Details
#initialize(params = {}) ⇒ OpencvWindow
Returns a new instance of OpencvWindow.
12 13 14 15 16 |
# File 'lib/artoo/drivers/opencv_window.rb', line 12 def initialize(params={}) super title = additional_params[:title] || "" @window = ::OpenCV::GUI::Window.new(title,2) end |
Instance Attribute Details
#image ⇒ Object
Returns the value of attribute image.
10 11 12 |
# File 'lib/artoo/drivers/opencv_window.rb', line 10 def image @image end |
#window ⇒ Object
Returns the value of attribute window.
10 11 12 |
# File 'lib/artoo/drivers/opencv_window.rb', line 10 def window @window end |
Instance Method Details
#show_image ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/artoo/drivers/opencv_window.rb', line 32 def show_image begin window.show @image if !@image.nil? ::OpenCV::GUI::wait_key(1) rescue Exception => e Logger.error e. end end |
#start_driver ⇒ Object
Start driver and any required connections
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/artoo/drivers/opencv_window.rb', line 19 def start_driver begin every(interval) do show_image end super rescue Exception => e Logger.error "Error starting Opencv driver!" Logger.error e. Logger.error e.backtrace.inspect end end |