The initial Open Computer Vision library was originally developed by Intel Corporation. Recent development has been headed by Willow Garage, Inc.
OpenCV Sourceforge Project opencv.willowgarage.com/wiki/
Ruby/OpenCV Author's Web Page blueruby.mydns.jp/opencv
OpenCV Ruby Wrapper
First release rubygems, Some OpenCV functions wrapped.
Ruby 1.8.7, 1.9.2 and OpenCV 2.3 are supported.
This library relies on the OpenCV project. The following page shows how to install it:
You can install by cloning this repository:
git clone git://github.com/ser1zw/ruby-opencv.git
Then inside the ruby-opencv folder run:
ruby extconf.rb make make install
You can also add ruby-opencv in your Gemfile:
echo -e "\n"'gem "opencv", :git => "https://github.com/ser1zw/ruby-opencv"' >> Gemfile bundle install # or bundle update
Installing ruby-opencv with all dependencies on Mac OS X using macports
sudo port install ffcall sudo port install opencv
Follow INSTALLATION but use this command when compiling the gem:
ruby extconf.rb --with-opencv-lib=/opt/local/lib --with-opencv-include=/opt/local/include/opencv2 make make install
Installing ffcall might not work (that's because ffcall at the moment can't be compiled on 64bit systems). That's ok.
require "opencv" image = OpenCV::IplImage.load("sample.jpg") window = OpenCV::GUI::Window.new("preview") window.show(image) OpenCV::GUI::wait_key
For more samples, see examples/*.rb
Here is a sample face detection program that doesn't rely on the GUI components. In order for this to work you must copy the OpenCV haarcascades data into a subfolder called data.
#!/usr/bin/env ruby require "opencv" if ARGV.length < 2 puts "Usage: your_app_name source dest" exit end data = "./data/haarcascades/haarcascade_frontalface_alt.xml" detector = OpenCV::CvHaarClassifierCascade::load(data) image = OpenCV::IplImage.load(ARGV) detector.detect_objects(image) do |region| color = OpenCV::CvColor::Blue image.rectangle! region.top_left, region.bottom_right, :color => color end image.save_image(ARGV)
OpenCV 2.3 or later opencv.willowgarage.com/wiki/
ffcall (optional) www.haible.de/bruno/packages-ffcall.html
The BSD Liscense