我需要编写一个简单的项目,我正在使用 opencv、ruby 和 mac。我已经通过 brew 安装了 opencv,并通过 gem install 安装了 rb_webcam。
# -*- coding: utf-8 -*-
require "opencv"
require "rb_webcam"
capture = Webcam.new
此代码抛出
$ ruby tracking.rb
/Users/evilgeniuz/.rvm/gems/ruby-1.9.3-p125/gems/nice-ffi-0.4/lib/nice-ffi/library.rb:98:in `load_library': Could not load highgui. (LoadError)
from /Users/evilgeniuz/.rvm/gems/ruby-1.9.3-p125/gems/rb_webcam-0.3.0/lib/rb_webcam.rb:7:in `<module:Highgui>'
from /Users/evilgeniuz/.rvm/gems/ruby-1.9.3-p125/gems/rb_webcam-0.3.0/lib/rb_webcam.rb:4:in `<top (required)>'
from /Users/evilgeniuz/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /Users/evilgeniuz/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /Users/evilgeniuz/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from tracking.rb:4:in `<main>'
我不知道我怎么能指出 highgui 在哪里。
UPD:通过从这里下载 gem 解决它https://github.com/TyounanMOTI/rb_webcam并手动构建和安装它。