irbからOpenCVを叩く

irbを使うとObject.methodsでメソッド一覧も確認できるし、フィルタの効果の確認とかもすぐできるし便利。

irb(main):001:0> require 'opencv';include OpenCV
=> Object
irb(main):002:0> img=CvMat.load("Tulip.jpg")
=> #<OpenCV::CvMat:0x7d2080>
irb(main):003:0> w=GUI::Window.new("w")
=> #<OpenCV::GUI::Window:0x7cb794>
irb(main):004:0> w.show img.BGR2GRAY.canny(100,100)
=> #<OpenCV::GUI::Window:0x7cb794>
irb(main):005:0> GUI::wait_key(99)
=> nil
irb(main):006:0> w.methods
=> [:alive?, :destroy, :resize, :move, :show_image, :show, :set_trackbar, :set_m
ouse_callback, :on_mouse, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :si
ngleton_class, :clone, :dup, :itself, :taint, :tainted?, :untaint, :untrust, :un
trusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_metho
ds, :protected_methods, :private_methods, :public_methods, :instance_variables,
:instance_variable_get, :instance_variable_set, :instance_variable_defined?, :re
move_instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_s
end, :respond_to?, :extend, :display, :method, :public_method, :singleton_method
, :define_singleton_method, :object_id, :to_enum, :enum_for, :==, :equal?, :!, :
!=, :instance_eval, :instance_exec, :__send__, :__id__]

でも、上記で「w.show img」としても、即座にウィンドウ上にimg(画像)は表示されない。
GUI::wait_key(99)とかをコールしてやると初めて表示される。
(VS10版opencv2.4.11/mswin版ruby2.2で確認。他の環境でも同様かは未確認)