ropencv 0.0.21 → 0.0.33

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
- SHA1:
3
- metadata.gz: ddadd3f34d029333f0b75d6daf43c9530d9eb3ce
4
- data.tar.gz: 64055d27486efc056af1a403885ab76985351df1
2
+ SHA256:
3
+ metadata.gz: c842553bd3ca40b7bcb15f243acc3f6ada1143860cfa16a5db3c50f1e4beff1c
4
+ data.tar.gz: 04f366816d0f9b3d7cd76326abc274e4aac26ec1bc286fa6e1c027f4f3408ad0
5
5
  SHA512:
6
- metadata.gz: 3f9bd2767f57f0181b02b361ebf134efdb3bddc641f8bfacdcd83c9fc93a7f3d199cda1a4ef8f419e1d370145834b541957e2a91860fb2445635c23ef2190232
7
- data.tar.gz: b07b8f0000084df1c053521ec527c4992419f4cb04011d197cf6062cf21aca22427cf7c50230f73a0774ffbc0031afe3928d20c4aba8c178d5dfa3945c5d2e9b
6
+ metadata.gz: d5cc960770be1942e19366cbdec9edcef2370e25ead34f089bd70b4d8230a87db8e6428f347198d8161ae0ce61ead782d7d5d057e48185dfdaa58a6bd32e0b15
7
+ data.tar.gz: e7efa8a6897910e53dffcabaea50e3abc07162940bd3bb79c800ba592e19c10fac3983f60a3909e63bcb5a1bb351166088e1effc369089b035729afdca2a5ae3
data/ext/helper.rb CHANGED
@@ -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))
@@ -81,17 +92,16 @@ class Vec < Rbind::RClass
81
92
  end
82
93
 
83
94
  # find opencv version and headers needed to be parsed by rbind
84
- def find_opencv
85
- # find opencv header path
86
- out = IO.popen("pkg-config --cflags-only-I opencv")
87
- paths = out.read.split("-I").delete_if(&:empty?).map do |i|
88
- i.gsub("\n","").gsub(" ","")
95
+ def find_opencv(hint)
96
+ hint =~ /\[(.*)\]\[v(.*)\(\)\]/
97
+ paths = [$1]
98
+ opencv_version = $2
99
+ if !opencv_version || !paths
100
+ raise "hint #{hint} is not encoding opencv loaction and version. It must have the format [PATH][vMAJOR.MINRO.REVISION()]"
89
101
  end
90
- raise "Cannot find OpenCV" if paths.empty?
102
+ paths << File.join(paths.first,"include")
91
103
 
92
- #check opencv version
93
- out = IO.popen("pkg-config --modversion opencv")
94
- out.read.chomp =~ /(\d+).(\d+).(\d+)/
104
+ opencv_version =~ /(\d+).(\d+).(\d+)/
95
105
  major = $1.to_i; minor = $2.to_i; revision = $3.to_i
96
106
 
97
107
  ##add opencv headers
@@ -119,19 +129,23 @@ def find_opencv
119
129
  "opencv2/stitching/detail/blenders.hpp", "opencv2/stitching/detail/exposure_compensate.hpp", "opencv2/stitching/detail/motion_estimators.hpp",
120
130
  "opencv2/stitching/detail/seam_finders.hpp", "opencv2/stitching/detail/timelapsers.hpp", "opencv2/videostab/motion_core.hpp",
121
131
  "opencv2/viz/types.hpp", "opencv2/viz/widgets.hpp"]
132
+ elsif major == 4
133
+ headers = ["opencv2/core.hpp", "opencv2/core/base.hpp", "opencv2/core/mat.hpp", "opencv2/core/ocl.hpp",
134
+ "opencv2/core/opengl.hpp", "opencv2/core/optim.hpp", "opencv2/core/persistence.hpp", "opencv2/core/types.hpp",
135
+ "opencv2/core/utility.hpp", "opencv2/imgproc.hpp", "opencv2/imgcodecs.hpp", "opencv2/videoio.hpp",
136
+ "opencv2/highgui.hpp", "opencv2/video/background_segm.hpp", "opencv2/video/tracking.hpp", "opencv2/flann/miniflann.hpp",
137
+ "opencv2/ml.hpp", "opencv2/features2d.hpp", "opencv2/calib3d.hpp", "opencv2/objdetect.hpp", "opencv2/photo.hpp",
138
+ "opencv2/shape/shape_distance.hpp", "opencv2/shape/shape_transformer.hpp", "opencv2/stitching.hpp",
139
+ "opencv2/stitching/detail/blenders.hpp", "opencv2/stitching/detail/exposure_compensate.hpp", "opencv2/stitching/detail/motion_estimators.hpp",
140
+ "opencv2/stitching/detail/seam_finders.hpp", "opencv2/stitching/detail/timelapsers.hpp", "opencv2/videostab/motion_core.hpp",
141
+ "opencv2/viz/types.hpp", "opencv2/viz/widgets.hpp"]
142
+ headers.map do |h|
143
+ File.join("opencv4",h)
144
+ end
122
145
  else
