heavysixer / ruby-opencv forked from bantic/ruby-opencv

Versioned fork of the OpenCV gem for Ruby

This URL has Read+Write access

name age message
file .gitignore Sun Mar 15 17:34:42 -0700 2009 minor change [bantic]
file CHANGELOG Sun Feb 08 08:13:44 -0800 2009 update CHANGELOG [Adam Beguelin]
file License.txt Tue Aug 19 08:01:28 -0700 2008 Initial commit, with some minor changes from or... [ryanfb]
file README.rdoc Sun Mar 22 17:02:13 -0700 2009 added link to ruby-opencv docs [bantic]
file Rakefile Sun Feb 08 08:25:21 -0800 2009 update rakefile to ignore .o files [Adam Beguelin]
directory examples/ Thu Mar 05 16:32:13 -0800 2009 Remove unnecesary "gem" calls in examples [bantic]
directory ext/ Thu Mar 05 16:35:00 -0800 2009 Why were we hardcoding a return value of nil in... [bantic]
directory images/ Tue Aug 19 08:08:07 -0700 2008 Unflip binary files [ryanfb]
directory lib/ Sun Feb 08 08:25:21 -0800 2009 update rakefile to ignore .o files [Adam Beguelin]
file metadata Tue Aug 19 08:01:28 -0700 2008 Initial commit, with some minor changes from or... [ryanfb]
file ruby-opencv.gemspec Sun Mar 15 19:10:24 -0700 2009 bump gemspec version [bantic]
directory setup/ Tue Aug 19 08:01:28 -0700 2008 Initial commit, with some minor changes from or... [ryanfb]
directory test/ Tue Aug 19 08:01:28 -0700 2008 Initial commit, with some minor changes from or... [ryanfb]
README.rdoc

opencv

OpenCV Sourceforge Project sourceforge.net/projects/opencvlibrary/

Ruby/OpenCV Author’s Web Page blueruby.mydns.jp/opencv

DESCRIPTION:

OpenCV Ruby Wrapper

FEATURES/PROBLEMS:

  • First release rubygems, Some OpenCV function wrapped.
  • Use of Carbon windows on Mac OS X is a little buggy, especially when called from the command line.
  • Mouse interaction often causes segfaults on my Mac OS X (ruby 1.8.7).
  • Sadly, use of X Windows as an alternative on Mac OS X is similarly buggy.

REQUIREMENTS:

INSTALLATION INSTRUCTIONS

  • OpenCV is a requirement. Unfortunately there’s a bug in the code that affects our ability to use Carbon windows, so we can’t install from a port. We’ll have to install from source.
  • First, these are the dependencies we’ll need:
 * atk
 * pango
 * jpeg
 * tiff
 * libpng
 * pkgconfig
 * gtk2
 * glib2
 * ffcall
  • Use ports to install them:
 $ sudo port install atk
 $ sudo port install glib2
 $ sudo port install pango
 $ sudo port install jpeg
 $ sudo port install tiff
 $ sudo port install libpng
 $ sudo port install pkgconfig
 $ sudo port install gtk2
 $ sudo port install ffcall
  • Ports is going to install them in /opt/local, which is where this gem will go looking for ffcall, so that will work well for us.
  • Next, download version 1.1pre1 of the opencv-linux package here: sourceforge.net/project/showfiles.php?group_id=22870
  • Navigate to where you downloaded it and:
 tar xzvf opencv-1.1pre1.tar.gz
 cd opencv-1.1.0/
  • Important: Before we configure and build, we need to fix a small bug in the code. Open up the file otherlibs/highgui/window_carbon.cpp in a text editor and make this change to line 645:
 return NULL;

should be changed to

 return result;

(This bug is tracked in sourceforge here: sourceforge.net/tracker/index.php?func=detail&aid=2668857&group_id=22870&atid=376677)

  • Now save the file, and we can run configure:
 ./configure --with-carbon=yes CPPFLAGS="-I/opt/local/include -I/usr/include/malloc" LDFLAGS=-L/opt/local/lib

After configure runs, it will print out a display showing which libraries are in use. Double-check that the windowing system is using "Carbon/Mac OS X" and not gtk.

  • Finish installing:
 make
 sudo make install

The last of the output from the install command will probably complain about not being able to find ldconfig. That’s fine. You’re on a Mac; you don’t need ldconfig (macosx.com/forums/mac-os-x-system-mac-software/5200-ldconfig.html).

  • Now install the gem
 sudo gem install bantic-ruby-opencv
  • Check your work:
 $ irb
 irb> require 'rubygems'
 => true
 irb> require 'opencv'
 => true

SYNOPSIS:

# Show image via GUI Window.

 require "rubygems"
 require "opencv"

 image = OpenCV::IplImage.load("sample.jpg")
 window = OpenCV::GUI::Window.new("preview")
 window.show(image)
 OpenCV::GUI::wait_key

# other sample code, see examples/*.rb

Documentation is available here: doc.blueruby.mydns.jp/opencv/

LICENSE:

The BSD Liscense

see LICENSE.txt