The last release of the opencv gem was on July 25th, 2009: rubygems.org/gems/opencv/versions/0.0.7
Please use an alternative OpenCV wrapper, such as ruby-opencv: github.com/ruby-opencv/ruby-opencv/
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/
Sourceforge sourceforge.net/projects/opencvlibrary/
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.2 are supported.
Mouse interaction often causes segfaults on my Ubuntu 10.10 (Ruby 1.9.2).
This library relies on the OpenCV project. The following page shows how to install it:
opencv.willowgarage.com/wiki/InstallGuide
You can install by cloning this repository:
git clone git://github.com/ser1zw/ruby-opencv.git
Then inside the ruby-opencv folder run:
rakeinstall_gem
You can also add ruby-opencv in your Gemfile:
echo -e "\n"'gem "opencv", :git => "https://github.com/pcting/ruby-opencv"' >> Gemfile bundle install # or bundle update
Once installed it is possible to show images via GUI Window.
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 rubyrequire"opencv"ifARGV.length<2puts"Usage: your_app_name source dest"exitenddata = "./data/haarcascades/haarcascade_frontalface_alt.xml"detector = OpenCV::CvHaarClassifierCascade::load(data) image = OpenCV::IplImage.load(ARGV[0]) detector.detect_objects(image) do|region|color = OpenCV::CvColor::Blueimage.rectangle!region.top_left, region.bottom_right, :color=>colorendimage.save_image(ARGV[1])
OpenCV 2.2 or later opencv.willowgarage.com/wiki/
ffcall (optional) www.haible.de/bruno/packages-ffcall.html
The BSD Liscense
see LICENSE.txt