123
146
  raise "OpenCV version #{opencv_version} is currently not supported"
124
147
  end
125
148
 
126
- temp = paths.clone
127
- temp.each do |path|
128
- if path =~ /(.*)opencv$/
129
- paths << $1
130
- elsif path =~ /(.*)opencv2$/
131
- paths << $1
132
- end
133
- end
134
-
135
149
  # check that all headers are available
136
150
  headers = headers.map do |i|
137
151
  path = paths.find do |p|
data/ext/opencv.txt CHANGED
@@ -11,6 +11,7 @@ const cv.CV_16S 3
11
11
  const cv.CV_32S 4
12
12
  const cv.CV_32F 5
13
13
  const cv.CV_64F 6
14
+ const cv.CV_16F 7
14
15
  const cv.CV_8UC1 (1-1)*8 + CV_8U
15
16
  const cv.CV_8UC2 (2-1)*8 + CV_8U
16
17
  const cv.CV_8UC3 (3-1)*8 + CV_8U
@@ -48,6 +49,12 @@ const cv.CV_MAT_CONT_FLAG_SHIFT 14
48
49
  const cv.CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT)
49
50
  const cv.CV_SUBMAT_FLAG_SHIFT 15
50
51
  const cv.CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT)
52
+ const cv.CV_LOAD_IMAGE_UNCHANGED -1
53
+ const cv.CV_LOAD_IMAGE_GRAYSCALE 0
54
+ const cv.CV_LOAD_IMAGE_COLOR 1
55
+ const cv.CV_LOAD_IMAGE_ANYDEPTH 2
56
+ const cv.CV_LOAD_IMAGE_ANYCOLOR 4
57
+ const cv.CV_LOAD_IMAGE_IGNORE_ORIENTATION 128
51
58
  class cv.Range
52
59
  int start /RW
53
60
  int end /RW
@@ -68,24 +75,6 @@ cv.Range.operator+ Range
68
75
  int delta
69
76
  cv.Range.operator- Range
70
77
  int delta
71
- class cv.String
72
- cv.String.String
73
- cv.String.String
74
- c_string str
75
- size_t length
76
- cv.String.String
77
- String other
78
- cv.String.size size_t
79
- cv.String.length size_t
80
- cv.String.operator[] char
81
- size_t idx
82
- cv.String.c_str const_c_string
83
- cv.String.empty bool
84
- cv.String.clear void
85
- cv.String.compare int
86
- String str
87
- cv.String.swap void
88
- String str /IO
89
78
  class cv.Scalar
90
79
  double* val
91
80
  cv.Scalar.Scalar
@@ -316,6 +305,21 @@ class cv.Mat
316
305
  cv.Mat.Mat
317
306
  cv.Mat.Mat
318
307
  Mat m
308
+ cv.Mat.Mat
309
+ vector_Point vec
310
+ bool copy false
311
+ cv.Mat.Mat
312
+ vector_Point2f vec
313
+ bool copy false
314
+ cv.Mat.Mat
315
+ vector_Point2d vec
316
+ bool copy false
317
+ cv.Mat.Mat
318
+ vector_Point3f vec
319
+ bool copy false
320
+ cv.Mat.Mat
321
+ vector_Point3d vec
322
+ bool copy false
319
323
  cv.Mat.Mat
320
324
  Size size
321
325
  int type
@@ -474,13 +478,6 @@ cv.Mat.ptr uchar*
474
478
  int i2
475
479
  cv.Mat.operator () Mat =block
476
480
  Rect rect
477
- const cv.Mat.MAGIC_VAL 0x42FF0000
478
- const cv.Mat.AUTO_STEP 0
479
- const cv.Mat.CONTINUOUS_FLAG CV_MAT_CONT_FLAG
480
- const cv.Mat.SUBMATRIX_FLAG CV_SUBMAT_FLAG
481
- const cv.Mat.MAGIC_MASK 0xFFFF0000
482
- const cv.Mat.TYPE_MASK 0x00000FFF
483
- const cv.Mat.DEPTH_MASK 7
484
481
  class cv.RNG
485
482
  uint64 state
486
483
  cv.RNG.RNG
@@ -643,13 +640,127 @@ cv.FileNode.operator>> void =read_string
643
640
  String val /IO
644
641
  cv.FileNode.operator>> void =read_mat
645
642
  Mat val /IO
643
+ cv.FileNode.operator>> void =read_vector_mat
644
+ vector_Mat val /IO
645
+ cv.FileNode.operator>> void =read_vector_string
646
+ vector_String val /IO
646
647
  cv.FileNode.begin FileNodeIterator
647
648
  cv.FileNode.end FileNodeIterator
648
649
  cv.FileNodeIterator.operator++ FileNodeIterator
649
- cv.FileNodeIterator.operator-- FileNodeIterator
650
650
  cv.FileNodeIterator.operator* FileNode =to_node
651
651
  cv.FileNodeIterator.operator== bool
652
652
  FileNodeIterator other
653
653
  cv.FileNodeIterator.operator!= bool
654
654
  FileNodeIterator other
655
-
655
+ class cv.UMat
656
+ int flags
657
+ int rows
658
+ int cols
659
+ size_t step
660
+ cv.UMat.UMat
661
+ cv.UMat.UMat
662
+ UMat m
663
+ cv.UMat.UMat
664
+ vector_Point vec
665
+ bool copy false
666
+ cv.UMat.UMat
667
+ vector_Point2f vec
668
+ bool copy false
669
+ cv.UMat.UMat
670
+ vector_Point2d vec
671
+ bool copy false
672
+ cv.UMat.UMat
673
+ vector_Point3f vec
674
+ bool copy false
675
+ cv.UMat.UMat
676
+ vector_Point3d vec
677
+ bool copy false
678
+ cv.UMat.row UMat
679
+ int y
680
+ cv.UMat.col UMat
681
+ int c
682
+ cv.UMat.rowRange UMat
683
+ int startrow
684
+ int endrow
685
+ cv.UMat.rowRange UMat
686
+ Range r
687
+ cv.UMat.colRange UMat
688
+ int startcol
689
+ int endcol
690
+ cv.UMat.colRange UMat
691
+ Range r
692
+ cv.UMat.diag UMat
693
+ int d 0
694
+ cv.UMat.clone UMat
695
+ cv.UMat.copyTo void
696
+ UMat m /O
697
+ cv.UMat.copyTo void
698
+ UMat m /O
699
+ UMat mask /IO
700
+ cv.UMat.convertTo void
701
+ UMat m /O
702
+ int rtype
703
+ double alpha 1
704
+ double beta 0
705
+ cv.UMat.assignTo void
706
+ UMat m /O
707
+ int type -1
708
+ cv.UMat.reshape UMat
709
+ int cn
710
+ int rows 0
711
+ cv.UMat.t UMat
712
+ cv.UMat.inv UMat
713
+ int method DECOMP_LU
714
+ cv.UMat.mul UMat
715
+ UMat m
716
+ double scale 1
717
+ cv.UMat.dot double
718
+ UMat m
719
+ cv.UMat.diag UMat /S
720
+ UMat d
721
+ cv.UMat.zeros UMat /S
722
+ int rows
723
+ int cols
724
+ int type
725
+ cv.UMat.zeros UMat /S
726
+ Size size
727
+ int type
728
+ cv.UMat.ones UMat /S
729
+ int rows
730
+ int cols
731
+ int type
732
+ cv.UMat.ones UMat /S
733
+ Size size
734
+ int type
735
+ cv.UMat.eye UMat /S
736
+ int rows
737
+ int cols
738
+ int type
739
+ cv.UMat.eye UMat /S
740
+ Size size
741
+ int type
742
+ cv.UMat.create void
743
+ int rows
744
+ int cols
745
+ int type
746
+ cv.UMat.create void
747
+ Size size
748
+ int type
749
+ cv.UMat.isContinuous bool
750
+ cv.UMat.isSubmatrix bool
751
+ cv.UMat.elemSize size_t
752
+ cv.UMat.elemSize1 size_t
753
+ cv.UMat.size Size
754
+ cv.UMat.type int
755
+ cv.UMat.depth int
756
+ cv.UMat.channels int
757
+ cv.UMat.step1 size_t
758
+ int i 0
759
+ cv.UMat.empty bool
760
+ cv.UMat.total size_t
761
+ cv.UMat.checkVector int
762
+ int elemChannels
763
+ int depth -1
764
+ bool requireContinuous true
765
+ cv.UMat.operator () UMat =block
766
+ Rect rect
@@ -1,14 +1,3 @@
1
- cv.drawMatches void
2
- Mat img1
3
- vector_KeyPoint keypoints1
4
- Mat img2
5
- vector_KeyPoint keypoints2
6
- vector_DMatch matches1to2
7
- Mat outImg /O
8
- Scalar matchColor Scalar::all(-1)
9
- Scalar singlePointColor Scalar::all(-1)
10
- vector_char matchesMask std::vector<char>()
11
- int flags DrawMatchesFlags::DEFAULT
12
1
  cv.morphologyDefaultBorderValue Scalar
13
2
  cv.polyfit void
14
3
  Mat srcx
@@ -19,4 +8,13 @@ cv.abs Mat
19
8
  Mat src
20
9
  cv.sum Mat
21
10
  Mat src
22
-
11
+ cv.norm double
12
+ Point3f pt
13
+ cv.norm double
14
+ Point3d pt
15
+ cv.norm double
16
+ Vec3f vec
17
+ cv.norm double
18
+ Vec3d vec
19
+ cv.FileNode.operator>> void =read_vector_keypoint
20
+ 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,19 @@
1
+ class cv.String
2
+ cv.String.String
3
+ cv.String.String
4
+ c_string str
5
+ size_t length
6
+ cv.String.String
7
+ String other
8
+ cv.String.size size_t
9
+ cv.String.length size_t
10
+ cv.String.operator[] char
11
+ size_t idx
12
+ cv.String.c_str const_c_string
13
+ cv.String.empty bool
14
+ cv.String.clear void
15
+ cv.String.compare int
16
+ String str
17
+ cv.String.swap void
18
+ String str /IO
19
+
@@ -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
+
@@ -0,0 +1,30 @@
1
+ cv.UMat.getMat Mat
2
+ AccessFlag flags
3
+ cv.UMat.UMat
4
+ Size size
5
+ int type
6
+ UMatUsageFlags usageFlags USAGE_DEFAULT
7
+ cv.UMat.UMat
8
+ int rows
9
+ int cols
10
+ int type
11
+ UMatUsageFlags usageFlags USAGE_DEFAULT
12
+ cv.UMat.UMat
13
+ int rows
14
+ int cols
15
+ int type
16
+ Scalar scalar
17
+ UMatUsageFlags usageFlags USAGE_DEFAULT
18
+ cv.UMat.UMat
19
+ Size size
20
+ int type
21
+ Scalar scalar
22
+ UMatUsageFlags usageFlags USAGE_DEFAULT
23
+ cv.UMat.UMat
24
+ UMat m
25
+ Range row_range
26
+ Range col_range Range::all()
27
+ cv.UMat.UMat
28
+ UMat m
29
+ Rect roi
30
+
@@ -45,4 +45,8 @@ 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
49
+ const cv.CV_CALIB_CB_ADAPTIVE_THRESH 1
50
+ const cv.CV_CALIB_CB_NORMALIZE_IMAGE 2
51
+ const cv.CV_CALIB_CB_FILTER_QUADS 4
52
+ const cv.CV_CALIB_CB_FAST_CHECK 8
data/ext/rbind.rb CHANGED
@@ -3,12 +3,12 @@ require 'pp'
3
3
  require 'yaml'
4
4
 
5
5
  require File.join(File.dirname(__FILE__),'helper.rb')
6
- major,minor,revision,opencv_headers = find_opencv
6
+
7
+ major,minor,revision,opencv_headers = find_opencv(ARGV[0])
7
8
  opencv_version = "#{major}.#{minor}.#{revision}"
8
9
  Rbind.log.warn "found opencv #{opencv_version}"
9
10
 
10
11
  rbind = Rbind::Rbind.new("OpenCV")
11
- rbind.pkg_config << "opencv"
12
12
  rbind.includes = opencv_headers
13
13
 
14
14
  # add Vec types
@@ -21,30 +21,53 @@ end
21
21
 
22
22
  # add some templates and alias
23
23
  rbind.parser.type_alias["const_c_string"] = rbind.c_string.to_const
24
- if major >= 3
24
+ if major >= 3 && major < 4
25
+ rbind.pkg_config << "opencv"
25
26
  rbind.add_std_types
27
+ rbind.cv.add_type(Rbind::RClass.new("String"))
28
+ rbind.cv.type_alias["string"] = rbind.cv.String
26
29
  rbind.parser.add_type OpenCVPtr2.new
27
30
  rbind.cv.add_type(Rbind::RClass.new("ShapeTransformer"))
28
31
  rbind.cv.add_type(Rbind::RClass.new("Feature2D"))
32
+ rbind.cv.add_type(Rbind::RClass.new("KeyPoint"))
33
+ rbind.cv.add_type(Rbind::RClass.new("DMatch"))
34
+ rbind.cv.type_alias["FeatureDetector"] = rbind.cv.Feature2D
35
+ rbind.cv.type_alias["DescriptorExtractor"] = rbind.cv.Feature2D
36
+ elsif major >= 4
37
+ rbind.pkg_config << "opencv4"
38
+ rbind.add_std_types
39
+ rbind.cv.type_alias["string"] = rbind.std.string
40
+ rbind.cv.type_alias["String"] = rbind.std.string
41
+ rbind.parser.add_type OpenCVPtr2.new
42
+ rbind.cv.add_type(Rbind::RClass.new("Feature2D"))
43
+ rbind.cv.add_type(Rbind::RClass.new("KeyPoint"))
44
+ rbind.cv.add_type(Rbind::RClass.new("DMatch"))
29
45
  rbind.cv.type_alias["FeatureDetector"] = rbind.cv.Feature2D
30
46
  rbind.cv.type_alias["DescriptorExtractor"] = rbind.cv.Feature2D
31
- # add missing enum values
32
- rbind.cv.add_type(Rbind::RClass.new("Stitcher"))
33
- rbind.cv.Stitcher.add_type(Rbind::REnum.new("Status"))
34
- rbind.cv.Stitcher.Status.values = {:OK => 0, :ERR_NEED_MORE_IMGS => 1,:ERR_HOMOGRAPHY_EST_FAIL => 2,:ERR_CAMERA_PARAMS_ADJUST_FAIL => 3}
47
+ rbind.cv.add_namespace("detail")
48
+ rbind.cv.detail.add_type(Rbind::RClass.new("GraphCutSeamFinderBase"))
49
+ rbind.cv.detail.add_type(Rbind::RClass.new("ImageFeatures"))
50
+ rbind.cv.detail.add_type(Rbind::RClass.new("CameraParams"))
51
+ rbind.cv.detail.add_type(Rbind::RClass.new("MatchesInfo"))
52
+ if(minor >= 5)
53
+ rbind.cv.add_type(Rbind::RClass.new("HistogramCostExtractor"))
54
+ rbind.cv.add_type(Rbind::RClass.new("ShapeTransformer"))
55
+ end
35
56
  else
57
+ rbind.pkg_config << "opencv"
36
58
  rbind.add_std_vector
37
59
  rbind.parser.add_type OpenCVPtr.new
38
60
  end
39
61
 
40
62
  # parsing
63
+ rbind.use_namespace rbind.std
41
64
  rbind.parse File.join(File.dirname(__FILE__),"pre_opencv244.txt")
42
65
  rbind.parse File.join(File.dirname(__FILE__),"opencv.txt")
43
66
  rbind.use_namespace rbind.cv
44
- rbind.use_namespace rbind.std
45
- rbind.cv.type_alias["string"] = rbind.cv.String
46
67
  rbind.parse_headers
47
68
  rbind.parse File.join(File.dirname(__FILE__),"post_opencv244.txt")
69
+ #rbind.cv.String.begin.return_type = rbind.cv.String.begin.return_type.to_const.to_ptr
70
+ #rbind.cv.String.end.return_type = rbind.cv.String.end.return_type.to_const.to_ptr
48
71
 
49
72
  # post parsing + patching wrong signatures
50
73
  if major == 2 && minor == 4 && revision>= 9
@@ -69,11 +92,14 @@ if major == 2 && minor == 4 && revision>= 9
69
92
  rbind.cv.BRISK.operation("BRISK")[1].parameter(0).remove_const!
70
93
  rbind.cv.BRISK.operation("BRISK")[1].parameter(1).remove_const!
71
94
  rbind.cv.putText.parameter(0).remove_const!
72
- elsif major >= 3
95
+ elsif major == 3
73
96
  rbind.parse File.join(File.dirname(__FILE__),"post_opencv249.txt")
74
97
  rbind.parse File.join(File.dirname(__FILE__),"post_opencv300.txt")
75
- rbind.cv.randShuffle.parameter(2).remove_const!
76
- rbind.cv.AlignExposures.process.parameter(1).remove_const!
98
+ rbind.parse File.join(File.dirname(__FILE__),"post_opencv300a.txt")
99
+ rbind.parse File.join(File.dirname(__FILE__),"post_opencv310.txt") if minor >= 1
100
+
101
+ # rbind.cv.randShuffle.parameter(2).remove_const!
102
+ # rbind.cv.AlignExposures.process.parameter(1).remove_const!
77
103
  rbind.cv.AlignMTB.process[0].parameter(1).remove_const!
78
104
  rbind.cv.AlignMTB.process[1].parameter(1).remove_const!
79
105
  rbind.CvDTreeNode.ignore = true
@@ -87,6 +113,39 @@ elsif major >= 3
87
113
  # is removed on opencv master
88
114
  # mark none polymorphic class
89
115
  rbind.ml.DTrees.Params.polymorphic = false if(rbind.ml.DTrees.type?("Params"))
116
+ elsif major >= 4
117
+ rbind.parse File.join(File.dirname(__FILE__),"post_opencv249.txt")
118
+ rbind.parse File.join(File.dirname(__FILE__),"post_opencv300.txt")
119
+ rbind.parse File.join(File.dirname(__FILE__),"post_opencv400.txt")
120
+
121
+ rbind.cv.AlignMTB.process[0].parameter(1).remove_const!
122
+ rbind.cv.AlignMTB.process[1].parameter(1).remove_const!
123
+ rbind.CvDTreeNode.ignore = true
124
+ rbind.CvSlice.ignore = true
125
+ rbind.CvTermCriteria.ignore = true
126
+ rbind.cv.polyfit.ignore = true
127
+ rbind.cv.FlannBasedMatcher.write[0].ignore = true
128
+ rbind.cv.FlannBasedMatcher.write[1].ignore = true
129
+ rbind.cv.FlannBasedMatcher.read[0].ignore = true
130
+ # issues with UMat
131
+ rbind.detail.NoExposureCompensator.feed.ignore = true
132
+ rbind.detail.GainCompensator.feed.ignore = true
133
+ rbind.detail.BlocksGainCompensator.feed.ignore = true
134
+
135
+ # issues with enum using full namespace name
136
+ rbind.cv.HOGDescriptor.ignore = true
137
+
138
+ # is removed on opencv master
139
+ rbind.ml.StatModel.getParams.ignore = true if(rbind.ml.StatModel.operation?('getParams'))
140
+
141
+ # is removed on opencv master
142
+ # mark none polymorphic class
143
+ rbind.ml.DTrees.Params.polymorphic = false if(rbind.ml.DTrees.type?("Params"))
144
+
145
+ if minor >= 5
146
+ puts "Here"
147
+ rbind.cv.createShapeContextDistanceExtractor.ignore = true
148
+ end
90
149
  end
91
150
 
92
151
  # add some more vector types
@@ -99,6 +158,7 @@ rbind.parser.type("std::vector<uint64_t>")
99
158
  rbind.parser.type("std::vector<int8_t>")
100
159
  rbind.parser.type("std::vector<int64_t>")
101
160
  rbind.parser.type("std::vector<Scalar>")
161
+ rbind.parser.type("std::vector<Range>")
102
162
  rbind.parser.type("std::vector<std::vector<Point2d> >")
103
163
 
104
164
  # add some extra documentation
@@ -2,11 +2,36 @@ cmake_minimum_required(VERSION 2.6)
2
2
  PROJECT(rbind_opencv CXX)
3
3
 
4
4
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
5
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
6
+
5
7
  include(FindPkgConfig)
6
- pkg_check_modules(OPENCV REQUIRED opencv)
7
- add_definitions(${OPENCV_CFLAGS})
8
+ find_package(OpenCV REQUIRED)
8
9
  include_directories(${OPENCV_INCLUDE_DIRS})
9
- link_directories(${OPENCV_LIBRARY_DIRS})
10
+
11
+ # use, i.e. don't skip the full RPATH for the build tree
12
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
13
+
14
+ # when building, don't use the install RPATH already
15
+ # (but later on when installing)
16
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
17
+
18
+ # the RPATH to be used when installing
19
+ SET(CMAKE_INSTALL_RPATH ${ROOT_FOLDER}/lib/ropencv)
20
+
21
+ # add the automatically determined parts of the RPATH
22
+ # which point to directories outside the build tree to the insgall RPATH
23
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
24
+
25
+ if(APPLE)
26
+ SET(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_RPATH})
27
+ Set(CMAKE_MACOSX_RPATH ON)
28
+ endif(APPLE)
29
+
30
+ #do not add if system directory
31
+ list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${install_rpath}" isSystemDir)
32
+ if("${isSystemDir}" STREQUAL "-1")
33
+ set(CMAKE_INSTALL_RPATH "${install_rpath}")
34
+ endif()
10
35
 
11
36
  SET(RBIND_SRC
12
37
  "${CMAKE_CURRENT_SOURCE_DIR}/types.cc"
@@ -14,10 +39,9 @@ SET(RBIND_SRC
14
39
  "${CMAKE_CURRENT_SOURCE_DIR}/conversions.cc")
15
40
 
16
41
  add_custom_command(OUTPUT ${RBIND_SRC}
17
- COMMAND ruby "${CMAKE_CURRENT_SOURCE_DIR}/../rbind.rb")
18
-
42
+ COMMAND ruby "${CMAKE_CURRENT_SOURCE_DIR}/../rbind.rb" ARGS "\"${FIND_PACKAGE_MESSAGE_DETAILS_OpenCV}\"")
19
43
  ADD_LIBRARY(rbind_opencv SHARED ${RBIND_SRC})
20
- TARGET_LINK_LIBRARIES(rbind_opencv ${OPENCV_LIBS} ${OPENCV_LDFLAGS_OTHER} ${OPENCV_LIBRARIES})
44
+ TARGET_LINK_LIBRARIES(rbind_opencv ${OpenCV_LIBS})
21
45
 
22
46
  set(ROOT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/../..)
23
47
  install(TARGETS rbind_opencv LIBRARY DESTINATION ${ROOT_FOLDER}/lib/ropencv)
@@ -206,13 +206,19 @@ module OpenCV
206
206
  end
207
207
 
208
208
  def <<(val)
209
- if val.is_a?(Fixnum)
209
+ if val.is_a?(1.class)
210
210
  write_int(val)
211
211
  elsif val.is_a?(Float)
212
212
  write_double(val)
213
213
  else
214
- name = val.class.name.split("::").last.downcase
215
- send("write_#{name}",val)
214
+ if val.is_a? Std::Vector::Cv_DMatch
215
+ write_std_cv_dmatch(val)
216
+ elsif val.is_a? Std::Vector::Cv_KeyPoint
217
+ write_std_cv_keypoint(val)
218
+ else
219
+ name = val.class.name.split("::").last.downcase
220
+ send("write_#{name}",val)
221
+ end
216
222
  end
217
223
  end
218
224
 
@@ -274,6 +280,22 @@ module OpenCV
274
280
  val
275
281
  end
276
282
 
283
+ def to_vector_mat
284
+ raise RuntimeError, "FileNode is empty" if empty?
285
+ raise RuntimeError, "FileNode is not storing a vector" unless isSeq
286
+ val = Std::Vector.new(Cv::Mat)
287
+ read_vector_mat(val)
288
+ val
289
+ end
290
+
291
+ def to_vector_string
292
+ raise RuntimeError, "FileNode is empty" if empty?
293
+ raise RuntimeError, "FileNode is not storing a vector" unless isSeq
294
+ val = Std::Vector.new(Cv::String)
295
+ read_vector_string(val)
296
+ val
297
+ end
298
+
277
299
  def to_float
278
300
  raise RuntimeError, "FileNode is empty" if empty?
279
301
  raise RuntimeError, "FileNode is not storing a float" unless isReal
@@ -292,7 +314,7 @@ module OpenCV
292
314
 
293
315
  def to_int
294
316
  raise RuntimeError, "FileNode is empty" if empty?
295
- raise RuntimeError, "FileNode is not storing a double" unless isInt
317
+ raise RuntimeError, "FileNode is not storing an int" unless isInt
296
318
  p = FFI::MemoryPointer.new(:int,1)
297
319
  read_int(p)
298
320
  p.get_int32 0
@@ -306,6 +328,14 @@ module OpenCV
306
328
  str
307
329
  end
308
330
 
331
+ def to_vector_keypoint
332
+ raise RuntimeError, "FileNode is empty" if empty?
333
+ raise RuntimeError, "FileNode is not storing a string" unless isSeq
334
+ val = Std::Vector.new(Cv::KeyPoint)
335
+ read_vector_keypoint(val)
336
+ val
337
+ end
338
+
309
339
  def method_missing(m,*args)
310
340
  if args.empty? && map?
311
341
  self[m.to_s]
@@ -364,7 +394,7 @@ module OpenCV
364
394
  [obj.size,1,obj.first]
365
395
  end
366
396
  end
367
- setter,step,type = if e.is_a? Fixnum
397
+ setter,step,type = if e.is_a? 1.class
368
398
  [:put_array_of_int32,4*w,CV_32SC1]
369
399
  elsif e.is_a? Float
370
400
  [:put_array_of_float64,8*w,CV_64FC1]
@@ -398,12 +428,12 @@ module OpenCV
398
428
  if i.is_a?(Cv::Point)
399
429
  [i.y,i.x]
400
430
  elsif rows == 1
401
- [0,i]
431
+ [0,i.to_i]
402
432
  else
403
- [i,0]
433
+ [i.to_i,0]
404
434
  end
405
435
  else
406
- [i,j]
436
+ [i.to_i,j.to_i]
407
437
  end
408
438
  if i >= rows || i < 0 || j >= cols || j <0
409
439
  raise ArgumentError,"out of bound #{i}/#{j} #{rows}/#{cols}"
@@ -431,7 +461,7 @@ module OpenCV
431
461
  case other
432
462
  when Float
433
463
  [other,to_f]
434
- when Fixnum
464
+ when 1.class
435
465
  [other,to_i]
436
466
  else
437
467
  raise TypeError, "#{self.class} can't be coerced into #{other.class}"
@@ -461,17 +491,18 @@ module OpenCV
461
491
  [k,val]
462
492
  end
463
493
  k ||= 0
494
+ k = k.to_i
464
495
  raise ArgumentError,"channel #{k} out of bound" if k >= channels
465
496
  i,j,val = if val == nil
466
497
  if i.is_a?(Cv::Point)
467
498
  [i.y,i.x,j]
468
499
  elsif rows == 1
469
- [0,i,j]
500
+ [0,i.to_i,j]
470
501
  else
471
- [i,0,j]
502
+ [i.to_i,0,j]
472
503
  end
473
504
  else
474
- [i,j,val]
505
+ [i.to_i,j.to_i,val]
475
506
  end
476
507
  if i >= rows || i < 0 || j >= cols || j <0
477
508
  raise ArgumentError,"out of bound #{i}/#{j}"
@@ -505,9 +536,9 @@ module OpenCV
505
536
 
506
537
  def -(val)
507
538
  if val.is_a? Float
508
- Rbind::cv_mat_operator_minus2( self, val)
509
- elsif val.is_a? Fixnum
510
- Rbind::cv_mat_operator_minus3( self, val)
539
+ Rbind::cv_mat_operator_minus__2( self, val)
540
+ elsif val.is_a? 1.class
541
+ Rbind::cv_mat_operator_minus__3( self, val)
511
542
  else
512
543
  Rbind::cv_mat_operator_minus( self, val)
513
544
  end
@@ -515,9 +546,9 @@ module OpenCV
515
546
 
516
547
  def +(val)
517
548
  if val.is_a? Float
518
- Rbind::cv_mat_operator_plus2( self, val)
519
- elsif val.is_a? Fixnum
520
- Rbind::cv_mat_operator_plus3( self, val)
549
+ Rbind::cv_mat_operator_plus__2( self, val)
550
+ elsif val.is_a? 1.class
551
+ Rbind::cv_mat_operator_plus__3( self, val)
521
552
  else
522
553
  Rbind::cv_mat_operator_plus( self, val)
523
554
  end
@@ -525,9 +556,9 @@ module OpenCV
525
556
 
526
557
  def /(val)
527
558
  if val.is_a? Float
528
- Rbind::cv_mat_operator_div2( self, val)
529
- elsif val.is_a? Fixnum
530
- Rbind::cv_mat_operator_div3( self, val)
559
+ Rbind::cv_mat_operator_div__2( self, val)
560
+ elsif val.is_a? 1.class
561
+ Rbind::cv_mat_operator_div__3( self, val)
531
562
  else
532
563
  Rbind::cv_mat_operator_div( self, val)
533
564
  end
@@ -535,9 +566,9 @@ module OpenCV
535
566
 
536
567
  def *(val)
537
568
  if val.is_a? Float
538
- Rbind::cv_mat_operator_mult2( self, val)
539
- elsif val.is_a? Fixnum
540
- Rbind::cv_mat_operator_mult3( self, val)
569
+ Rbind::cv_mat_operator_mult__2( self, val)
570
+ elsif val.is_a? 1.class
571
+ Rbind::cv_mat_operator_mult__3( self, val)
541
572
  else
542
573
  Rbind::cv_mat_operator_mult( self, val)
543
574
  end
data/manifest.xml CHANGED
@@ -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>
data/ropencv.gemspec CHANGED
@@ -1,18 +1,18 @@
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.33'
4
+ s.date = '2021-02-08'
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"
15
- s.add_runtime_dependency "ffi", "~> 1.9.0"
14
+ s.add_runtime_dependency "rbind", ">= 0.0.30"
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']
18
18
  s.license = 'BSD'
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.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Duda
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-14 00:00:00.000000000 Z
11
+ date: 2021-02-08 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.30
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.30
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,16 @@ files:
92
92
  - ext/post_opencv244.txt
93
93
  - ext/post_opencv249.txt
94
94
  - ext/post_opencv300.txt
95
+ - ext/post_opencv300a.txt
96
+ - ext/post_opencv310.txt
97
+ - ext/post_opencv400.txt
95
98
  - ext/pre_opencv244.txt
96
99
  - ext/rbind.rb
97
100
  - ext/src/CMakeLists.txt
98
101
  - ext/src/cmake/FindRuby.cmake
99
102
  - lib/ropencv.rb
100
103
  - lib/ropencv/ropencv_ruby.rb
104
+ - lib/ropencv/ropencv_types.rb
101
105
  - manifest.xml
102
106
  - ropencv.gemspec
103
107
  - test/suite.rb
@@ -109,30 +113,27 @@ files:
109
113
  - test/test_triangulate_points.rb
110
114
  - test/test_vec.rb
111
115
  - test/test_vector.rb
112
- - lib/ropencv/ropencv_types.rb
113
116
  homepage: http://www.ropencv.aduda.eu
114
117
  licenses:
115
118
  - BSD
116
119
  metadata: {}
117
- post_install_message:
120
+ post_install_message:
118
121
  rdoc_options: []
119
122
  require_paths:
120
123
  - lib
121
124
  required_ruby_version: !ruby/object:Gem::Requirement
122
125
  requirements:
123
- - - '>='
126
+ - - ">="
124
127
  - !ruby/object:Gem::Version
125
128
  version: '0'
126
129
  required_rubygems_version: !ruby/object:Gem::Requirement
127
130
  requirements:
128
- - - '>='
131
+ - - ">="
129
132
  - !ruby/object:Gem::Version
130
133
  version: 1.3.6
131
134
  requirements: []
132
- rubyforge_project:
133
- rubygems_version: 2.0.14
134
- signing_key:
135
+ rubygems_version: 3.0.3
136
+ signing_key:
135
137
  specification_version: 4
136
138
  summary: Ruby bindings for opencv 2.4.4 and higher
137
139
  test_files: []
138
- has_rdoc: