mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
Merge branch 'develop' into feature/add_FaceRecognizer
Conflicts: Manifest.txt ruby-opencv.gemspec
This commit is contained in:
commit
8fc406e5fd
66 changed files with 269 additions and 161 deletions
|
@ -14,7 +14,6 @@
|
|||
* [hoe](https://github.com/seattlerb/hoe)
|
||||
* [hoe-gemspec](https://github.com/flavorjones/hoe-gemspec)
|
||||
* [rake-compiler](https://github.com/luislavena/rake-compiler)
|
||||
* [gem-compile](https://github.com/frsyuki/gem-compile)
|
||||
|
||||
|
||||
## Create ruby-opencv gem
|
||||
|
@ -32,16 +31,34 @@ $ git ls-files > Manifest.txt
|
|||
$ rake gem:spec
|
||||
$ rake gem
|
||||
```
|
||||
**ruby-opencv-x.y.z.gem** will be created in pkg/ directory.
|
||||
**ruby-opencv-x.y.z.gem** will be created in **pkg** directory.
|
||||
|
||||
To create pre-build binaries, run the following commands in Windows.
|
||||
To create pre-build binaries, create a config file firstly:
|
||||
|
||||
```
|
||||
$ cd pkg
|
||||
$ gem compile ruby-opencv-*.gem
|
||||
```yml
|
||||
# config.yml
|
||||
platform: mingw32
|
||||
rubies:
|
||||
- C:/ruby-1.9.3-p392-mingw32/bin/ruby.exe
|
||||
- C:/ruby-2.0.0-p0-mingw32/bin/ruby.exe
|
||||
extopts:
|
||||
- --with-opencv-include=C:/opencv/build/include
|
||||
- --with-opencv-lib=C:/opencv/build/x86/mingw/lib
|
||||
```
|
||||
|
||||
**ruby-opencv-x.y.z-x86-mingw32.gem** will be created when you use mingw32, or
|
||||
Entries are below:
|
||||
|
||||
- **platform**: Target platform (e.g. mingw32, mswin32)
|
||||
- **rubies**: Array of target versions of ruby's paths (You can create fat gems if you specify multiple versions of ruby)
|
||||
- **extopts**: Array of options to be passed to **extconf.rb**
|
||||
|
||||
Then, run the following command:
|
||||
|
||||
```
|
||||
$ rake gem:precompile CONFIG=config.yml
|
||||
```
|
||||
|
||||
**ruby-opencv-x.y.z-mingw32.gem** will be created when you use mingw32, or
|
||||
**ruby-opencv-x.y.z-x86-mswin32.gem** when you use mswin32.
|
||||
|
||||
|
||||
|
@ -52,7 +69,7 @@ $ gem compile ruby-opencv-*.gem
|
|||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout master
|
||||
$ ruby extconf.rb --with-opencv-dir=/path/to/opencvdir
|
||||
$ ruby ext/opencv/extconf.rb --with-opencv-dir=/path/to/opencvdir
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
@ -68,7 +85,7 @@ Run the following commands on [**Visual Studio Command Prompt**](http://msdn.mic
|
|||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout master
|
||||
$ ruby extconf.rb --with-opencv-dir=C:\path\to\opencvdir\install # for your own built OpenCV library
|
||||
$ ruby ext/opencv/extconf.rb --with-opencv-dir=C:\path\to\opencvdir\install # for your own built OpenCV library
|
||||
$ nmake
|
||||
$ nmake install
|
||||
```
|
||||
|
@ -76,7 +93,7 @@ $ nmake install
|
|||
To use pre-built OpenCV libraries, set the following option to extconf.rb.
|
||||
|
||||
```
|
||||
$ ruby extconf.rb --with-opencv-include=C:\path\to\opencvdir\build\include --with-opencv-lib=C:\path\to\opencvdir\build\x86\vc10\lib
|
||||
$ ruby ext/opencv/extconf.rb --with-opencv-include=C:\path\to\opencvdir\build\include --with-opencv-lib=C:\path\to\opencvdir\build\x86\vc10\lib
|
||||
```
|
||||
|
||||
|
||||
|
@ -88,7 +105,7 @@ Run the following commands on **MSYS console**.
|
|||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout master
|
||||
$ ruby extconf.rb --with-opencv-dir=/C/path/to/opencvdir/install # for your own built OpenCV library
|
||||
$ ruby ext/opencv/extconf.rb --with-opencv-dir=/C/path/to/opencvdir/install # for your own built OpenCV library
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
@ -96,7 +113,7 @@ $ make install
|
|||
To use pre-built OpenCV libraries, set the following option to extconf.rb.
|
||||
|
||||
```
|
||||
$ ruby extconf.rb --with-opencv-include=/c/path/to/opencvdir/build/include --with-opencv-lib=/c/path/to/opencvdir/build/x86/mingw/lib
|
||||
$ ruby ext/opencv/extconf.rb --with-opencv-include=/c/path/to/opencvdir/build/include --with-opencv-lib=/c/path/to/opencvdir/build/x86/mingw/lib
|
||||
```
|
||||
|
||||
|
||||
|
|
3
Gemfile
3
Gemfile
|
@ -1,9 +1,8 @@
|
|||
source :gemcutter
|
||||
source 'https://rubygems.org'
|
||||
|
||||
group :development do
|
||||
gem "hoe"
|
||||
gem "hoe-gemspec"
|
||||
gem "rake-compiler"
|
||||
gem "gem-compile"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
The BSD Liscense
|
||||
The BSD License
|
||||
|
||||
Copyright (c) 2008, Masakazu Yonekura
|
||||
All rights reserved.
|
||||
|
|
11
Manifest.txt
11
Manifest.txt
|
@ -6,6 +6,7 @@ License.txt
|
|||
Manifest.txt
|
||||
README.md
|
||||
Rakefile
|
||||
config.yml
|
||||
examples/alpha_blend.rb
|
||||
examples/box.png
|
||||
examples/box_in_scene.png
|
||||
|
@ -111,15 +112,13 @@ ext/opencv/cvvideowriter.cpp
|
|||
ext/opencv/cvvideowriter.h
|
||||
ext/opencv/eigenfaces.cpp
|
||||
ext/opencv/eigenfaces.h
|
||||
ext/opencv/extconf.rb
|
||||
ext/opencv/gui.cpp
|
||||
ext/opencv/gui.h
|
||||
ext/opencv/iplconvkernel.cpp
|
||||
ext/opencv/iplconvkernel.h
|
||||
ext/opencv/iplimage.cpp
|
||||
ext/opencv/iplimage.h
|
||||
ext/opencv/lib/opencv.rb
|
||||
ext/opencv/lib/opencv/psyched_yaml.rb
|
||||
ext/opencv/lib/opencv/version.rb
|
||||
ext/opencv/mouseevent.cpp
|
||||
ext/opencv/mouseevent.h
|
||||
ext/opencv/opencv.cpp
|
||||
|
@ -130,11 +129,15 @@ ext/opencv/trackbar.cpp
|
|||
ext/opencv/trackbar.h
|
||||
ext/opencv/window.cpp
|
||||
ext/opencv/window.h
|
||||
extconf.rb
|
||||
images/CvMat_sobel.png
|
||||
images/CvMat_sub_rect.png
|
||||
images/CvSeq_relationmap.png
|
||||
images/face_detect_from_lena.jpg
|
||||
lib/opencv.rb
|
||||
lib/opencv/psyched_yaml.rb
|
||||
lib/opencv/version.rb
|
||||
ruby-opencv.gemspec
|
||||
ruby-opencv.gemspec
|
||||
ruby-opencv.gemspec
|
||||
test/helper.rb
|
||||
test/runner.rb
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
An OpenCV wrapper for Ruby.
|
||||
|
||||
* Web site: <https://github.com/ruby-opencv/ruby-opencv>
|
||||
* Ruby 1.8.7, 1.9.3 and OpenCV 2.4.3 are supported.
|
||||
* Ruby 1.9.3, 2.0.0 and OpenCV 2.4.5 are supported.
|
||||
|
||||
## Requirement
|
||||
|
||||
|
|
66
Rakefile
66
Rakefile
|
@ -1,27 +1,36 @@
|
|||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'rubygems'
|
||||
require './ext/opencv/lib/opencv/psyched_yaml'
|
||||
require "rubygems/ext"
|
||||
require "rubygems/installer"
|
||||
require 'hoe'
|
||||
require 'rake/extensiontask'
|
||||
require 'fileutils'
|
||||
require './lib/opencv/psyched_yaml'
|
||||
|
||||
SO_FILE = 'opencv.so'
|
||||
|
||||
Hoe.plugin :gemspec
|
||||
|
||||
hoespec = Hoe.spec 'ruby-opencv' do |s|
|
||||
s.summary = 'OpenCV wrapper for Ruby'
|
||||
s.description = 'ruby-opencv is a wrapper of OpenCV for Ruby. It helps you to write computer vision programs (e.g. detecting faces from pictures) with Ruby.'
|
||||
s.licenses = ['The BSD License']
|
||||
s.developer('lsxi', 'masakazu.yonekura@gmail.com')
|
||||
s.developer('ser1zw', 'azariahsawtikes@gmail.com')
|
||||
s.developer('pcting', 'pcting@gmail.com')
|
||||
|
||||
s.readme_file = 'README.md'
|
||||
s.history_file = 'History.txt'
|
||||
s.spec_extras = { :extensions => ['extconf.rb'] }
|
||||
|
||||
s.spec_extras = { :extensions => ['ext/opencv/extconf.rb'] }
|
||||
|
||||
s.test_globs = ['test/test_*.rb']
|
||||
s.urls = ['https://github.com/ruby-opencv/ruby-opencv/']
|
||||
|
||||
s.extra_dev_deps << ['rake-compiler', '>= 0'] << ['hoe-gemspec']
|
||||
|
||||
Rake::ExtensionTask.new('opencv', spec) do |ext|
|
||||
ext.lib_dir = File.join('lib', 'opencv')
|
||||
ext.lib_dir = 'lib'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,4 +38,53 @@ hoespec.spec.files.delete('.gemtest')
|
|||
|
||||
Rake::Task[:test].prerequisites << :compile
|
||||
|
||||
desc 'Create a pre-compiled gem'
|
||||
task 'gem:precompile' => ['gem'] do
|
||||
tmp_dir = Dir.mktmpdir('tmp', '.')
|
||||
gemfile = Dir.glob("pkg/*.gem")[0]
|
||||
target_dir = File.join(tmp_dir, File.basename(gemfile, '.gem'))
|
||||
|
||||
installer = Gem::Installer.new(gemfile)
|
||||
installer.unpack(target_dir)
|
||||
|
||||
gemspec = installer.spec
|
||||
extension = gemspec.extensions[0]
|
||||
gemspec.extensions.clear
|
||||
|
||||
config = ENV['CONFIG'] ? YAML.load_file(ENV['CONFIG']) : {}
|
||||
rubies = config['rubies'] || [Gem.ruby]
|
||||
args = config['extopts'] || []
|
||||
gemspec.platform = config['platform'] || Gem::Platform::CURRENT
|
||||
|
||||
multi = rubies.size > 1
|
||||
rubies.each { |ruby|
|
||||
lib_dir = 'lib'
|
||||
if multi
|
||||
major, minor, _ = `#{ruby} -e "print RUBY_VERSION"`.chomp.split('.')
|
||||
lib_dir = File.join(lib_dir, [major, minor].join('.'))
|
||||
end
|
||||
|
||||
make_cmd = (`#{ruby} -e "print RUBY_PLATFORM"` =~ /mswin/) ? 'nmake' : 'make'
|
||||
Dir.chdir(target_dir) {
|
||||
cmd = [ruby, extension, *args].join(' ')
|
||||
results = []
|
||||
Gem::Ext::ExtConfBuilder.run(cmd, results)
|
||||
Gem::Ext::ExtConfBuilder.make('', results)
|
||||
|
||||
FileUtils.mkdir_p lib_dir
|
||||
FileUtils.mv SO_FILE, lib_dir
|
||||
sh "#{make_cmd} clean"
|
||||
}
|
||||
|
||||
gemspec.files << File.join(lib_dir, SO_FILE)
|
||||
}
|
||||
|
||||
Dir.chdir(target_dir) {
|
||||
gemfile = Gem::Package.build(gemspec)
|
||||
FileUtils.mv gemfile, File.dirname(__FILE__)
|
||||
}
|
||||
|
||||
FileUtils.rm_rf tmp_dir
|
||||
end
|
||||
|
||||
# vim: syntax=ruby
|
||||
|
|
7
config.yml
Normal file
7
config.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
platform: mingw32
|
||||
rubies:
|
||||
- C:/ruby-1.9.3-p392-mingw32/bin/ruby.exe
|
||||
- C:/ruby-2.0.0-p0-mingw32/bin/ruby.exe
|
||||
extopts:
|
||||
- --with-opencv-include=C:/opencv/build/include
|
||||
- --with-opencv-lib=C:/opencv/build/x86/mingw/lib
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
|
||||
# Alpha blending sample with GUI
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
|
||||
# A Demo Ruby/OpenCV Implementation of SURF
|
||||
# See https://code.ros.org/trac/opencv/browser/tags/2.3.1/opencv/samples/c/find_obj.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
|
||||
# A sample of matching SURF feature points using kd-tree
|
||||
# See http://tech.groups.yahoo.com/group/OpenCV/message/62318
|
||||
|
|
|
@ -187,21 +187,25 @@ VALUE
|
|||
rb_retrieve(VALUE self)
|
||||
{
|
||||
VALUE image = Qnil;
|
||||
IplImage *frame = NULL;
|
||||
try {
|
||||
IplImage *frame = cvRetrieveFrame(CVCAPTURE(self));
|
||||
if (!frame)
|
||||
if (!(frame = cvRetrieveFrame(CVCAPTURE(self)))) {
|
||||
return Qnil;
|
||||
image = cIplImage::new_object(cvSize(frame->width, frame->height),
|
||||
CV_MAKETYPE(CV_8U, frame->nChannels));
|
||||
if (frame->origin == IPL_ORIGIN_TL)
|
||||
}
|
||||
image = cIplImage::new_object(frame->width, frame->height,
|
||||
CV_MAKETYPE(IPL2CV_DEPTH(frame->depth), frame->nChannels));
|
||||
if (frame->origin == IPL_ORIGIN_TL) {
|
||||
cvCopy(frame, CVARR(image));
|
||||
else
|
||||
}
|
||||
else {
|
||||
cvFlip(frame, CVARR(image));
|
||||
}
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
raise_cverror(e);
|
||||
}
|
||||
return image;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -214,17 +218,20 @@ VALUE
|
|||
rb_query(VALUE self)
|
||||
{
|
||||
VALUE image = Qnil;
|
||||
IplImage *frame = NULL;
|
||||
try {
|
||||
IplImage *frame = cvQueryFrame(CVCAPTURE(self));
|
||||
if (!frame)
|
||||
if (!(frame = cvQueryFrame(CVCAPTURE(self)))) {
|
||||
return Qnil;
|
||||
image = cIplImage::new_object(cvSize(frame->width, frame->height),
|
||||
CV_MAKETYPE(CV_8U, frame->nChannels));
|
||||
if (frame->origin == IPL_ORIGIN_TL)
|
||||
}
|
||||
image = cIplImage::new_object(frame->width, frame->height,
|
||||
CV_MAKETYPE(IPL2CV_DEPTH(frame->depth), frame->nChannels));
|
||||
if (frame->origin == IPL_ORIGIN_TL) {
|
||||
cvCopy(frame, CVARR(image));
|
||||
else
|
||||
}
|
||||
else {
|
||||
cvFlip(frame, CVARR(image));
|
||||
}
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
raise_cverror(e);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,22 @@ raise_compatible_typeerror(VALUE object, const char* expected_class_name)
|
|||
rb_obj_classname(object), expected_class_name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates a memory buffer
|
||||
* see cv::fastMalloc()
|
||||
*/
|
||||
void*
|
||||
rbFastMalloc(size_t size)
|
||||
{
|
||||
uchar* udata = (uchar*)xmalloc(size + sizeof(void*) + CV_MALLOC_ALIGN);
|
||||
if(!udata) {
|
||||
rb_raise(rb_eNoMemError, "Failed to allocate memory");
|
||||
}
|
||||
uchar** adata = cv::alignPtr((uchar**)udata + 1, CV_MALLOC_ALIGN);
|
||||
adata[-1] = udata;
|
||||
return adata;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates a memory buffer
|
||||
* When memory allocation is failed, run GC and retry it
|
||||
|
@ -42,26 +58,7 @@ raise_compatible_typeerror(VALUE object, const char* expected_class_name)
|
|||
void*
|
||||
rb_cvAlloc(size_t size)
|
||||
{
|
||||
void* ptr = NULL;
|
||||
try {
|
||||
ptr = cvAlloc(size);
|
||||
}
|
||||
catch(cv::Exception& e) {
|
||||
if (e.code != CV_StsNoMem)
|
||||
rb_raise(rb_eRuntimeError, "%s", e.what());
|
||||
|
||||
rb_gc_start();
|
||||
try {
|
||||
ptr = cvAlloc(size);
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
if (e.code == CV_StsNoMem)
|
||||
rb_raise(rb_eNoMemError, "%s", e.what());
|
||||
else
|
||||
rb_raise(rb_eRuntimeError, "%s", e.what());
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
return rbFastMalloc(size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -69,28 +66,31 @@ rb_cvAlloc(size_t size)
|
|||
* When memory allocation is failed, run GC and retry it
|
||||
*/
|
||||
CvMat*
|
||||
rb_cvCreateMat(int height, int width, int type)
|
||||
rb_cvCreateMat(int rows, int cols, int type)
|
||||
{
|
||||
CvMat* ptr = NULL;
|
||||
CvMat* mat = NULL;
|
||||
try {
|
||||
ptr = cvCreateMat(height, width, type);
|
||||
mat = cvCreateMatHeader(rows, cols, type);
|
||||
if (mat) {
|
||||
// see OpenCV's cvCreateData()
|
||||
size_t step = mat->step;
|
||||
size_t total_size = step * mat->rows + sizeof(int) + CV_MALLOC_ALIGN;
|
||||
|
||||
mat->refcount = (int*)rbFastMalloc(total_size);
|
||||
mat->data.ptr = (uchar*)cvAlignPtr(mat->refcount + 1, CV_MALLOC_ALIGN);
|
||||
*mat->refcount = 1;
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eRuntimeError, "Failed to create mat header");
|
||||
}
|
||||
}
|
||||
catch(cv::Exception& e) {
|
||||
if (e.code != CV_StsNoMem)
|
||||
rb_raise(rb_eRuntimeError, "%s", e.what());
|
||||
|
||||
rb_gc_start();
|
||||
try {
|
||||
ptr = cvCreateMat(height, width, type);
|
||||
if (mat) {
|
||||
cvReleaseMat(&mat);
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
if (e.code == CV_StsNoMem)
|
||||
rb_raise(rb_eNoMemError, "%s", e.what());
|
||||
else
|
||||
rb_raise(rb_eRuntimeError, "%s", e.what());
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
return mat;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -102,23 +102,21 @@ rb_cvCreateImage(CvSize size, int depth, int channels)
|
|||
{
|
||||
IplImage* ptr = NULL;
|
||||
try {
|
||||
ptr = cvCreateImage(size, depth, channels);
|
||||
ptr = cvCreateImageHeader(size, depth, channels);
|
||||
if (ptr) {
|
||||
// see OpenCV's cvCreateData()
|
||||
ptr->imageData = ptr->imageDataOrigin = (char*)rbFastMalloc((size_t)ptr->imageSize);
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eRuntimeError, "Failed to create image header");
|
||||
}
|
||||
}
|
||||
catch(cv::Exception& e) {
|
||||
if (e.code != CV_StsNoMem)
|
||||
rb_raise(rb_eRuntimeError, "%s", e.what());
|
||||
|
||||
rb_gc_start();
|
||||
try {
|
||||
ptr = cvCreateImage(size, depth, channels);
|
||||
if (ptr) {
|
||||
cvReleaseImage(&ptr);
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
if (e.code == CV_StsNoMem)
|
||||
rb_raise(rb_eNoMemError, "%s", e.what());
|
||||
else
|
||||
rb_raise(rb_eRuntimeError, "%s", e.what());
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <ruby.h>
|
||||
#include "opencv2/core/core_c.h"
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/core/internal.hpp"
|
||||
#include "opencv2/imgproc/imgproc_c.h"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
||||
|
|
|
@ -5,14 +5,17 @@ def cv_version_suffix(incdir)
|
|||
major, minor, subminor = nil, nil, nil
|
||||
open("#{incdir}/opencv2/core/version.hpp", 'r') { |f|
|
||||
f.read.lines.each { |line|
|
||||
major = $1.to_s if line =~ /\A#define\s+CV_MAJOR_VERSION\s+(\d+)\s*\Z/
|
||||
minor = $1.to_s if line =~ /\A#define\s+CV_MINOR_VERSION\s+(\d+)\s*\Z/
|
||||
subminor = $1.to_s if line =~ /\A#define\s+CV_SUBMINOR_VERSION\s+(\d+)\s*\Z/
|
||||
major = $1.to_s if line =~ /\A#define\s+(?:CV_VERSION_EPOCH|CV_MAJOR_VERSION)\s+(\d+)\s*\Z/
|
||||
minor = $1.to_s if line =~ /\A#define\s+(?:CV_VERSION_MAJOR|CV_MINOR_VERSION)\s+(\d+)\s*\Z/
|
||||
subminor = $1.to_s if line =~ /\A#define\s+(?:CV_VERSION_MINOR|CV_SUBMINOR_VERSION)\s+(\d+)\s*\Z/
|
||||
}
|
||||
}
|
||||
major + minor + subminor
|
||||
end
|
||||
|
||||
# Quick fix for 2.0.0
|
||||
# @libdir_basename is set to nil and dir_config() sets invalid libdir '${opencv-dir}/' when --with-opencv-dir option passed.
|
||||
@libdir_basename ||= 'lib'
|
||||
incdir, libdir = dir_config("opencv", "/usr/local/include", "/usr/local/lib")
|
||||
dir_config("libxml2", "/usr/include", "/usr/lib")
|
||||
|
||||
|
@ -67,9 +70,14 @@ opencv_headers.each {|header|
|
|||
}
|
||||
have_header("stdarg.h")
|
||||
|
||||
if $warnflags
|
||||
$warnflags.slice!('-Wdeclaration-after-statement')
|
||||
$warnflags.slice!('-Wimplicit-function-declaration')
|
||||
end
|
||||
|
||||
# Quick fix for 1.8.7
|
||||
$CFLAGS << " -I#{File.dirname(__FILE__)}/ext/opencv"
|
||||
|
||||
# Create Makefile
|
||||
create_makefile("opencv", "./ext/opencv")
|
||||
create_makefile('opencv')
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
require (File.dirname(__FILE__) + '/opencv/version')
|
||||
require 'opencv.so'
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
module OpenCV
|
||||
VERSION = '0.0.8'
|
||||
end
|
12
lib/opencv.rb
Executable file
12
lib/opencv.rb
Executable file
|
@ -0,0 +1,12 @@
|
|||
require (File.dirname(__FILE__) + '/opencv/version')
|
||||
|
||||
if RUBY_PLATFORM =~ /mingw|mswin/
|
||||
major, minor, subminor = RUBY_VERSION.split('.')
|
||||
begin
|
||||
require "#{major}.#{minor}/opencv.so"
|
||||
rescue LoadError
|
||||
require 'opencv.so'
|
||||
end
|
||||
else
|
||||
require 'opencv.so'
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
# Psych loader for avoiding loading problem
|
||||
# (borrowed from Bundler 1.1.rc.7 https://github.com/carlhuda/bundler/blob/v1.1.rc.7/lib/bundler/psyched_yaml.rb )
|
||||
#
|
3
lib/opencv/version.rb
Executable file
3
lib/opencv/version.rb
Executable file
|
@ -0,0 +1,3 @@
|
|||
module OpenCV
|
||||
VERSION = '0.0.9'
|
||||
end
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'digest/md5'
|
||||
require 'opencv'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
|
||||
src_testdir = File.dirname(File.expand_path(__FILE__))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'digest/md5'
|
||||
require 'opencv'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- mode: ruby; coding: utf-8-unix -*-
|
||||
# -*- mode: ruby; coding: utf-8 -*-
|
||||
require 'test/unit'
|
||||
require 'opencv'
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue