hornetseye-opencv 0.1.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.
@@ -0,0 +1,28 @@
1
+ /* HornetsEye - Computer Vision with Ruby
2
+ Copyright (C) 2006, 2007, 2008, 2009, 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
+ #ifndef HORNETSEYE_NODE_HH
17
+ #define HORNETSEYE_NODE_HH
18
+ #include "rubyinc.hh"
19
+
20
+ class Node {
21
+ public:
22
+ static VALUE cRubyClass;
23
+ static VALUE mModule;
24
+ static VALUE registerRubyClass( VALUE module );
25
+ static VALUE wrapToCvMat( VALUE rbSelf );
26
+ };
27
+
28
+ #endif
@@ -0,0 +1,54 @@
1
+ /* HornetsEye - Computer Vision with Ruby
2
+ Copyright (C) 2006, 2007 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
+ #ifndef HORNETSEYE_RUBYINC_HH
17
+ #define HORNETSEYE_RUBYINC_HH
18
+
19
+ #ifdef RSHIFT
20
+ #undef RSHIFT
21
+ #endif
22
+
23
+ #define gettimeofday rubygettimeofday
24
+ #define timezone rubygettimezone
25
+ #include <ruby.h>
26
+ // #include <version.h>
27
+ #undef timezone
28
+ #undef gettimeofday
29
+ #ifdef read
30
+ #undef read
31
+ #endif
32
+ #ifdef write
33
+ #undef write
34
+ #endif
35
+ #ifdef RGB
36
+ #undef RGB
37
+ #endif
38
+
39
+ #ifndef RUBY_VERSION_NUMBER
40
+ #define RUBY_VERSION_NUMBER ( RUBY_VERSION_MAJOR * 10000 + \
41
+ RUBY_VERSION_MINOR * 100 + \
42
+ RUBY_VERSION_TEENY )
43
+ #endif
44
+
45
+ #ifndef RUBY_METHOD_FUNC
46
+ #define RUBY_METHOD_FUNC(func) ((VALUE (*)(ANYARGS))func)
47
+ #endif
48
+
49
+ #ifndef xfree
50
+ #define xfree free
51
+ #endif
52
+
53
+ #endif
54
+
@@ -0,0 +1,33 @@
1
+ /* HornetsEye - Computer Vision with Ruby
2
+ Copyright (C) 2006, 2007 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
+ #ifndef HORNETSEYE_RUBYTOOLS_HH
17
+ #define HORNETSEYE_RUBYTOOLS_HH
18
+
19
+ #include <complex>
20
+ #include "rubyinc.hh"
21
+
22
+ void checkType( VALUE rbValue, VALUE rbClass );
23
+
24
+ void checkStruct( VALUE rbValue, VALUE rbClass );
25
+
26
+ #define dataGetStruct(obj,klass,type,sval) { \
27
+ checkStruct( obj, klass ); \
28
+ Data_Get_Struct( obj, type, sval ); \
29
+ }
30
+
31
+ #include "rubytools.tcc"
32
+
33
+ #endif
@@ -0,0 +1,32 @@
1
+ /* HornetsEye - Computer Vision with Ruby
2
+ Copyright (C) 2006, 2007 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
+ #include <cassert>
17
+ #include "error.hh"
18
+
19
+ inline void checkType( VALUE rbValue, VALUE rbClass )
20
+ {
21
+ ERRORMACRO( rb_funcall( rbValue, rb_intern( "kind_of?" ), 1, rbClass ) ==
22
+ Qtrue, Error, ,
23
+ "Argument must be of class \"" << rb_class2name( rbClass )
24
+ << "\"." );
25
+ }
26
+
27
+ inline void checkStruct( VALUE rbValue, VALUE rbClass )
28
+ {
29
+ Check_Type( rbValue, T_DATA );
30
+ checkType( rbValue, rbClass );
31
+ }
32
+
@@ -0,0 +1,42 @@
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 CvMat
19
+
20
+ alias_method :orig_to_multiarray, :to_multiarray
21
+
22
+ def to_multiarray
23
+ retval = orig_to_multiarray
24
+ case channel
25
+ when 1
26
+ retval.roll[ 0 ]
27
+ when 2
28
+ Hornetseye::MultiArray( Hornetseye::COMPLEX( retval.typecode ),
29
+ width, height ).new retval.memory
30
+ when 3
31
+ # swap rgb!
32
+ Hornetseye::MultiArray( Hornetseye::RGB( retval.typecode ),
33
+ width, height ).new retval.memory
34
+ else
35
+ retval
36
+ end
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
@@ -0,0 +1,39 @@
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 Hornetseye
17
+
18
+ class Node
19
+
20
+ alias_method :orig_to_cvmat, :to_cvmat
21
+
22
+ def to_cvmat
23
+ if typecode < Composite
24
+ # swap RGB!
25
+ Hornetseye::MultiArray( typecode.element_type,
26
+ typecode.num_elements, *shape ).new( memory ).
27
+ orig_to_cvmat
28
+ elsif dimension == 2
29
+ Hornetseye::MultiArray( typecode, 1, *shape ).new( memory ).
30
+ orig_to_cvmat
31
+ else
32
+ orig_to_cvmat
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
@@ -0,0 +1,18 @@
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
+ require 'hornetseye-opencv/cvmat'
17
+ require 'hornetseye-opencv/node'
18
+
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hornetseye-opencv
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Jan Wedekind
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-12 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: malloc
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 1
31
+ version: "1.1"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: multiarray
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 10
45
+ version: "0.10"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ type: :development
60
+ version_requirements: *id003
61
+ description: This Ruby extension provides conversions from Hornetseye::MultiArray to OpenCV::CvMat and vice versa.
62
+ email: jan@wedesoft.de
63
+ executables: []
64
+
65
+ extensions:
66
+ - Rakefile
67
+ extra_rdoc_files: []
68
+
69
+ files:
70
+ - Rakefile
71
+ - README.md
72
+ - COPYING
73
+ - .document
74
+ - lib/hornetseye-opencv/node.rb
75
+ - lib/hornetseye-opencv/cvmat.rb
76
+ - lib/hornetseye_opencv_ext.rb
77
+ - ext/init.cc
78
+ - ext/node.cc
79
+ - ext/cvmat.cc
80
+ - ext/rubytools.hh
81
+ - ext/cvmat.hh
82
+ - ext/rubyinc.hh
83
+ - ext/error.hh
84
+ - ext/node.hh
85
+ - ext/rubytools.tcc
86
+ has_rdoc: yard
87
+ homepage: http://wedesoft.github.com/hornetseye-opencv/
88
+ licenses: []
89
+
90
+ post_install_message:
91
+ rdoc_options:
92
+ - --no-private
93
+ require_paths:
94
+ - lib
95
+ - ext
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ requirements: []
113
+
114
+ rubyforge_project: hornetseye
115
+ rubygems_version: 1.3.7
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: OpenCV integration for Hornetseye
119
+ test_files: []
120
+