ropencv 0.0.19 → 0.0.20
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.
- checksums.yaml +4 -4
- data/ext/helper.rb +9 -10
- data/ext/rbind.rb +14 -4
- data/ropencv.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d80992cd488fc9da556eafc91ec379f008232224
|
4
|
+
data.tar.gz: 560a506ffc0a3f10e3738fb951cebea84ddc175b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63b6394bb116af88eb33061789eac7bf13510b1f9ba22d24b8a147eb76c7fae5b24c2dae1a6586910d0a7fd6dae1259a31ce9e22a768f916c413cc8e7c96e152
|
7
|
+
data.tar.gz: d9eec5dfc196d4f77dc106c21c1de14bdbd49022889bf0b23ab62d8c2ce90eb6b4ac9c97d1bf0070fba5431ed67852276ab2aa8a6caa8e7e8fb5d8e36d549692
|
data/ext/helper.rb
CHANGED
@@ -91,14 +91,13 @@ def find_opencv
|
|
91
91
|
|
92
92
|
#check opencv version
|
93
93
|
out = IO.popen("pkg-config --modversion opencv")
|
94
|
-
|
95
|
-
|
96
|
-
major = $1.to_i
|
97
|
-
minor1 = $2.to_i
|
98
|
-
minor2= $3.to_i
|
94
|
+
out.read.chomp =~ /(\d+).(\d+).(\d+)/
|
95
|
+
major = $1.to_i; minor = $2.to_i; revision = $3.to_i
|
99
96
|
|
100
97
|
##add opencv headers
|
101
|
-
headers = if major
|
98
|
+
headers = if major < 1 || (major == 2 && minor <= 4 && revision<= 3)
|
99
|
+
raise "OpenCV version #{opencv_version} is not supported. At least OpenCV 2.4.4 is required"
|
100
|
+
elsif major == 2
|
102
101
|
["opencv2/core/core_c.h", "opencv2/core/types_c.h",
|
103
102
|
"opencv2/core/core.hpp", "opencv2/flann/miniflann.hpp",
|
104
103
|
"opencv2/imgproc/imgproc_c.h", "opencv2/imgproc/types_c.h",
|
@@ -110,7 +109,7 @@ def find_opencv
|
|
110
109
|
"opencv2/highgui/highgui_c.h", "opencv2/highgui/highgui.hpp",
|
111
110
|
"opencv2/contrib/contrib.hpp", "opencv2/nonfree/nonfree.hpp",
|
112
111
|
"opencv2/nonfree/features2d.hpp"]
|
113
|
-
elsif major
|
112
|
+
elsif major == 3
|
114
113
|
["opencv2/core.hpp", "opencv2/core/base.hpp", "opencv2/core/mat.hpp", "opencv2/core/ocl.hpp",
|
115
114
|
"opencv2/core/opengl.hpp", "opencv2/core/optim.hpp", "opencv2/core/persistence.hpp", "opencv2/core/types.hpp",
|
116
115
|
"opencv2/core/utility.hpp", "opencv2/imgproc.hpp", "opencv2/imgcodecs.hpp", "opencv2/videoio.hpp",
|
@@ -121,8 +120,9 @@ def find_opencv
|
|
121
120
|
"opencv2/stitching/detail/seam_finders.hpp", "opencv2/stitching/detail/timelapsers.hpp", "opencv2/videostab/motion_core.hpp",
|
122
121
|
"opencv2/viz/types.hpp", "opencv2/viz/widgets.hpp"]
|
123
122
|
else
|
124
|
-
raise "OpenCV version #{opencv_version} is not supported"
|
123
|
+
raise "OpenCV version #{opencv_version} is currently not supported"
|
125
124
|
end
|
125
|
+
|
126
126
|
temp = paths.clone
|
127
127
|
temp.each do |path|
|
128
128
|
if path =~ /(.*)opencv$/
|
@@ -145,6 +145,5 @@ def find_opencv
|
|
145
145
|
nil
|
146
146
|
end
|
147
147
|
end.compact
|
148
|
-
|
149
|
-
[opencv_version,headers]
|
148
|
+
[major,minor,revision,headers]
|
150
149
|
end
|
data/ext/rbind.rb
CHANGED
@@ -3,7 +3,9 @@ require 'pp'
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
require File.join(File.dirname(__FILE__),'helper.rb')
|
6
|
-
|
6
|
+
major,minor,revision,opencv_headers = find_opencv
|
7
|
+
opencv_version = "#{major}.#{minor}.#{revision}"
|
8
|
+
Rbind.log.warn "found opencv #{opencv_version}"
|
7
9
|
|
8
10
|
rbind = Rbind::Rbind.new("OpenCV")
|
9
11
|
rbind.pkg_config << "opencv"
|
@@ -19,7 +21,7 @@ end
|
|
19
21
|
|
20
22
|
# add some templates and alias
|
21
23
|
rbind.parser.type_alias["const_c_string"] = rbind.c_string.to_const
|
22
|
-
if
|
24
|
+
if major >= 3
|
23
25
|
rbind.add_std_types
|
24
26
|
rbind.parser.add_type OpenCVPtr2.new
|
25
27
|
rbind.cv.add_type(Rbind::RClass.new("ShapeTransformer"))
|
@@ -45,7 +47,7 @@ rbind.parse_headers
|
|
45
47
|
rbind.parse File.join(File.dirname(__FILE__),"post_opencv244.txt")
|
46
48
|
|
47
49
|
# post parsing + patching wrong signatures
|
48
|
-
if
|
50
|
+
if major == 2 && minor == 4 && revision>= 9
|
49
51
|
rbind.parse File.join(File.dirname(__FILE__),"post_opencv249.txt")
|
50
52
|
|
51
53
|
rbind.cv.calcOpticalFlowSF[0].parameter(0).remove_const!
|
@@ -67,7 +69,7 @@ if opencv_version >= "2.4.9" && opencv_version < "3.0.0"
|
|
67
69
|
rbind.cv.BRISK.operation("BRISK")[1].parameter(0).remove_const!
|
68
70
|
rbind.cv.BRISK.operation("BRISK")[1].parameter(1).remove_const!
|
69
71
|
rbind.cv.putText.parameter(0).remove_const!
|
70
|
-
elsif
|
72
|
+
elsif major >= 3
|
71
73
|
rbind.parse File.join(File.dirname(__FILE__),"post_opencv249.txt")
|
72
74
|
rbind.parse File.join(File.dirname(__FILE__),"post_opencv300.txt")
|
73
75
|
rbind.cv.randShuffle.parameter(2).remove_const!
|
@@ -130,6 +132,14 @@ Rbind::GeneratorRuby.on_normalize_default_value do |parameter|
|
|
130
132
|
end
|
131
133
|
end
|
132
134
|
|
135
|
+
# add version
|
136
|
+
cmajor = Rbind::RParameter.new(:CV_VERSION_MAJOR,rbind.parser.type("const int"),major)
|
137
|
+
cminor= Rbind::RParameter.new(:CV_VERSION_MINOR,rbind.parser.type("const int"),minor)
|
138
|
+
crevision = Rbind::RParameter.new(:CV_VERSION_REVISION,rbind.parser.type("const int"),revision)
|
139
|
+
rbind.parser.add_const(cmajor)
|
140
|
+
rbind.parser.add_const(cminor)
|
141
|
+
rbind.parser.add_const(crevision)
|
142
|
+
|
133
143
|
# generate files
|
134
144
|
rbind.generator_ruby.file_prefix = "ropencv"
|
135
145
|
rbind.generate(File.join(File.dirname(__FILE__),"src"),File.join(File.dirname(__FILE__),"..","lib","ropencv"))
|
data/ropencv.gemspec
CHANGED