ropencv 0.0.18 → 0.0.19
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/examples/match_keypoints.rb +4 -4
- data/examples/video2images.rb +14 -0
- data/ext/helper.rb +16 -29
- data/ext/rbind.rb +46 -28
- data/ext/src/CMakeLists.txt +7 -20
- data/ext/src/cmake/FindRuby.cmake +15 -8
- data/lib/ropencv/ropencv_ruby.rb +2 -2
- data/ropencv.gemspec +3 -3
- metadata +5 -7
- data/ext/src/cmake/FindGem.cmake +0 -155
- data/ext/src/rbind.pc.in +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1650b14ec2a2ce44837bf1975ecdd677c4bae996
|
4
|
+
data.tar.gz: 0ffe7a2c605e9ade443040e70a307fc17a16de78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bae2f59f42f6ae007c8cfe7e7b19de02e73ece1c5c47ff6a073192333b4fc5d31dbf2236355990a9f45940757ffee25174c8057f9c7821e567d46960bc92b28
|
7
|
+
data.tar.gz: c1d4d40884066d282ef9325cd5c1aea5d9fa8bb9b10da7d3b6e3b716b66ced06849884fd4bf2f8d04a0a18821cffa48dc8af2ebea30074ea453c5faba01ecfce
|
data/examples/match_keypoints.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'ropencv'
|
2
2
|
include OpenCV
|
3
3
|
|
4
|
-
img1 = cv::imread(File.join('data','tsukuba_l.png'),
|
5
|
-
img2 = cv::imread(File.join('data','tsukuba_r.png'),
|
4
|
+
img1 = cv::imread(File.join('data','tsukuba_l.png'),cv::IMREAD_GRAYSCALE)
|
5
|
+
img2 = cv::imread(File.join('data','tsukuba_r.png'),cv::IMREAD_GRAYSCALE)
|
6
6
|
if (img1.empty() || img2.empty())
|
7
7
|
puts("Can't read one of the images\n")
|
8
8
|
return -1
|
@@ -10,12 +10,12 @@ end
|
|
10
10
|
|
11
11
|
keypoints1=Vector.new(cv::KeyPoint)
|
12
12
|
keypoints2=Vector.new(cv::KeyPoint)
|
13
|
-
detector = cv::
|
13
|
+
detector = cv::FastFeatureDetector::create
|
14
14
|
detector.detect(img1, keypoints1)
|
15
15
|
detector.detect(img2, keypoints2)
|
16
16
|
|
17
17
|
# computing descriptors
|
18
|
-
extractor=cv::
|
18
|
+
extractor = cv::ORB.create
|
19
19
|
descriptors2=cv::Mat.new(3, 4, cv::CV_64FC1)
|
20
20
|
descriptors1=cv::Mat.new(3, 4, cv::CV_64FC1)
|
21
21
|
extractor.compute(img1, keypoints1, descriptors1)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# writes a video as single images"
|
2
|
+
|
3
|
+
require 'ropencv'
|
4
|
+
include OpenCV
|
5
|
+
|
6
|
+
video_file = cv::VideoCapture.new(ARGV[0])
|
7
|
+
frame = cv::Mat.new
|
8
|
+
id = 0
|
9
|
+
puts "writing video as single images"
|
10
|
+
while video_file.read(frame)
|
11
|
+
cv::imwrite "name_#{"%05d" % id}.png",frame
|
12
|
+
id+=1
|
13
|
+
end
|
14
|
+
puts "all done"
|
data/ext/helper.rb
CHANGED
@@ -92,9 +92,13 @@ def find_opencv
|
|
92
92
|
#check opencv version
|
93
93
|
out = IO.popen("pkg-config --modversion opencv")
|
94
94
|
opencv_version = out.read.chomp
|
95
|
+
opencv_version =~ /(\d+).(\d+).(\d+)/
|
96
|
+
major = $1.to_i
|
97
|
+
minor1 = $2.to_i
|
98
|
+
minor2= $3.to_i
|
95
99
|
|
96
100
|
##add opencv headers
|
97
|
-
headers = if
|
101
|
+
headers = if major >= 2 && major < 3
|
98
102
|
["opencv2/core/core_c.h", "opencv2/core/types_c.h",
|
99
103
|
"opencv2/core/core.hpp", "opencv2/flann/miniflann.hpp",
|
100
104
|
"opencv2/imgproc/imgproc_c.h", "opencv2/imgproc/types_c.h",
|
@@ -106,36 +110,19 @@ def find_opencv
|
|
106
110
|
"opencv2/highgui/highgui_c.h", "opencv2/highgui/highgui.hpp",
|
107
111
|
"opencv2/contrib/contrib.hpp", "opencv2/nonfree/nonfree.hpp",
|
108
112
|
"opencv2/nonfree/features2d.hpp"]
|
109
|
-
elsif
|
110
|
-
["opencv2/core.hpp", "opencv2/core/
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
"opencv2/video.hpp", "opencv2/legacy.hpp","opencv2/video/tracking.hpp",
|
120
|
-
"opencv2/video/background_segm.hpp",
|
121
|
-
"opencv2/videostab.hpp"]
|
122
|
-
elsif opencv_version >= "3.0.0"
|
123
|
-
["opencv2/core.hpp", "opencv2/core/types.hpp","opencv2/core/persistence.hpp",
|
124
|
-
"opencv2/core/utility.hpp", "opencv2/core/base.hpp","opencv2/core/core.hpp",
|
125
|
-
"opencv2/contrib/contrib.hpp", "opencv2/calib3d.hpp",
|
126
|
-
"opencv2/features2d.hpp", "opencv2/flann.hpp",
|
127
|
-
"opencv2/highgui.hpp", "opencv2/imgproc.hpp",
|
128
|
-
"opencv2/ml.hpp", "opencv2/nonfree.hpp",
|
129
|
-
"opencv2/nonfree/features2d.hpp", "opencv2/objdetect.hpp",
|
130
|
-
"opencv2/photo.hpp", "opencv2/softcascade/softcascade.hpp",
|
131
|
-
"opencv2/stitching.hpp", "opencv2/superres.hpp",
|
132
|
-
"opencv2/video.hpp", "opencv2/legacy/legacy.hpp","opencv2/video/tracking.hpp",
|
133
|
-
"opencv2/video/background_segm.hpp",
|
134
|
-
"opencv2/videostab.hpp"]
|
113
|
+
elsif major >= 3
|
114
|
+
["opencv2/core.hpp", "opencv2/core/base.hpp", "opencv2/core/mat.hpp", "opencv2/core/ocl.hpp",
|
115
|
+
"opencv2/core/opengl.hpp", "opencv2/core/optim.hpp", "opencv2/core/persistence.hpp", "opencv2/core/types.hpp",
|
116
|
+
"opencv2/core/utility.hpp", "opencv2/imgproc.hpp", "opencv2/imgcodecs.hpp", "opencv2/videoio.hpp",
|
117
|
+
"opencv2/highgui.hpp", "opencv2/video/background_segm.hpp", "opencv2/video/tracking.hpp", "opencv2/flann/miniflann.hpp",
|
118
|
+
"opencv2/ml.hpp", "opencv2/features2d.hpp", "opencv2/calib3d.hpp", "opencv2/objdetect.hpp", "opencv2/photo.hpp",
|
119
|
+
"opencv2/shape/hist_cost.hpp", "opencv2/shape/shape_distance.hpp", "opencv2/shape/shape_transformer.hpp", "opencv2/stitching.hpp",
|
120
|
+
"opencv2/stitching/detail/blenders.hpp", "opencv2/stitching/detail/exposure_compensate.hpp", "opencv2/stitching/detail/motion_estimators.hpp",
|
121
|
+
"opencv2/stitching/detail/seam_finders.hpp", "opencv2/stitching/detail/timelapsers.hpp", "opencv2/videostab/motion_core.hpp",
|
122
|
+
"opencv2/viz/types.hpp", "opencv2/viz/widgets.hpp"]
|
135
123
|
else
|
136
124
|
raise "OpenCV version #{opencv_version} is not supported"
|
137
125
|
end
|
138
|
-
|
139
126
|
temp = paths.clone
|
140
127
|
temp.each do |path|
|
141
128
|
if path =~ /(.*)opencv$/
|
@@ -158,6 +145,6 @@ def find_opencv
|
|
158
145
|
nil
|
159
146
|
end
|
160
147
|
end.compact
|
161
|
-
Rbind.log.
|
148
|
+
Rbind.log.warn "found opencv #{opencv_version}: #{paths[0]}"
|
162
149
|
[opencv_version,headers]
|
163
150
|
end
|
data/ext/rbind.rb
CHANGED
@@ -9,24 +9,32 @@ rbind = Rbind::Rbind.new("OpenCV")
|
|
9
9
|
rbind.pkg_config << "opencv"
|
10
10
|
rbind.includes = opencv_headers
|
11
11
|
|
12
|
+
# add Vec types
|
13
|
+
2.upto(6) do |idx|
|
14
|
+
next if idx == 5
|
15
|
+
rbind.parser.add_type Vec.new("cv::Vec#{idx}d",rbind.double,idx)
|
16
|
+
rbind.parser.add_type Vec.new("cv::Vec#{idx}f",rbind.float,idx)
|
17
|
+
rbind.parser.add_type Vec.new("cv::Vec#{idx}i",rbind.int,idx)
|
18
|
+
end
|
19
|
+
|
12
20
|
# add some templates and alias
|
13
21
|
rbind.parser.type_alias["const_c_string"] = rbind.c_string.to_const
|
14
22
|
if opencv_version >= "3.0.0"
|
15
23
|
rbind.add_std_types
|
16
24
|
rbind.parser.add_type OpenCVPtr2.new
|
25
|
+
rbind.cv.add_type(Rbind::RClass.new("ShapeTransformer"))
|
26
|
+
rbind.cv.add_type(Rbind::RClass.new("Feature2D"))
|
27
|
+
rbind.cv.type_alias["FeatureDetector"] = rbind.cv.Feature2D
|
28
|
+
rbind.cv.type_alias["DescriptorExtractor"] = rbind.cv.Feature2D
|
29
|
+
# add missing enum values
|
30
|
+
rbind.cv.add_type(Rbind::RClass.new("Stitcher"))
|
31
|
+
rbind.cv.Stitcher.add_type(Rbind::REnum.new("Status"))
|
32
|
+
rbind.cv.Stitcher.Status.values = {:OK => 0, :ERR_NEED_MORE_IMGS => 1,:ERR_HOMOGRAPHY_EST_FAIL => 2,:ERR_CAMERA_PARAMS_ADJUST_FAIL => 3}
|
17
33
|
else
|
18
34
|
rbind.add_std_vector
|
19
35
|
rbind.parser.add_type OpenCVPtr.new
|
20
36
|
end
|
21
37
|
|
22
|
-
# add Vec types
|
23
|
-
2.upto(6) do |idx|
|
24
|
-
next if idx == 5
|
25
|
-
rbind.parser.add_type Vec.new("cv::Vec#{idx}d",rbind.double,idx)
|
26
|
-
rbind.parser.add_type Vec.new("cv::Vec#{idx}f",rbind.float,idx)
|
27
|
-
rbind.parser.add_type Vec.new("cv::Vec#{idx}i",rbind.int,idx)
|
28
|
-
end
|
29
|
-
|
30
38
|
# parsing
|
31
39
|
rbind.parse File.join(File.dirname(__FILE__),"pre_opencv244.txt")
|
32
40
|
rbind.parse File.join(File.dirname(__FILE__),"opencv.txt")
|
@@ -39,6 +47,26 @@ rbind.parse File.join(File.dirname(__FILE__),"post_opencv244.txt")
|
|
39
47
|
# post parsing + patching wrong signatures
|
40
48
|
if opencv_version >= "2.4.9" && opencv_version < "3.0.0"
|
41
49
|
rbind.parse File.join(File.dirname(__FILE__),"post_opencv249.txt")
|
50
|
+
|
51
|
+
rbind.cv.calcOpticalFlowSF[0].parameter(0).remove_const!
|
52
|
+
rbind.cv.calcOpticalFlowSF[0].parameter(1).remove_const!
|
53
|
+
rbind.cv.calcOpticalFlowSF[0].parameter(2).remove_const!
|
54
|
+
|
55
|
+
rbind.cv.calcOpticalFlowSF[1].parameter(0).remove_const!
|
56
|
+
rbind.cv.calcOpticalFlowSF[1].parameter(1).remove_const!
|
57
|
+
rbind.cv.calcOpticalFlowSF[1].parameter(2).remove_const!
|
58
|
+
|
59
|
+
rbind.cv.chamerMatching.parameter(0).remove_const!
|
60
|
+
rbind.cv.chamerMatching.parameter(1).remove_const!
|
61
|
+
rbind.cv.chamerMatching.parameter(2).remove_const!
|
62
|
+
|
63
|
+
rbind.cv.CascadeClassifier.detectMultiScale[1].parameter(2).remove_const!
|
64
|
+
rbind.cv.CascadeClassifier.detectMultiScale[1].parameter(3).remove_const!
|
65
|
+
rbind.cv.BRISK.generateKernel.parameter(0).remove_const!
|
66
|
+
rbind.cv.BRISK.generateKernel.parameter(1).remove_const!
|
67
|
+
rbind.cv.BRISK.operation("BRISK")[1].parameter(0).remove_const!
|
68
|
+
rbind.cv.BRISK.operation("BRISK")[1].parameter(1).remove_const!
|
69
|
+
rbind.cv.putText.parameter(0).remove_const!
|
42
70
|
elsif opencv_version >= "3.0.0"
|
43
71
|
rbind.parse File.join(File.dirname(__FILE__),"post_opencv249.txt")
|
44
72
|
rbind.parse File.join(File.dirname(__FILE__),"post_opencv300.txt")
|
@@ -46,28 +74,18 @@ elsif opencv_version >= "3.0.0"
|
|
46
74
|
rbind.cv.AlignExposures.process.parameter(1).remove_const!
|
47
75
|
rbind.cv.AlignMTB.process[0].parameter(1).remove_const!
|
48
76
|
rbind.cv.AlignMTB.process[1].parameter(1).remove_const!
|
49
|
-
|
50
|
-
|
51
|
-
rbind.
|
52
|
-
rbind.cv.
|
53
|
-
rbind.cv.calcOpticalFlowSF[0].parameter(2).remove_const!
|
54
|
-
|
55
|
-
rbind.cv.calcOpticalFlowSF[1].parameter(0).remove_const!
|
56
|
-
rbind.cv.calcOpticalFlowSF[1].parameter(1).remove_const!
|
57
|
-
rbind.cv.calcOpticalFlowSF[1].parameter(2).remove_const!
|
77
|
+
rbind.CvDTreeNode.ignore = true
|
78
|
+
rbind.CvSlice.ignore = true
|
79
|
+
rbind.CvTermCriteria.ignore = true
|
80
|
+
rbind.cv.polyfit.ignore = true
|
58
81
|
|
59
|
-
|
60
|
-
rbind.
|
82
|
+
# is removed on opencv master
|
83
|
+
rbind.ml.StatModel.getParams.ignore = true if(rbind.ml.StatModel.operation?('getParams'))
|
61
84
|
|
62
|
-
|
63
|
-
|
64
|
-
rbind.
|
65
|
-
|
66
|
-
|
67
|
-
rbind.cv.putText.parameter(0).remove_const!
|
68
|
-
rbind.cv.chamerMatching.parameter(0).remove_const!
|
69
|
-
rbind.cv.chamerMatching.parameter(1).remove_const!
|
70
|
-
rbind.cv.chamerMatching.parameter(2).remove_const!
|
85
|
+
# is removed on opencv master
|
86
|
+
# mark none polymorphic class
|
87
|
+
rbind.ml.DTrees.Params.polymorphic = false if(rbind.ml.DTrees.type?("Params"))
|
88
|
+
end
|
71
89
|
|
72
90
|
# add some more vector types
|
73
91
|
rbind.parser.type("std::vector<Point2d>")
|
data/ext/src/CMakeLists.txt
CHANGED
@@ -9,7 +9,6 @@ include_directories(${OPENCV_INCLUDE_DIRS})
|
|
9
9
|
link_directories(${OPENCV_LIBRARY_DIRS})
|
10
10
|
|
11
11
|
|
12
|
-
|
13
12
|
SET(RBIND_SRC
|
14
13
|
"${CMAKE_CURRENT_SOURCE_DIR}/types.cc"
|
15
14
|
"${CMAKE_CURRENT_SOURCE_DIR}/operations.cc"
|
@@ -19,31 +18,19 @@ add_custom_command(OUTPUT ${RBIND_SRC}
|
|
19
18
|
COMMAND ruby "${CMAKE_CURRENT_SOURCE_DIR}/../rbind.rb")
|
20
19
|
|
21
20
|
ADD_LIBRARY(rbind_opencv SHARED ${RBIND_SRC})
|
22
|
-
TARGET_LINK_LIBRARIES(rbind_opencv ${OPENCV_LIBS} ${
|
23
|
-
|
24
|
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rbind.pc.in ${CMAKE_CURRENT_BINARY_DIR}/rbind_opencv.pc @ONLY)
|
21
|
+
TARGET_LINK_LIBRARIES(rbind_opencv ${OPENCV_LIBS} ${OPENCV_LDFLAGS_OTHER} )
|
25
22
|
|
26
23
|
set(ROOT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
27
|
-
|
28
|
-
# local install
|
29
|
-
install(TARGETS rbind_opencv LIBRARY DESTINATION ${ROOT_FOLDER}/lib)
|
30
|
-
install(FILES types.h operations.h conversions.hpp DESTINATION ${ROOT_FOLDER}/include)
|
31
|
-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/extern.rbind DESTINATION ${ROOT_FOLDER}/include)
|
32
|
-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.rbind DESTINATION ${ROOT_FOLDER}/include)
|
33
|
-
else()
|
34
|
-
# global install
|
35
|
-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rbind_opencv.pc DESTINATION lib/pkgconfig)
|
36
|
-
install(TARGETS rbind_opencv LIBRARY DESTINATION lib)
|
37
|
-
install(FILES types.h operations.h conversions.hpp DESTINATION include/${PROJECT_NAME})
|
38
|
-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/extern.rbind DESTINATION include/${PROJECT_NAME})
|
39
|
-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.rbind DESTINATION include/${PROJECT_NAME})
|
24
|
+
install(TARGETS rbind_opencv LIBRARY DESTINATION ${ROOT_FOLDER}/lib/ropencv)
|
40
25
|
|
26
|
+
# global install
|
27
|
+
if(NOT GEM_INSTALL)
|
41
28
|
FIND_PACKAGE(Ruby)
|
42
29
|
IF(NOT RUBY_INCLUDE_PATH)
|
43
30
|
MESSAGE(STATUS "Ruby library not found. Cannot install ruby extensions")
|
44
31
|
ELSE(NOT RUBY_INCLUDE_PATH)
|
45
|
-
STRING(REGEX REPLACE ".*lib(32|64)?/?" "lib/" RUBY_LIBRARY_INSTALL_DIR ${
|
32
|
+
STRING(REGEX REPLACE ".*lib(32|64)?/?" "lib/" RUBY_LIBRARY_INSTALL_DIR ${RUBY_RUBY_LIB_DIR})
|
46
33
|
INSTALL(DIRECTORY ${ROOT_FOLDER}/lib/ DESTINATION ${RUBY_LIBRARY_INSTALL_DIR}
|
47
|
-
FILES_MATCHING PATTERN "*.rb")
|
34
|
+
FILES_MATCHING PATTERN "*.rb" PATTERN "*.rbind" PATTERN "*.so" PATTERN "*.dylib")
|
48
35
|
ENDIF(NOT RUBY_INCLUDE_PATH)
|
49
|
-
|
36
|
+
ENDIF(NOT GEM_INSTALL)
|
@@ -77,6 +77,8 @@ IF(RUBY_EXECUTABLE AND NOT RUBY_MAJOR_VERSION)
|
|
77
77
|
|
78
78
|
EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['rubyhdrdir']"
|
79
79
|
OUTPUT_VARIABLE RUBY_HDR_DIR)
|
80
|
+
EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['rubyarchhdrdir']"
|
81
|
+
OUTPUT_VARIABLE RUBY_ARCH_HDR_DIR)
|
80
82
|
|
81
83
|
EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['libdir']"
|
82
84
|
OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_DIR)
|
@@ -114,6 +116,7 @@ IF(RUBY_EXECUTABLE AND NOT RUBY_MAJOR_VERSION)
|
|
114
116
|
SET(RUBY_VERSION_PATCH ${RUBY_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE)
|
115
117
|
SET(RUBY_ARCH_DIR ${RUBY_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE)
|
116
118
|
SET(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9)" FORCE)
|
119
|
+
SET(RUBY_ARCH_HDR_DIR ${RUBY_ARCH_HDR_DIR} CACHE PATH "The Ruby header dir for architecture-specific files (1.9)" FORCE)
|
117
120
|
SET(RUBY_POSSIBLE_LIB_DIR ${RUBY_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE)
|
118
121
|
SET(RUBY_RUBY_LIB_DIR ${RUBY_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE)
|
119
122
|
SET(RUBY_SITEARCH_DIR ${RUBY_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE)
|
@@ -178,27 +181,26 @@ FIND_PATH(RUBY_INCLUDE_DIR
|
|
178
181
|
NAMES ruby.h
|
179
182
|
HINTS
|
180
183
|
${RUBY_HDR_DIR}
|
181
|
-
${RUBY_ARCH_DIR}
|
182
|
-
|
183
|
-
|
184
|
-
SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} )
|
184
|
+
${RUBY_ARCH_DIR})
|
185
|
+
set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR})
|
185
186
|
|
186
187
|
# if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir
|
187
188
|
IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR)
|
188
|
-
message(STATUS "
|
189
|
+
message(STATUS "FindRuby: looking for config.h")
|
189
190
|
FIND_PATH(RUBY_CONFIG_INCLUDE_DIR
|
190
191
|
NAMES ruby/config.h config.h
|
191
192
|
HINTS
|
192
193
|
${RUBY_HDR_DIR}/${RUBY_ARCH}
|
194
|
+
${RUBY_ARCH_HDR_DIR}
|
193
195
|
${RUBY_ARCH_DIR}
|
194
196
|
)
|
195
197
|
|
196
|
-
|
198
|
+
list(APPEND RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR})
|
197
199
|
ENDIF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR)
|
198
200
|
|
199
201
|
|
200
202
|
# Determine the list of possible names for the ruby library
|
201
|
-
SET(_RUBY_POSSIBLE_LIB_NAMES ruby
|
203
|
+
SET(_RUBY_POSSIBLE_LIB_NAMES ruby${_RUBY_VERSION_SHORT} ${RUBY_RUBY_LIBRARY} ruby ruby-static)
|
202
204
|
|
203
205
|
IF(WIN32)
|
204
206
|
SET( _RUBY_MSVC_RUNTIME "" )
|
@@ -225,7 +227,10 @@ IF(WIN32)
|
|
225
227
|
"msvcrt-ruby${RUBY_NODOT_VERSION}-static" )
|
226
228
|
ENDIF(WIN32)
|
227
229
|
|
228
|
-
FIND_LIBRARY(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} )
|
230
|
+
FIND_LIBRARY(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} NO_DEFAULT_PATH)
|
231
|
+
if(NOT RUBY_LIBRARY)
|
232
|
+
FIND_LIBRARY(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR})
|
233
|
+
endif()
|
229
234
|
|
230
235
|
INCLUDE(FindPackageHandleStandardArgs)
|
231
236
|
SET(_RUBY_REQUIRED_VARS RUBY_EXECUTABLE RUBY_INCLUDE_DIR RUBY_LIBRARY)
|
@@ -236,7 +241,9 @@ ENDIF(_RUBY_VERSION_SHORT_NODOT GREATER 18)
|
|
236
241
|
IF(_RUBY_DEBUG_OUTPUT)
|
237
242
|
MESSAGE(STATUS "--------FindRuby.cmake debug------------")
|
238
243
|
MESSAGE(STATUS "_RUBY_POSSIBLE_EXECUTABLE_NAMES: ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}")
|
244
|
+
MESSAGE(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}")
|
239
245
|
MESSAGE(STATUS "_RUBY_POSSIBLE_LIB_NAMES: ${_RUBY_POSSIBLE_LIB_NAMES}")
|
246
|
+
MESSAGE(STATUS "RUBY_LIBRARY: ${RUBY_LIBRARY}")
|
240
247
|
MESSAGE(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}")
|
241
248
|
MESSAGE(STATUS "RUBY_HDR_DIR: ${RUBY_HDR_DIR}")
|
242
249
|
MESSAGE(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}")
|
data/lib/ropencv/ropencv_ruby.rb
CHANGED
@@ -352,13 +352,13 @@ module OpenCV
|
|
352
352
|
Cv::Mat.new(obj.size,1,Cv::CV_64FC1,obj.data,Cv::Mat::AUTO_STEP).__obj_ptr__
|
353
353
|
elsif obj.is_a?(Array)
|
354
354
|
h,w,e= if obj.first.is_a? Array
|
355
|
-
if obj.find {|array| array.find(Float)}
|
355
|
+
if obj.find {|array| array.find{|o| o.is_a?(Float) }}
|
356
356
|
[obj.size,obj.first.size,obj.first.first.to_f]
|
357
357
|
else
|
358
358
|
[obj.size,obj.first.size,obj.first.first]
|
359
359
|
end
|
360
360
|
else
|
361
|
-
if obj.find(Float)
|
361
|
+
if obj.find{|o| o.is_a?(Float) }
|
362
362
|
[obj.size,1,obj.first.to_f]
|
363
363
|
else
|
364
364
|
[obj.size,1,obj.first]
|
data/ropencv.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'ropencv'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '
|
3
|
+
s.version = '0.0.19'
|
4
|
+
s.date = '2015-03-13'
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.authors = ['Alexander Duda']
|
7
7
|
s.email = ['Alexander.Duda@dfki.de']
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.files = `git ls-files`.split("\n") + ["lib/ropencv/ropencv_types.rb","lib/ropencv/ropencv_ruby.rb"]
|
12
12
|
s.require_path = 'lib'
|
13
13
|
s.required_rubygems_version = ">= 1.3.6"
|
14
|
-
s.add_runtime_dependency "rbind", ">= 0.0.
|
14
|
+
s.add_runtime_dependency "rbind", ">= 0.0.27"
|
15
15
|
s.add_runtime_dependency "ffi", "~> 1.9.0"
|
16
16
|
s.extensions = ['ext/extconf.rb']
|
17
17
|
s.license = 'BSD'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ropencv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Duda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbind
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.27
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.27
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ffi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- examples/hough_circles.rb
|
67
67
|
- examples/match_keypoints.rb
|
68
68
|
- examples/polyfit.rb
|
69
|
+
- examples/video2images.rb
|
69
70
|
- ext/CMakeLists.txt
|
70
71
|
- ext/extconf.rb
|
71
72
|
- ext/helper.rb
|
@@ -78,9 +79,7 @@ files:
|
|
78
79
|
- ext/pre_opencv244.txt
|
79
80
|
- ext/rbind.rb
|
80
81
|
- ext/src/CMakeLists.txt
|
81
|
-
- ext/src/cmake/FindGem.cmake
|
82
82
|
- ext/src/cmake/FindRuby.cmake
|
83
|
-
- ext/src/rbind.pc.in
|
84
83
|
- lib/ropencv.rb
|
85
84
|
- lib/ropencv/ropencv_ruby.rb
|
86
85
|
- manifest.xml
|
@@ -118,4 +117,3 @@ signing_key:
|
|
118
117
|
specification_version: 4
|
119
118
|
summary: Ruby bindings for opencv 2.4.4 and higher
|
120
119
|
test_files: []
|
121
|
-
has_rdoc:
|
data/ext/src/cmake/FindGem.cmake
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
# Author thomas.roehr@dfki.de
|
2
|
-
#
|
3
|
-
# Version 0.3 2013-07-02
|
4
|
-
# - rely on `gem content` to find library and header
|
5
|
-
# - introduce GEM_OS_PKG to allow search via pkgconfig
|
6
|
-
# Version 0.2 2010-01-14
|
7
|
-
# - add support for searching for multiple gems
|
8
|
-
# Version 0.1 2010-12-15
|
9
|
-
# - support basic search functionality
|
10
|
-
# - tested to find rice
|
11
|
-
#
|
12
|
-
# OUTPUT:
|
13
|
-
#
|
14
|
-
# GEM_INCLUDE_DIRS After successful search contains the include directores
|
15
|
-
#
|
16
|
-
# GEM_LIBRARIES After successful search contains the full path of each found library
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# Usage:
|
20
|
-
# set(GEM_DEBUG TRUE)
|
21
|
-
# find_package(Gem COMPONENTS rice hoe)
|
22
|
-
# include_directories(${GEM_INCLUDE_DIRS})
|
23
|
-
# target_link_libraries(${GEM_LIBRARIES}
|
24
|
-
#
|
25
|
-
# in case pkg-config should be used to search for the os pkg, set GEM_OS_PKG, i.e.
|
26
|
-
# set(GEM_OS_PKG TRUE)
|
27
|
-
#
|
28
|
-
# Check for how 'gem' should be called
|
29
|
-
find_program(GEM_EXECUTABLE
|
30
|
-
NAMES "gem${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
|
31
|
-
"gem${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
|
32
|
-
"gem-${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
|
33
|
-
"gem-${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
|
34
|
-
"gem${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}"
|
35
|
-
"gem${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}"
|
36
|
-
"gem-${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}"
|
37
|
-
"gem-${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}"
|
38
|
-
"gem")
|
39
|
-
|
40
|
-
# Making backward compatible
|
41
|
-
if(Gem_DEBUG)
|
42
|
-
set(GEM_DEBUG TRUE)
|
43
|
-
endif()
|
44
|
-
|
45
|
-
if(NOT GEM_EXECUTABLE)
|
46
|
-
MESSAGE(FATAL_ERROR "Could not find the gem executable - install 'gem' first")
|
47
|
-
endif()
|
48
|
-
|
49
|
-
if(NOT Gem_FIND_COMPONENTS)
|
50
|
-
MESSAGE(FATAL_ERROR "If searching for a Gem you have to provide COMPONENTS with the name of the gem")
|
51
|
-
endif()
|
52
|
-
|
53
|
-
set(GEM_FOUND TRUE)
|
54
|
-
foreach(Gem_NAME ${Gem_FIND_COMPONENTS})
|
55
|
-
# If the gem is installed as a gem
|
56
|
-
if(NOT GEM_OS_PKG)
|
57
|
-
set(GEM_HOME ENV{GEM_HOME})
|
58
|
-
|
59
|
-
# Use `gem content <gem-name>` to extract current information about installed gems
|
60
|
-
# Store the information into ${GEM_LOCAL_INFO}
|
61
|
-
EXECUTE_PROCESS(COMMAND ${GEM_EXECUTABLE} content ${Gem_NAME} OUTPUT_VARIABLE GEM_LOCAL_INFO)
|
62
|
-
|
63
|
-
if("${GEM_LOCAL_INFO}" STREQUAL "")
|
64
|
-
MESSAGE(FATAL_ERROR "No local gem found. Check your GEM_HOME setting!")
|
65
|
-
else()
|
66
|
-
set(_library_NAME_PATTERN lib${Gem_NAME}.a
|
67
|
-
lib${Gem_NAME}.so
|
68
|
-
lib${Gem_NAME}.dylib
|
69
|
-
${Gem_NAME}.a
|
70
|
-
${Gem_NAME}.so
|
71
|
-
${Gem_NAME}.dylib
|
72
|
-
.*.a
|
73
|
-
.*.so
|
74
|
-
.*.dylib
|
75
|
-
)
|
76
|
-
|
77
|
-
set(_header_SUFFIX_PATTERN
|
78
|
-
.h
|
79
|
-
.hh
|
80
|
-
.hpp
|
81
|
-
)
|
82
|
-
|
83
|
-
# Create a list from the output results of the gem command
|
84
|
-
string(REPLACE "\n" ";" GEM_CONTENT_LIST ${GEM_LOCAL_INFO})
|
85
|
-
foreach(_gem_CONTENT_PATH ${GEM_CONTENT_LIST})
|
86
|
-
|
87
|
-
# Convert so that only '/' Unix path separator are being using
|
88
|
-
# needed to do proper regex matching
|
89
|
-
FILE(TO_CMAKE_PATH ${_gem_CONTENT_PATH} gem_CONTENT_PATH)
|
90
|
-
|
91
|
-
# Identify library -- checking for a library in the gems 'lib' (sub)directory
|
92
|
-
# Search for an existing library, but only within the gems folder
|
93
|
-
foreach(_library_NAME ${_library_NAME_PATTERN})
|
94
|
-
STRING(REGEX MATCH ".*${Gem_NAME}.*/lib/.*${_library_NAME}$" GEM_PATH_INFO "${gem_CONTENT_PATH}")
|
95
|
-
if(NOT "${GEM_PATH_INFO}" STREQUAL "")
|
96
|
-
list(APPEND GEM_LIBRARIES ${GEM_PATH_INFO})
|
97
|
-
break()
|
98
|
-
endif()
|
99
|
-
endforeach()
|
100
|
-
|
101
|
-
# Identify headers
|
102
|
-
# Checking for available headers in an include directory
|
103
|
-
foreach(_header_PATTERN ${_header_SUFFIX_PATTERN})
|
104
|
-
STRING(REGEX MATCH ".*${Gem_NAME}.*/include/.*${_header_PATTERN}$" GEM_PATH_INFO "${gem_CONTENT_PATH}")
|
105
|
-
if(NOT "${GEM_PATH_INFO}" STREQUAL "")
|
106
|
-
STRING(REGEX REPLACE "(.*${Gem_NAME}.*/include/).*${_header_PATTERN}$" "\\1" GEM_PATH_INFO "${gem_CONTENT_PATH}")
|
107
|
-
list(APPEND GEM_INCLUDE_DIRS ${GEM_PATH_INFO})
|
108
|
-
break()
|
109
|
-
endif()
|
110
|
-
endforeach()
|
111
|
-
endforeach()
|
112
|
-
|
113
|
-
# Compact the lists
|
114
|
-
if(DEFINED GEM_LIBRARIES)
|
115
|
-
LIST(REMOVE_DUPLICATES GEM_LIBRARIES)
|
116
|
-
endif()
|
117
|
-
if(DEFINED GEM_INCLUDE_DIRS)
|
118
|
-
LIST(REMOVE_DUPLICATES GEM_INCLUDE_DIRS)
|
119
|
-
endif()
|
120
|
-
endif()
|
121
|
-
else(NOT GEM_OS_PKG)
|
122
|
-
pkg_check_modules(GEM_PKG ${Gem_NAME})
|
123
|
-
set(GEM_INCLUDE_DIRS ${GEM_PKG_INCLUDE_DIRS})
|
124
|
-
set(GEM_LIBRARIES ${GEM_PKG_LIBRARIES} ${GEM_PKG_STATIC_LIBRARIES})
|
125
|
-
list(APPEND GEM_LIBRARIES ${GEM_PKG_LDFLAGS} ${GEM_PKG_STATIC_LDFLAGS})
|
126
|
-
list(APPEND GEM_LIBRARIES ${GEM_PKG_LDFLAGS_OTHER} ${GEM_PKG_STATIC_LDFLAGS_OTHER})
|
127
|
-
|
128
|
-
if(GEM_DEBUG)
|
129
|
-
message(STATUS "GEM_OS_PKG is defined")
|
130
|
-
message(STATUS "GEM_INCLUDE_DIRS ${GEM_INCLUDE_DIRS}")
|
131
|
-
message(STATUS "GEM_STATIC_LIBRARY_DIRS ${GEM_PKG_STATIC_LIBRARY_DIRS}")
|
132
|
-
message(STATUS "GEM_LIBRARY_DIRS ${GEM_PKG_STATIC_LIBRARY_DIRS}")
|
133
|
-
message(STATUS "GEM_STATIC_LIBRARIES ${GEM_PKG_STATIC_LIBRARIES}")
|
134
|
-
message(STATUS "GEM_LIBRARIES ${GEM_LIBRARIES}")
|
135
|
-
endif()
|
136
|
-
endif()
|
137
|
-
|
138
|
-
if("${GEM_LIBRARIES}" STREQUAL "")
|
139
|
-
set(GEM_FOUND FALSE)
|
140
|
-
else()
|
141
|
-
MESSAGE(STATUS "Gem: ${Gem_NAME} found")
|
142
|
-
endif()
|
143
|
-
|
144
|
-
if(GEM_DEBUG)
|
145
|
-
message(STATUS "${Gem_NAME} library dir: ${GEM_LIBRARIES}")
|
146
|
-
message(STATUS "${Gem_NAME} include dir: ${GEM_INCLUDE_DIRS}")
|
147
|
-
endif()
|
148
|
-
|
149
|
-
if(Gem_FIND_REQUIRED)
|
150
|
-
if(NOT GEM_FOUND)
|
151
|
-
MESSAGE(FATAL_ERROR "Gem: ${Gem_NAME} could not be found")
|
152
|
-
endif()
|
153
|
-
endif()
|
154
|
-
endforeach()
|
155
|
-
|
data/ext/src/rbind.pc.in
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
prefix=@CMAKE_INSTALL_PREFIX@
|
2
|
-
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
3
|
-
libdir=${prefix}/lib
|
4
|
-
includedir=${prefix}/include
|
5
|
-
|
6
|
-
Name: @PROJECT_NAME@
|
7
|
-
Description: @PROJECT_DESCRIPTION@
|
8
|
-
Version: @PROJECT_VERSION@
|
9
|
-
Requires: opencv
|
10
|
-
Libs: -L${libdir} -l@PROJECT_NAME@
|
11
|
-
Cflags: -I${includedir}
|