hornetseye-opencv 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +16 -16
- data/lib/hornetseye-opencv/cvmat.rb +0 -1
- data/lib/hornetseye-opencv/iplimage.rb +27 -0
- data/lib/hornetseye-opencv/node.rb +6 -6
- data/lib/hornetseye_opencv_ext.rb +1 -0
- data/test/tc_hornetseye_opencv.rb +59 -0
- data/test/ts_hornetseye_opencv.rb +18 -0
- metadata +10 -7
data/Rakefile
CHANGED
@@ -7,15 +7,15 @@ require 'rake/loaders/makefile'
|
|
7
7
|
require 'rbconfig'
|
8
8
|
|
9
9
|
PKG_NAME = 'hornetseye-opencv'
|
10
|
-
PKG_VERSION = '0.
|
10
|
+
PKG_VERSION = '0.2.0'
|
11
|
+
CFG = RbConfig::CONFIG
|
11
12
|
CXX = ENV[ 'CXX' ] || 'g++'
|
12
|
-
STRIP = ENV[ 'STRIP' ] || 'strip'
|
13
13
|
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
14
14
|
CC_FILES = FileList[ 'ext/*.cc' ]
|
15
15
|
HH_FILES = FileList[ 'ext/*.hh' ] + FileList[ 'ext/*.tcc' ]
|
16
16
|
TC_FILES = FileList[ 'test/tc_*.rb' ]
|
17
17
|
TS_FILES = FileList[ 'test/ts_*.rb' ]
|
18
|
-
SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}
|
18
|
+
SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}.#{CFG[ 'DLEXT' ]}"
|
19
19
|
PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
|
20
20
|
RB_FILES + CC_FILES + HH_FILES + TS_FILES + TC_FILES
|
21
21
|
BIN_FILES = [ 'README.md', 'COPYING', '.document', SO_FILE ] +
|
@@ -27,17 +27,18 @@ EMAIL = %q{jan@wedesoft.de}
|
|
27
27
|
HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-opencv/}
|
28
28
|
|
29
29
|
OBJ = CC_FILES.ext 'o'
|
30
|
-
$CXXFLAGS =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"-I#{RbConfig::CONFIG[ 'rubyhdrdir' ]}/#{RbConfig::CONFIG[ 'arch' ]}"
|
30
|
+
$CXXFLAGS = "-DNDEBUG #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
|
31
|
+
if CFG[ 'rubyhdrdir' ]
|
32
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'rubyhdrdir' ]} " +
|
33
|
+
"-I#{CFG[ 'rubyhdrdir' ]}/#{CFG[ 'arch' ]}"
|
35
34
|
else
|
36
|
-
$CXXFLAGS = "#{$CXXFLAGS} -I#{
|
35
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'archdir' ]}"
|
37
36
|
end
|
38
|
-
$LIBRUBYARG =
|
39
|
-
|
40
|
-
$
|
37
|
+
$LIBRUBYARG = "-L#{CFG[ 'libdir' ]} #{CFG[ 'LIBRUBYARG' ]} #{CFG[ 'LDFLAGS' ]} " +
|
38
|
+
"#{CFG[ 'SOLIBS' ]} #{CFG[ 'DLDLIBS' ]}"
|
39
|
+
$SITELIBDIR = CFG[ 'sitelibdir' ]
|
40
|
+
$SITEARCHDIR = CFG[ 'sitearchdir' ]
|
41
|
+
$LDSHARED = CFG[ 'LDSHARED' ][ CFG[ 'LDSHARED' ].index( ' ' ) .. -1 ]
|
41
42
|
|
42
43
|
task :default => :all
|
43
44
|
|
@@ -46,7 +47,6 @@ task :all => [ SO_FILE ]
|
|
46
47
|
|
47
48
|
file SO_FILE => OBJ do |t|
|
48
49
|
sh "#{CXX} -shared -o #{t.name} #{OBJ} -lcv -lhighgui -lcvaux -lcxcore -lml #{$LIBRUBYARG}"
|
49
|
-
# sh "#{STRIP} --strip-all #{t.name}"
|
50
50
|
end
|
51
51
|
|
52
52
|
task :test => [ SO_FILE ]
|
@@ -115,7 +115,7 @@ begin
|
|
115
115
|
s.extra_rdoc_files = []
|
116
116
|
s.rdoc_options = %w{--no-private}
|
117
117
|
s.add_dependency %<malloc>, [ '~> 1.1' ]
|
118
|
-
s.add_dependency %<multiarray>, [ '~> 0.
|
118
|
+
s.add_dependency %<multiarray>, [ '~> 0.15' ]
|
119
119
|
s.add_dependency %<opencv>, [ '~> 0.0' ]
|
120
120
|
s.add_development_dependency %q{rake}
|
121
121
|
end
|
@@ -138,7 +138,7 @@ begin
|
|
138
138
|
s.extra_rdoc_files = []
|
139
139
|
s.rdoc_options = %w{--no-private}
|
140
140
|
s.add_dependency %<malloc>, [ '~> 1.1' ]
|
141
|
-
s.add_dependency %<multiarray>, [ '~> 0.
|
141
|
+
s.add_dependency %<multiarray>, [ '~> 0.15' ]
|
142
142
|
s.add_dependency %<opencv>, [ '~> 0.0' ]
|
143
143
|
end
|
144
144
|
GEM_BINARY = "#{PKG_NAME}-#{PKG_VERSION}-#{$BINSPEC.platform}.gem"
|
@@ -171,7 +171,7 @@ rule '.o' => '.cc' do |t|
|
|
171
171
|
end
|
172
172
|
|
173
173
|
file ".depends.mf" do |t|
|
174
|
-
sh "g++ -MM #{
|
174
|
+
sh "g++ -MM #{CC_FILES.join ' '} | " +
|
175
175
|
"sed -e :a -e N -e 's/\\n/\\$/g' -e ta | " +
|
176
176
|
"sed -e 's/ *\\\\\\$ */ /g' -e 's/\\$/\\n/g' | sed -e 's/^/ext\\//' > #{t.name}"
|
177
177
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# hornetseye-opencv - OpenCV integration for Hornetseye
|
2
|
+
# Copyright (C) 2010 Jan Wedekind
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
module OpenCV
|
17
|
+
|
18
|
+
class IplImage
|
19
|
+
|
20
|
+
def to_multiarray
|
21
|
+
to_CvMat.to_multiarray
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
@@ -20,16 +20,16 @@ module Hornetseye
|
|
20
20
|
alias_method :orig_to_cvmat, :to_cvmat
|
21
21
|
|
22
22
|
def to_cvmat
|
23
|
+
data = memorise
|
23
24
|
if typecode < Composite
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
orig_to_cvmat
|
25
|
+
Hornetseye::MultiArray( data.typecode.element_type,
|
26
|
+
data.typecode.num_elements, *data.shape ).
|
27
|
+
new( data.memory ).orig_to_cvmat
|
28
28
|
elsif dimension == 2
|
29
|
-
Hornetseye::MultiArray( typecode, 1, *shape ).new( memory ).
|
29
|
+
Hornetseye::MultiArray( data.typecode, 1, *data.shape ).new( data.memory ).
|
30
30
|
orig_to_cvmat
|
31
31
|
else
|
32
|
-
orig_to_cvmat
|
32
|
+
data.orig_to_cvmat
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# multiarray - Lazy multi-dimensional arrays for Ruby
|
2
|
+
# Copyright (C) 2010 Jan Wedekind
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'test/unit'
|
18
|
+
begin
|
19
|
+
require 'rubygems'
|
20
|
+
rescue LoadError
|
21
|
+
end
|
22
|
+
Kernel::require 'hornetseye_opencv'
|
23
|
+
|
24
|
+
class TC_Hornetseye_OpenCV < Test::Unit::TestCase
|
25
|
+
|
26
|
+
I = Hornetseye::INT
|
27
|
+
X = Hornetseye::SCOMPLEX
|
28
|
+
C = Hornetseye::UBYTERGB
|
29
|
+
|
30
|
+
def M( *args )
|
31
|
+
Hornetseye::MultiArray *args
|
32
|
+
end
|
33
|
+
|
34
|
+
def C( *args )
|
35
|
+
Hornetseye::RGB *args
|
36
|
+
end
|
37
|
+
|
38
|
+
def X( *args )
|
39
|
+
Complex *args
|
40
|
+
end
|
41
|
+
|
42
|
+
def setup
|
43
|
+
@m1 = M( I, 3, 2 )[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
|
44
|
+
@m2 = M( X, 1, 2 )[ [ X( 1, 2 ) ], [ X( 3, 4 ) ] ]
|
45
|
+
@m3 = M( C, 2, 1 )[ [ C( 1, 2, 3 ), C( 4, 5, 6 ) ] ]
|
46
|
+
@m4 = M( I, 4, 1, 1 )[ [ [ 1, 2, 3, 4 ] ] ]
|
47
|
+
end
|
48
|
+
|
49
|
+
def teardown
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_to_cvmat
|
53
|
+
assert_equal @m1, @m1.to_cvmat.to_multiarray
|
54
|
+
assert_equal @m2, @m2.to_cvmat.to_multiarray
|
55
|
+
assert_equal @m3, @m3.to_cvmat.to_multiarray
|
56
|
+
assert_equal @m4, @m4.to_cvmat.to_multiarray
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# multiarray - Lazy multi-dimensional arrays for Ruby
|
3
|
+
# Copyright (C) 2010 Jan Wedekind
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
require 'tc_hornetseye_opencv'
|
18
|
+
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 1
|
8
7
|
- 2
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-20 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -41,8 +41,8 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
segments:
|
43
43
|
- 0
|
44
|
-
-
|
45
|
-
version: "0.
|
44
|
+
- 15
|
45
|
+
version: "0.15"
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- README.md
|
86
86
|
- COPYING
|
87
87
|
- .document
|
88
|
+
- lib/hornetseye-opencv/iplimage.rb
|
88
89
|
- lib/hornetseye-opencv/node.rb
|
89
90
|
- lib/hornetseye-opencv/cvmat.rb
|
90
91
|
- lib/hornetseye_opencv_ext.rb
|
@@ -97,6 +98,8 @@ files:
|
|
97
98
|
- ext/error.hh
|
98
99
|
- ext/node.hh
|
99
100
|
- ext/rubytools.tcc
|
101
|
+
- test/ts_hornetseye_opencv.rb
|
102
|
+
- test/tc_hornetseye_opencv.rb
|
100
103
|
has_rdoc: yard
|
101
104
|
homepage: http://wedesoft.github.com/hornetseye-opencv/
|
102
105
|
licenses: []
|
@@ -130,5 +133,5 @@ rubygems_version: 1.3.7
|
|
130
133
|
signing_key:
|
131
134
|
specification_version: 3
|
132
135
|
summary: OpenCV integration for Hornetseye
|
133
|
-
test_files:
|
134
|
-
|
136
|
+
test_files:
|
137
|
+
- test/tc_hornetseye_opencv.rb
|