ropencv 0.0.21 → 0.0.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddadd3f34d029333f0b75d6daf43c9530d9eb3ce
4
- data.tar.gz: 64055d27486efc056af1a403885ab76985351df1
3
+ metadata.gz: d6203505aa5f31b21ee520787dd576ea0180121f
4
+ data.tar.gz: ffd25c6e69b0a2454859b08f7c325dd598e56eb5
5
5
  SHA512:
6
- metadata.gz: 3f9bd2767f57f0181b02b361ebf134efdb3bddc641f8bfacdcd83c9fc93a7f3d199cda1a4ef8f419e1d370145834b541957e2a91860fb2445635c23ef2190232
7
- data.tar.gz: b07b8f0000084df1c053521ec527c4992419f4cb04011d197cf6062cf21aca22427cf7c50230f73a0774ffbc0031afe3928d20c4aba8c178d5dfa3945c5d2e9b
6
+ metadata.gz: f54f387cf82bc8e34bbbfdb37d91903947397340dbe5ac1008ab143e81a08f4be14e8d9bd46ae49d77a5c45b51836f5bbba3266650e95f972e8a8d14f63a6e08
7
+ data.tar.gz: 85318f33655792d822309aaf4805b42e86bd5e3aafb3decb0645be8eb44172f480f70ec7303f8a2aa6b9a126255eeec294a33d18c14ace5f4f6f034b809e0529
@@ -4,7 +4,7 @@ class OpenCVPtr < Rbind::RTemplateClass
4
4
  super
5
5
  end
6
6
 
7
- def specialize(klass,*parameters)
7
+ def specialize(klass,parameters)
8
8
  if parameters.size != 1
9
9
  raise ArgumentError,"OpenCVPtr does only support one template parameter. Got: #{parameters}}"
10
10
  end
@@ -33,14 +33,25 @@ class OpenCVPtr2 < Rbind::RTemplateClass
33
33
  super
34
34
  end
35
35
 
36
- def specialize(klass,*parameters)
36
+ def specialize(klass,parameters)
37
37
  if parameters.size != 1
38
38
  raise ArgumentError,"OpenCVPtr2 does only support one template parameter. Got: #{parameters}}"
39
39
  end
40
40
  ptr_type = parameters.first
41
41
 
42
+ klass.add_operation Rbind::ROperation.new(klass.name,nil)
42
43
  klass.add_operation Rbind::ROperation.new(klass.name,nil,Rbind::RParameter.new("other",klass))
44
+ klass.add_operation Rbind::ROperation.new(klass.name,nil,Rbind::RParameter.new("owner",klass),Rbind::RParameter.new("p",ptr_type.to_ptr))
43
45
  klass.add_operation Rbind::ROperation.new(klass.name,nil,Rbind::RParameter.new("p",ptr_type.to_ptr))
46
+
47
+ # add some magic for casting into parent ptr
48
+ if ptr_type.respond_to? :parent_classes
49
+ ptr_type.parent_classes.each do |k|
50
+ t = type("cv::Ptr<#{k.full_name}>")
51
+ klass.add_operation Rbind::ROperation.new(klass.name,nil,Rbind::RParameter.new("owner",t),Rbind::RParameter.new("p",ptr_type.to_ptr))
52
+ end
53
+ end
54
+
44
55
  klass.add_operation Rbind::ROperation.new("release",type("void"))
45
56
  klass.add_operation Rbind::ROperation.new("reset",type("void"),Rbind::RParameter.new("p",ptr_type.to_ptr))
46
57
  klass.add_operation Rbind::ROperation.new("swap",type("void"),Rbind::RParameter.new("other",klass))
@@ -48,6 +48,12 @@ const cv.CV_MAT_CONT_FLAG_SHIFT 14
48
48
  const cv.CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT)
49
49
  const cv.CV_SUBMAT_FLAG_SHIFT 15
50
50
  const cv.CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT)
51
+ const cv.CV_LOAD_IMAGE_UNCHANGED -1
52
+ const cv.CV_LOAD_IMAGE_GRAYSCALE 0
53
+ const cv.CV_LOAD_IMAGE_COLOR 1
54
+ const cv.CV_LOAD_IMAGE_ANYDEPTH 2
55
+ const cv.CV_LOAD_IMAGE_ANYCOLOR 4
56
+ const cv.CV_LOAD_IMAGE_IGNORE_ORIENTATION 128
51
57
  class cv.Range
