ruby-opencv 0.0.17 → 0.0.18
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/README.md +4 -10
- data/ext/opencv/cvcapture.cpp +1 -1
- data/ext/opencv/cvchain.cpp +2 -2
- data/ext/opencv/cvcontour.cpp +3 -3
- data/ext/opencv/cvfont.cpp +3 -3
- data/ext/opencv/cvpoint.cpp +1 -1
- data/ext/opencv/cvscalar.cpp +1 -1
- data/ext/opencv/cvseq.cpp +10 -10
- data/ext/opencv/cvsize.cpp +1 -1
- data/ext/opencv/cvtwopoints.cpp +1 -1
- data/ext/opencv/iplimage.cpp +2 -2
- data/ext/opencv/trackbar.cpp +1 -1
- data/lib/opencv/version.rb +1 -1
- data/ruby-opencv.gemspec +4 -4
- data/test/test_cvavgcomp.rb +1 -1
- data/test/test_cvchain.rb +1 -1
- data/test/test_cvseq.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00fdfbad5fec1130a085d1b0b28614239dc5b138
|
4
|
+
data.tar.gz: 70dce06ad82b90b2707fac4e13f0f798d9feff82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e575baa745f3d07af3a39ea0e7549eaaa202a2f476e6fde8236d05d51dbedeafda1f45ce3ce399927fa1e100128a6a989e989cca296b2a3a4f55af430fd709
|
7
|
+
data.tar.gz: ae17d441ebe7d1e2dc5950034fce6cd886e27a92f0b0d94ad426cd969d0a283b74a93dfe002df491dd50e694a75218bb06c1365dbf8e46f8e3afe1b0b10919f1
|
data/README.md
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
An OpenCV wrapper for Ruby.
|
4
4
|
|
5
5
|
* Web site: <https://github.com/ruby-opencv/ruby-opencv>
|
6
|
-
* Ruby
|
6
|
+
* Ruby 2.x and OpenCV 2.4.13 are supported.
|
7
|
+
* [Documentation](http://www.rubydoc.info/gems/ruby-opencv/frames)
|
7
8
|
|
8
9
|
## Requirement
|
9
10
|
|
@@ -23,16 +24,9 @@ $ gem install ruby-opencv -- --with-opencv-dir=/path/to/opencvdir
|
|
23
24
|
Note: **/path/to/opencvdir** is the directory where you installed OpenCV.
|
24
25
|
|
25
26
|
|
26
|
-
### Windows
|
27
|
-
You can use pre-build binary for Windows (mswin32).
|
27
|
+
### Windows (RubyInstaller)
|
28
28
|
|
29
|
-
|
30
|
-
2. Set path to OpenCV libraries. When you installed OpenCV to **C:\opencv**, add **C:\opencv\build\x86\vc10\bin** to the systems path.
|
31
|
-
3. Install ruby-opencv
|
32
|
-
|
33
|
-
```
|
34
|
-
$ gem install ruby-opencv
|
35
|
-
```
|
29
|
+
See [install-ruby-opencv-with-rubyinstaller-on-windows.md](install-ruby-opencv-with-rubyinstaller-on-windows.md).
|
36
30
|
|
37
31
|
## Sample code
|
38
32
|
### Load and Display an Image
|
data/ext/opencv/cvcapture.cpp
CHANGED
@@ -39,7 +39,7 @@ cvcapture_free(void *ptr)
|
|
39
39
|
* Open video file or a capturing device for video capturing
|
40
40
|
* @scope class
|
41
41
|
* @overload open(dev = nil)
|
42
|
-
* @param dev [String,
|
42
|
+
* @param dev [String,Integer,Simbol,nil] Video capturing device
|
43
43
|
* * If dev is a string (i.e "stream.avi"), reads video stream from a file.
|
44
44
|
* * If dev is a number or symbol (included in CvCapture::INTERFACE), reads video stream from a device.
|
45
45
|
* * If dev is a nil, same as CvCapture.open(:any)
|
data/ext/opencv/cvchain.cpp
CHANGED
@@ -62,7 +62,7 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
62
62
|
raise_cverror(e);
|
63
63
|
}
|
64
64
|
CvSeq* self_ptr = CVSEQ(self);
|
65
|
-
cCvSeq::register_elem_class(self_ptr,
|
65
|
+
cCvSeq::register_elem_class(self_ptr, rb_cInteger);
|
66
66
|
register_root_object(self_ptr, storage_value);
|
67
67
|
|
68
68
|
return self;
|
@@ -95,7 +95,7 @@ rb_set_origin(VALUE self, VALUE origin)
|
|
95
95
|
/*
|
96
96
|
* Returns the chain codes
|
97
97
|
* @overload codes
|
98
|
-
* @return [Array<
|
98
|
+
* @return [Array<Integer>] Chain codes
|
99
99
|
* @opencv_func cvStartReadChainPoints
|
100
100
|
* @opencv_func CV_READ_SEQ_ELEM
|
101
101
|
*/
|
data/ext/opencv/cvcontour.cpp
CHANGED
@@ -44,14 +44,14 @@ rb_allocate(VALUE klass)
|
|
44
44
|
* Constructor
|
45
45
|
*
|
46
46
|
* @overload new(seq_flags = CV_SEQ_ELTYPE_POINT | CV_SEQ_KIND_GENERIC, storage = nil)
|
47
|
-
* @param [
|
47
|
+
* @param [Integer] seq_flags Flags of the created sequence, which are combinations of
|
48
48
|
* the element types and sequence types.
|
49
49
|
* - Element type:
|
50
50
|
* - <tt>CV_SEQ_ELTYPE_POINT</tt>: {CvPoint}
|
51
51
|
* - <tt>CV_32FC2</tt>: {CvPoint2D32f}
|
52
52
|
* - <tt>CV_SEQ_ELTYPE_POINT3D</tt>: {CvPoint3D32f}
|
53
|
-
* - <tt>CV_SEQ_ELTYPE_INDEX</tt>:
|
54
|
-
* - <tt>CV_SEQ_ELTYPE_CODE</tt>:
|
53
|
+
* - <tt>CV_SEQ_ELTYPE_INDEX</tt>: Integer
|
54
|
+
* - <tt>CV_SEQ_ELTYPE_CODE</tt>: Integer (Freeman code)
|
55
55
|
* - Sequence type:
|
56
56
|
* - <tt>CV_SEQ_KIND_GENERIC</tt>: Generic sequence
|
57
57
|
* - <tt>CV_SEQ_KIND_CURVE</tt>: Curve
|
data/ext/opencv/cvfont.cpp
CHANGED
@@ -108,7 +108,7 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
108
108
|
/*
|
109
109
|
* Returns font face
|
110
110
|
* @overload face
|
111
|
-
* @return [
|
111
|
+
* @return [Integer] Font face
|
112
112
|
*/
|
113
113
|
VALUE
|
114
114
|
rb_face(VALUE self)
|
@@ -152,7 +152,7 @@ rb_shear(VALUE self)
|
|
152
152
|
/*
|
153
153
|
* Returns thickness
|
154
154
|
* @overload thickness
|
155
|
-
* @return [
|
155
|
+
* @return [Integer] thickness
|
156
156
|
*/
|
157
157
|
VALUE
|
158
158
|
rb_thickness(VALUE self)
|
@@ -163,7 +163,7 @@ rb_thickness(VALUE self)
|
|
163
163
|
/*
|
164
164
|
* Returns line type
|
165
165
|
* @overload line_type
|
166
|
-
* @return [
|
166
|
+
* @return [Integer] line_type
|
167
167
|
*/
|
168
168
|
VALUE
|
169
169
|
rb_line_type(VALUE self)
|
data/ext/opencv/cvpoint.cpp
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* Document-class: OpenCV::CvPoint
|
13
13
|
*
|
14
14
|
* This class means one point on X axis Y axis.
|
15
|
-
* X and Y takes the value of the
|
15
|
+
* X and Y takes the value of the Integer. see also CvPoint2D32F
|
16
16
|
*
|
17
17
|
* C structure is here, very simple.
|
18
18
|
* typdef struct CvPoint {
|
data/ext/opencv/cvscalar.cpp
CHANGED
@@ -53,7 +53,7 @@ rb_allocate(VALUE klass)
|
|
53
53
|
* call-seq:
|
54
54
|
* new([d1][,d2][,d3][,d4])
|
55
55
|
*
|
56
|
-
* Create new Scalar. Argument should be
|
56
|
+
* Create new Scalar. Argument should be Integer (or nil as 0).
|
57
57
|
*/
|
58
58
|
VALUE
|
59
59
|
rb_initialize(int argc, VALUE *argv, VALUE self)
|
data/ext/opencv/cvseq.cpp
CHANGED
@@ -43,7 +43,7 @@ eltype2class(int eltype, VALUE* ret) {
|
|
43
43
|
break;
|
44
44
|
case CV_SEQ_ELTYPE_CODE:
|
45
45
|
case CV_SEQ_ELTYPE_INDEX:
|
46
|
-
*ret =
|
46
|
+
*ret = rb_cInteger;
|
47
47
|
break;
|
48
48
|
case CV_SEQ_ELTYPE_PPOINT: // or CV_SEQ_ELTYPE_PTR:
|
49
49
|
// Not supported
|
@@ -132,7 +132,7 @@ class2seq_flags_value(VALUE klass) {
|
|
132
132
|
else if (klass == cCvPoint3D32f::rb_class()) {
|
133
133
|
seq_flags = CV_SEQ_ELTYPE_POINT3D;
|
134
134
|
}
|
135
|
-
else if (klass ==
|
135
|
+
else if (klass == rb_cInteger) {
|
136
136
|
seq_flags = CV_SEQ_ELTYPE_INDEX;
|
137
137
|
}
|
138
138
|
else {
|
@@ -146,14 +146,14 @@ class2seq_flags_value(VALUE klass) {
|
|
146
146
|
* Constructor
|
147
147
|
*
|
148
148
|
* @overload new(seq_flags, storage = nil)
|
149
|
-
* @param [
|
149
|
+
* @param [Integer] seq_flags Flags of the created sequence, which are combinations of
|
150
150
|
* the element types and sequence types.
|
151
151
|
* - Element type:
|
152
152
|
* - <tt>CV_SEQ_ELTYPE_POINT</tt>: {CvPoint}
|
153
153
|
* - <tt>CV_32FC2</tt>: {CvPoint2D32f}
|
154
154
|
* - <tt>CV_SEQ_ELTYPE_POINT3D</tt>: {CvPoint3D32f}
|
155
|
-
* - <tt>CV_SEQ_ELTYPE_INDEX</tt>:
|
156
|
-
* - <tt>CV_SEQ_ELTYPE_CODE</tt>:
|
155
|
+
* - <tt>CV_SEQ_ELTYPE_INDEX</tt>: Integer
|
156
|
+
* - <tt>CV_SEQ_ELTYPE_CODE</tt>: Integer (Freeman code)
|
157
157
|
* - Sequence type:
|
158
158
|
* - <tt>CV_SEQ_KIND_GENERIC</tt>: Generic sequence
|
159
159
|
* - <tt>CV_SEQ_KIND_CURVE</tt>: Curve
|
@@ -421,7 +421,7 @@ rb_pop(VALUE self)
|
|
421
421
|
VALUE object = Qnil;
|
422
422
|
VALUE klass = seqblock_class(seq);
|
423
423
|
try {
|
424
|
-
if (klass ==
|
424
|
+
if (klass == rb_cInteger) {
|
425
425
|
int n = 0;
|
426
426
|
cvSeqPop(seq, &n);
|
427
427
|
object = INT2FIX(n);
|
@@ -489,7 +489,7 @@ rb_shift(VALUE self)
|
|
489
489
|
|
490
490
|
VALUE object = Qnil;
|
491
491
|
try {
|
492
|
-
if (seqblock_class(seq) ==
|
492
|
+
if (seqblock_class(seq) == rb_cInteger) {
|
493
493
|
int n = 0;
|
494
494
|
cvSeqPopFront(seq, &n);
|
495
495
|
object = INT2NUM(n);
|
@@ -525,7 +525,7 @@ rb_each(VALUE self)
|
|
525
525
|
if (seq->total > 0) {
|
526
526
|
VALUE klass = seqblock_class(seq);
|
527
527
|
try {
|
528
|
-
if (klass ==
|
528
|
+
if (klass == rb_cInteger)
|
529
529
|
for (int i = 0; i < seq->total; ++i)
|
530
530
|
rb_yield(INT2NUM(*CV_GET_SEQ_ELEM(int, seq, i)));
|
531
531
|
else
|
@@ -567,10 +567,10 @@ rb_insert(VALUE self, VALUE index, VALUE object)
|
|
567
567
|
Check_Type(index, T_FIXNUM);
|
568
568
|
CvSeq *seq = CVSEQ(self);
|
569
569
|
VALUE klass = seqblock_class(seq);
|
570
|
-
if (
|
570
|
+
if (!rb_obj_is_kind_of(object, klass))
|
571
571
|
rb_raise(rb_eTypeError, "arguments should be %s.", rb_class2name(klass));
|
572
572
|
try {
|
573
|
-
if (klass ==
|
573
|
+
if (klass == rb_cInteger) {
|
574
574
|
int n = NUM2INT(object);
|
575
575
|
cvSeqInsert(seq, NUM2INT(index), &n);
|
576
576
|
}
|
data/ext/opencv/cvsize.cpp
CHANGED
data/ext/opencv/cvtwopoints.cpp
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* Document-class: OpenCV::CvTwoPoints
|
13
13
|
*
|
14
14
|
* This class means one twopoints on X axis Y axis.
|
15
|
-
* X and Y takes the value of the
|
15
|
+
* X and Y takes the value of the Integer. see also CvTwopoints2D32F
|
16
16
|
*
|
17
17
|
* C structure is here, very simple.
|
18
18
|
* typdef struct CvTwopoints {
|
data/ext/opencv/iplimage.cpp
CHANGED
@@ -193,7 +193,7 @@ rb_reset_roi(VALUE self)
|
|
193
193
|
}
|
194
194
|
|
195
195
|
/*
|
196
|
-
* Return COI as
|
196
|
+
* Return COI as Integer.
|
197
197
|
*/
|
198
198
|
VALUE
|
199
199
|
rb_get_coi(VALUE self)
|
@@ -213,7 +213,7 @@ rb_get_coi(VALUE self)
|
|
213
213
|
* set_coi(coi)
|
214
214
|
* set_coi(coi){|image| ...}
|
215
215
|
*
|
216
|
-
* Set COI. <i>coi</i> should be
|
216
|
+
* Set COI. <i>coi</i> should be Integer.
|
217
217
|
* Return self.
|
218
218
|
*/
|
219
219
|
VALUE
|
data/ext/opencv/trackbar.cpp
CHANGED
@@ -47,7 +47,7 @@ void trackbar_free(void *ptr) {
|
|
47
47
|
*
|
48
48
|
* Create new Trackbar.
|
49
49
|
* <i>name</i> should be String.
|
50
|
-
* <i>maxval</i> and <i>val</i> should be
|
50
|
+
* <i>maxval</i> and <i>val</i> should be Integer.
|
51
51
|
* When Trackbar adjuster changed, block will be called.
|
52
52
|
*/
|
53
53
|
VALUE rb_initialize(int argc, VALUE *argv, VALUE self) {
|
data/lib/opencv/version.rb
CHANGED
data/ruby-opencv.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: ruby-opencv 0.0.
|
2
|
+
# stub: ruby-opencv 0.0.18.20170306223602 ruby lib
|
3
3
|
# stub: ext/opencv/extconf.rb
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "ruby-opencv".freeze
|
7
|
-
s.version = "0.0.
|
7
|
+
s.version = "0.0.18.20170306223602"
|
8
8
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
10
10
|
s.require_paths = ["lib".freeze]
|
11
11
|
s.authors = ["lsxi".freeze, "ser1zw".freeze, "pcting".freeze]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2017-03-06"
|
13
13
|
s.description = "ruby-opencv is a wrapper of OpenCV for Ruby. It helps you to write computer vision programs (e.g. detecting faces from pictures) with Ruby.".freeze
|
14
14
|
s.email = ["masakazu.yonekura@gmail.com".freeze, "azariahsawtikes@gmail.com".freeze, "pcting@gmail.com".freeze]
|
15
15
|
s.extensions = ["ext/opencv/extconf.rb".freeze]
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.homepage = "https://github.com/ruby-opencv/ruby-opencv/".freeze
|
19
19
|
s.licenses = ["BSD-3-Clause".freeze]
|
20
20
|
s.rdoc_options = ["--main".freeze, "README.md".freeze]
|
21
|
-
s.rubygems_version = "2.6.
|
21
|
+
s.rubygems_version = "2.6.10".freeze
|
22
22
|
s.summary = "OpenCV wrapper for Ruby".freeze
|
23
23
|
|
24
24
|
if s.respond_to? :specification_version then
|
data/test/test_cvavgcomp.rb
CHANGED
data/test/test_cvchain.rb
CHANGED
@@ -42,7 +42,7 @@ class TestCvChain < OpenCVTestCase
|
|
42
42
|
}
|
43
43
|
chain = mat0.find_contours(:mode => CV_RETR_EXTERNAL, :method => CV_CHAIN_CODE)
|
44
44
|
assert_equal(Array, chain.codes.class)
|
45
|
-
assert(chain.codes.all? { |a| (
|
45
|
+
assert(chain.codes.all? { |a| (Integer === a) and (a >= 0 and a <= 7) })
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_points
|
data/test/test_cvseq.rb
CHANGED
@@ -67,7 +67,7 @@ class TestCvSeq < OpenCVTestCase
|
|
67
67
|
|
68
68
|
seq2 = CvSeq.new(CV_SEQ_ELTYPE_INDEX)
|
69
69
|
seq2.push(10, 20, 30)
|
70
|
-
|
70
|
+
assert_kind_of(Integer, seq2[0])
|
71
71
|
assert_equal(10, seq2[0])
|
72
72
|
assert_equal(20, seq2[1])
|
73
73
|
assert_equal(30, seq2[2])
|
@@ -101,7 +101,7 @@ class TestCvSeq < OpenCVTestCase
|
|
101
101
|
seq4 = CvSeq.new(CV_SEQ_ELTYPE_INDEX).push(20, 30)
|
102
102
|
seq3.push(seq4)
|
103
103
|
assert_equal(3, seq3.total)
|
104
|
-
|
104
|
+
assert_kind_of(Integer, seq3[0])
|
105
105
|
assert_equal(10, seq3[0])
|
106
106
|
assert_equal(20, seq3[1])
|
107
107
|
assert_equal(30, seq3[2])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-opencv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lsxi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdoc
|
@@ -346,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
346
346
|
version: '0'
|
347
347
|
requirements: []
|
348
348
|
rubyforge_project:
|
349
|
-
rubygems_version: 2.6.
|
349
|
+
rubygems_version: 2.6.10
|
350
350
|
signing_key:
|
351
351
|
specification_version: 4
|
352
352
|
summary: OpenCV wrapper for Ruby
|