52
58
  int start /RW
53
59
  int end /RW
@@ -80,6 +86,8 @@ cv.String.length size_t
80
86
  cv.String.operator[] char
81
87
  size_t idx
82
88
  cv.String.c_str const_c_string
89
+ cv.String.begin char =str_begin
90
+ cv.String.end char =str_end
83
91
  cv.String.empty bool
84
92
  cv.String.clear void
85
93
  cv.String.compare int
@@ -316,6 +324,21 @@ class cv.Mat
316
324
  cv.Mat.Mat
317
325
  cv.Mat.Mat
318
326
  Mat m
327
+ cv.Mat.Mat
328
+ vector_Point vec
329
+ bool copy false
330
+ cv.Mat.Mat
331
+ vector_Point2f vec
332
+ bool copy false
333
+ cv.Mat.Mat
334
+ vector_Point2d vec
335
+ bool copy false
336
+ cv.Mat.Mat
337
+ vector_Point3f vec
338
+ bool copy false
339
+ cv.Mat.Mat
340
+ vector_Point3d vec
341
+ bool copy false
319
342
  cv.Mat.Mat
320
343
  Size size
321
344
  int type
@@ -643,6 +666,10 @@ cv.FileNode.operator>> void =read_string
643
666
  String val /IO
644
667
  cv.FileNode.operator>> void =read_mat
645
668
  Mat val /IO
669
+ cv.FileNode.operator>> void =read_vector_mat
670
+ vector_Mat val /IO
671
+ cv.FileNode.operator>> void =read_vector_string
672
+ vector_String val /IO
646
673
  cv.FileNode.begin FileNodeIterator
647
674
  cv.FileNode.end FileNodeIterator
648
675
  cv.FileNodeIterator.operator++ FileNodeIterator
@@ -19,4 +19,13 @@ cv.abs Mat
19
19
  Mat src
20
20
  cv.sum Mat
21
21
  Mat src
22
-
22
+ cv.norm double
23
+ Point3f pt
24
+ cv.norm double
25
+ Point3d pt
26
+ cv.norm double
27
+ Vec3f vec
28
+ cv.norm double
29
+ Vec3d vec
30
+ cv.FileNode.operator>> void =read_vector_keypoint
31
+ vector_KeyPoint val /IO
@@ -16,4 +16,9 @@ cv.recoverPose int
16
16
  double focal 1.0
17
17
  Point2d pp Point2d(0, 0)
18
18
  Mat mask Mat()/IO; /IO
19
+ class cv.FileStorage
20
+ cv.FileStorage.operator<< FileStorage =write_std_cv_keypoint /O
21
+ vector_KeyPoint val
22
+ cv.FileStorage.operator<< FileStorage =write_std_cv_dmatch /O
23
+ vector_DMatch val
19
24
 
@@ -0,0 +1,8 @@
1
+ cv.FlannBasedMatcher.write void
2
+ FileStorage storage
3
+ cv.FlannBasedMatcher.read void
4
+ FileNode storage /IO
5
+ cv.FileStorage.operator[] FileNode
6
+ String nodename
7
+
8
+
@@ -45,4 +45,4 @@ const cv.CV_WND_PROP_AUTOSIZE 1
45
45
  const cv.CV_WND_PROP_ASPECT_RATIO 2
46
46
  const cv.CV_WND_PROP_OPENGL 3
47
47
  const cv.InputArray.KINDSHIFT 16
48
-
48
+ const cv.DBL_EPSILON Float::EPSILON
@@ -38,13 +38,15 @@ else
38
38
  end
39
39
 
40
40
  # parsing
41
+ rbind.use_namespace rbind.std
41
42
  rbind.parse File.join(File.dirname(__FILE__),"pre_opencv244.txt")
42
43
  rbind.parse File.join(File.dirname(__FILE__),"opencv.txt")
43
44
  rbind.use_namespace rbind.cv
44
- rbind.use_namespace rbind.std
45
45
  rbind.cv.type_alias["string"] = rbind.cv.String
46
46
  rbind.parse_headers
47
47
  rbind.parse File.join(File.dirname(__FILE__),"post_opencv244.txt")
48
+ rbind.cv.String.begin.return_type = rbind.cv.String.begin.return_type.to_const.to_ptr
49
+ rbind.cv.String.end.return_type = rbind.cv.String.end.return_type.to_const.to_ptr
48
50
 
49
51
  # post parsing + patching wrong signatures
50
52
  if major == 2 && minor == 4 && revision>= 9
@@ -72,6 +74,8 @@ if major == 2 && minor == 4 && revision>= 9
72
74
  elsif major >= 3
73
75
  rbind.parse File.join(File.dirname(__FILE__),"post_opencv249.txt")
74
76
  rbind.parse File.join(File.dirname(__FILE__),"post_opencv300.txt")
77
+ rbind.parse File.join(File.dirname(__FILE__),"post_opencv310.txt") if minor >= 1
78
+
75
79
  rbind.cv.randShuffle.parameter(2).remove_const!
76
80
  rbind.cv.AlignExposures.process.parameter(1).remove_const!
77
81
  rbind.cv.AlignMTB.process[0].parameter(1).remove_const!
@@ -8,6 +8,32 @@ add_definitions(${OPENCV_CFLAGS})
8
8
  include_directories(${OPENCV_INCLUDE_DIRS})
9
9
  link_directories(${OPENCV_LIBRARY_DIRS})
10
10
 
11
+
12
+ # use, i.e. don't skip the full RPATH for the build tree
13
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
14
+
15
+ # when building, don't use the install RPATH already
16
+ # (but later on when installing)
17
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
18
+
19
+ # the RPATH to be used when installing
20
+ SET(CMAKE_INSTALL_RPATH ${ROOT_FOLDER}/lib/ropencv)
21
+
22
+ # add the automatically determined parts of the RPATH
23
+ # which point to directories outside the build tree to the insgall RPATH
24
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
25
+
26
+ if(APPLE)
27
+ SET(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_RPATH})
28
+ Set(CMAKE_MACOSX_RPATH ON)
29
+ endif(APPLE)
30
+
31
+ #do not add if system directory
32
+ list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${install_rpath}" isSystemDir)
33
+ if("${isSystemDir}" STREQUAL "-1")
34
+ set(CMAKE_INSTALL_RPATH "${install_rpath}")
35
+ endif()
36
+
11
37
  SET(RBIND_SRC
12
38
  "${CMAKE_CURRENT_SOURCE_DIR}/types.cc"
13
39
  "${CMAKE_CURRENT_SOURCE_DIR}/operations.cc"
@@ -82,7 +82,9 @@ module OpenCV
82
82
  end
83
83
  end
84
84
  def to_s
85
- c_str
85
+ s = size()
86
+ return "" if s == 0
87
+ str_begin.read_string_length(s)
86
88
  end
87
89
  end
88
90
 
@@ -211,8 +213,14 @@ module OpenCV
211
213
  elsif val.is_a?(Float)
212
214
  write_double(val)
213
215
  else
214
- name = val.class.name.split("::").last.downcase
215
- send("write_#{name}",val)
216
+ if val.is_a? Std::Vector::Cv_DMatch
217
+ write_std_cv_dmatch(val)
218
+ elsif val.is_a? Std::Vector::Cv_KeyPoint
219
+ write_std_cv_keypoint(val)
220
+ else
221
+ name = val.class.name.split("::").last.downcase
222
+ send("write_#{name}",val)
223
+ end
216
224
  end
217
225
  end
218
226
 
@@ -274,6 +282,22 @@ module OpenCV
274
282
  val
275
283
  end
276
284
 
285
+ def to_vector_mat
286
+ raise RuntimeError, "FileNode is empty" if empty?
287
+ raise RuntimeError, "FileNode is not storing a vector" unless isSeq
288
+ val = Std::Vector.new(Cv::Mat)
289
+ read_vector_mat(val)
290
+ val
291
+ end
292
+
293
+ def to_vector_string
294
+ raise RuntimeError, "FileNode is empty" if empty?
295
+ raise RuntimeError, "FileNode is not storing a vector" unless isSeq
296
+ val = Std::Vector.new(Cv::String)
297
+ read_vector_string(val)
298
+ val
299
+ end
300
+
277
301
  def to_float
278
302
  raise RuntimeError, "FileNode is empty" if empty?
279
303
  raise RuntimeError, "FileNode is not storing a float" unless isReal
@@ -292,7 +316,7 @@ module OpenCV
292
316
 
293
317
  def to_int
294
318
  raise RuntimeError, "FileNode is empty" if empty?
295
- raise RuntimeError, "FileNode is not storing a double" unless isInt
319
+ raise RuntimeError, "FileNode is not storing an int" unless isInt
296
320
  p = FFI::MemoryPointer.new(:int,1)
297
321
  read_int(p)
298
322
  p.get_int32 0
@@ -306,6 +330,14 @@ module OpenCV
306
330
  str
307
331
  end
308
332
 
333
+ def to_vector_keypoint
334
+ raise RuntimeError, "FileNode is empty" if empty?
335
+ raise RuntimeError, "FileNode is not storing a string" unless isSeq
336
+ val = Std::Vector.new(Cv::KeyPoint)
337
+ read_vector_keypoint(val)
338
+ val
339
+ end
340
+
309
341
  def method_missing(m,*args)
310
342
  if args.empty? && map?
311
343
  self[m.to_s]
@@ -398,12 +430,12 @@ module OpenCV
398
430
  if i.is_a?(Cv::Point)
399
431
  [i.y,i.x]
400
432
  elsif rows == 1
401
- [0,i]
433
+ [0,i.to_i]
402
434
  else
403
- [i,0]
435
+ [i.to_i,0]
404
436
  end
405
437
  else
406
- [i,j]
438
+ [i.to_i,j.to_i]
407
439
  end
408
440
  if i >= rows || i < 0 || j >= cols || j <0
409
441
  raise ArgumentError,"out of bound #{i}/#{j} #{rows}/#{cols}"
@@ -461,17 +493,18 @@ module OpenCV
461
493
  [k,val]
462
494
  end
463
495
  k ||= 0
496
+ k = k.to_i
464
497
  raise ArgumentError,"channel #{k} out of bound" if k >= channels
465
498
  i,j,val = if val == nil
466
499
  if i.is_a?(Cv::Point)
467
500
  [i.y,i.x,j]
468
501
  elsif rows == 1
469
- [0,i,j]
502
+ [0,i.to_i,j]
470
503
  else
471
- [i,0,j]
504
+ [i.to_i,0,j]
472
505
  end
473
506
  else
474
- [i,j,val]
507
+ [i.to_i,j.to_i,val]
475
508
  end
476
509
  if i >= rows || i < 0 || j >= cols || j <0
477
510
  raise ArgumentError,"out of bound #{i}/#{j}"
@@ -505,9 +538,9 @@ module OpenCV
505
538
 
506
539
  def -(val)
507
540
  if val.is_a? Float
508
- Rbind::cv_mat_operator_minus2( self, val)
541
+ Rbind::cv_mat_operator_minus__2( self, val)
509
542
  elsif val.is_a? Fixnum
510
- Rbind::cv_mat_operator_minus3( self, val)
543
+ Rbind::cv_mat_operator_minus__3( self, val)
511
544
  else
512
545
  Rbind::cv_mat_operator_minus( self, val)
513
546
  end
@@ -515,9 +548,9 @@ module OpenCV
515
548
 
516
549
  def +(val)
517
550
  if val.is_a? Float
518
- Rbind::cv_mat_operator_plus2( self, val)
551
+ Rbind::cv_mat_operator_plus__2( self, val)
519
552
  elsif val.is_a? Fixnum
520
- Rbind::cv_mat_operator_plus3( self, val)
553
+ Rbind::cv_mat_operator_plus__3( self, val)
521
554
  else
522
555
  Rbind::cv_mat_operator_plus( self, val)
523
556
  end
@@ -525,9 +558,9 @@ module OpenCV
525
558
 
526
559
  def /(val)
527
560
  if val.is_a? Float
528
- Rbind::cv_mat_operator_div2( self, val)
561
+ Rbind::cv_mat_operator_div__2( self, val)
529
562
  elsif val.is_a? Fixnum
530
- Rbind::cv_mat_operator_div3( self, val)
563
+ Rbind::cv_mat_operator_div__3( self, val)
531
564
  else
532
565
  Rbind::cv_mat_operator_div( self, val)
533
566
  end
@@ -535,9 +568,9 @@ module OpenCV
535
568
 
536
569
  def *(val)
537
570
  if val.is_a? Float
538
- Rbind::cv_mat_operator_mult2( self, val)
571
+ Rbind::cv_mat_operator_mult__2( self, val)
539
572
  elsif val.is_a? Fixnum
540
- Rbind::cv_mat_operator_mult3( self, val)
573
+ Rbind::cv_mat_operator_mult__3( self, val)
541
574
  else
542
575
  Rbind::cv_mat_operator_mult( self, val)
543
576
  end
@@ -7,6 +7,6 @@
7
7
  <url>http://</url>
8
8
  <logo>http://</logo>
9
9
 
10
- <depend package="external/opencv" />
10
+ <depend package="opencv" />
11
11
  <depend package="tools/rbind" />
12
12
  </package>
@@ -1,17 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ropencv'
3
- s.version = '0.0.21'
4
- s.date = '2015-04-14'
3
+ s.version = '0.0.22'
4
+ s.date = '2018-07-10'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Alexander Duda']
7
- s.email = ['Alexander.Duda@dfki.de']
7
+ s.email = ['Alexander.Duda@me.com']
8
8
  s.homepage = 'http://www.ropencv.aduda.eu'
9
9
  s.summary = 'Ruby bindings for opencv 2.4.4 and higher'
10
10
  s.description = 'ROpenCV is a ffi ruby binding for the Open Source Computer Vision Library OpenCV 2.4.4 and higher'
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.27"
14
+ s.add_runtime_dependency "rbind", ">= 0.0.28"
15
15
  s.add_runtime_dependency "ffi", "~> 1.9.0"
16
16
  s.add_development_dependency 'minitest', '~> 5.5'
17
17
  s.extensions = ['ext/extconf.rb']
metadata CHANGED
@@ -1,68 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ropencv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Duda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-14 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbind
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.27
19
+ version: 0.0.28
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.27
26
+ version: 0.0.28
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ffi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.9.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.5'
55
55
  description: ROpenCV is a ffi ruby binding for the Open Source Computer Vision Library
56
56
  OpenCV 2.4.4 and higher
57
57
  email:
58
- - Alexander.Duda@dfki.de
58
+ - Alexander.Duda@me.com
59
59
  executables: []
60
60
  extensions:
61
61
  - ext/extconf.rb
62
62
  extra_rdoc_files: []
63
63
  files:
64
- - .gitignore
65
- - .yardopts
64
+ - ".gitignore"
65
+ - ".yardopts"
66
66
  - CMakeLists.txt
67
67
  - Gemfile
68
68
  - Gemfile.lock
@@ -92,12 +92,14 @@ files:
92
92
  - ext/post_opencv244.txt
93
93
  - ext/post_opencv249.txt
94
94
  - ext/post_opencv300.txt
95
+ - ext/post_opencv310.txt
95
96
  - ext/pre_opencv244.txt
96
97
  - ext/rbind.rb
97
98
  - ext/src/CMakeLists.txt
98
99
  - ext/src/cmake/FindRuby.cmake
99
100
  - lib/ropencv.rb
100
101
  - lib/ropencv/ropencv_ruby.rb
102
+ - lib/ropencv/ropencv_types.rb
101
103
  - manifest.xml
102
104
  - ropencv.gemspec
103
105
  - test/suite.rb
@@ -109,7 +111,6 @@ files:
109
111
  - test/test_triangulate_points.rb
110
112
  - test/test_vec.rb
111
113
  - test/test_vector.rb
112
- - lib/ropencv/ropencv_types.rb
113
114
  homepage: http://www.ropencv.aduda.eu
114
115
  licenses:
115
116
  - BSD
@@ -120,19 +121,18 @@ require_paths:
120
121
  - lib
121
122
  required_ruby_version: !ruby/object:Gem::Requirement
122
123
  requirements:
123
- - - '>='
124
+ - - ">="
124
125
  - !ruby/object:Gem::Version
125
126
  version: '0'
126
127
  required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  requirements:
128
- - - '>='
129
+ - - ">="
129
130
  - !ruby/object:Gem::Version
130
131
  version: 1.3.6
131
132
  requirements: []
132
133
  rubyforge_project:
133
- rubygems_version: 2.0.14
134
+ rubygems_version: 2.5.2.3
134
135
  signing_key:
135
136
  specification_version: 4
136
137
  summary: Ruby bindings for opencv 2.4.4 and higher
137
138
  test_files: []
138
- has_rdoc: