bonanza-ruby-opencv 0.0.13.20160519171728 → 0.0.13.20160606151615
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/opencv/cvchain.cpp +1 -1
- data/ext/opencv/cvcontour.cpp +1 -1
- data/ext/opencv/cvseq.cpp +24 -34
- data/ext/opencv/cvseq.h +2 -3
- data/ruby-opencv.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91bfc9008859d46d0479cd66dfca85f5e5ddb9f5
|
4
|
+
data.tar.gz: 70ee2ee23b9045d84afae30f5743279b132c2bdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea2b575c88cf9329f292fb616ee99b1d08de15b6dbf92a24f98744456f96ab455f5f1f712ef379f6384cf65e3abbd5d365973316ce094de75aaadd0e96b0b8f
|
7
|
+
data.tar.gz: b9b6f58531636b5dc8e89d7b75a6d1b54d26ac5a8f7af0ddeafc0a593e5c7dc011836c0b2e448a0ae86e06003bc95bc6edabcea29ecb3a24086cdbf2a8a9c1f3
|
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(
|
65
|
+
cCvSeq::register_elem_class(self, rb_cFixnum);
|
66
66
|
register_root_object(self_ptr, storage_value);
|
67
67
|
|
68
68
|
return self;
|
data/ext/opencv/cvcontour.cpp
CHANGED
@@ -65,7 +65,7 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
65
65
|
catch (cv::Exception& e) {
|
66
66
|
raise_cverror(e);
|
67
67
|
}
|
68
|
-
cCvSeq::register_elem_class(
|
68
|
+
cCvSeq::register_elem_class(self, cCvPoint::rb_class());
|
69
69
|
register_root_object(CVSEQ(self), storage);
|
70
70
|
|
71
71
|
return self;
|
data/ext/opencv/cvseq.cpp
CHANGED
@@ -39,8 +39,6 @@ VALUE rb_allocate(VALUE klass);
|
|
39
39
|
void cvseq_free(void *ptr);
|
40
40
|
|
41
41
|
VALUE rb_klass;
|
42
|
-
// contain sequence-block class
|
43
|
-
st_table *seqblock_klass_table = st_init_numtable();
|
44
42
|
|
45
43
|
VALUE
|
46
44
|
rb_class()
|
@@ -49,35 +47,26 @@ rb_class()
|
|
49
47
|
}
|
50
48
|
|
51
49
|
VALUE
|
52
|
-
seqblock_class(
|
50
|
+
seqblock_class(VALUE object)
|
53
51
|
{
|
54
|
-
VALUE klass;
|
55
|
-
if (!
|
52
|
+
VALUE klass = rb_iv_get(object, "@elem_class");
|
53
|
+
if (!RTEST(klass)) {
|
56
54
|
rb_raise(rb_eTypeError, "Invalid sequence error.");
|
57
55
|
}
|
58
56
|
return klass;
|
59
57
|
}
|
60
58
|
|
61
59
|
void
|
62
|
-
register_elem_class(
|
60
|
+
register_elem_class(VALUE object, VALUE klass)
|
63
61
|
{
|
64
|
-
|
65
|
-
}
|
66
|
-
|
67
|
-
void
|
68
|
-
unregister_elem_class(void *ptr)
|
69
|
-
{
|
70
|
-
if (ptr) {
|
71
|
-
st_delete(seqblock_klass_table, (st_data_t*)&ptr, NULL);
|
72
|
-
unregister_object(ptr);
|
73
|
-
}
|
62
|
+
rb_iv_set(object, "@elem_class", klass);
|
74
63
|
}
|
75
64
|
|
76
65
|
VALUE
|
77
66
|
rb_allocate(VALUE klass)
|
78
67
|
{
|
79
68
|
CvSeq *ptr = ALLOC(CvSeq);
|
80
|
-
return Data_Wrap_Struct(klass, 0,
|
69
|
+
return Data_Wrap_Struct(klass, 0, 0, ptr);
|
81
70
|
}
|
82
71
|
|
83
72
|
/*
|
@@ -133,7 +122,7 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
133
122
|
raise_cverror(e);
|
134
123
|
}
|
135
124
|
DATA_PTR(self) = seq;
|
136
|
-
register_elem_class(
|
125
|
+
register_elem_class(self, klass);
|
137
126
|
register_root_object(seq, storage_value);
|
138
127
|
|
139
128
|
return self;
|
@@ -181,10 +170,10 @@ rb_aref(VALUE self, VALUE index)
|
|
181
170
|
|
182
171
|
VALUE result = Qnil;
|
183
172
|
try {
|
184
|
-
if (seqblock_class(
|
173
|
+
if (seqblock_class(self) == rb_cFixnum)
|
185
174
|
result = INT2NUM(*CV_GET_SEQ_ELEM(int, seq, idx));
|
186
175
|
else
|
187
|
-
result = REFER_OBJECT(seqblock_class(
|
176
|
+
result = REFER_OBJECT(seqblock_class(self), cvGetSeqElem(seq, idx), self);
|
188
177
|
}
|
189
178
|
catch (cv::Exception& e) {
|
190
179
|
raise_cverror(e);
|
@@ -228,7 +217,7 @@ rb_h_prev(VALUE self)
|
|
228
217
|
{
|
229
218
|
CvSeq *seq = CVSEQ(self);
|
230
219
|
if (seq->h_prev)
|
231
|
-
return new_sequence(CLASS_OF(self), seq->h_prev, seqblock_class(
|
220
|
+
return new_sequence(CLASS_OF(self), seq->h_prev, seqblock_class(self), lookup_root_object(seq));
|
232
221
|
else
|
233
222
|
return Qnil;
|
234
223
|
}
|
@@ -245,7 +234,7 @@ rb_h_next(VALUE self)
|
|
245
234
|
{
|
246
235
|
CvSeq *seq = CVSEQ(self);
|
247
236
|
if (seq->h_next)
|
248
|
-
return new_sequence(CLASS_OF(self), seq->h_next, seqblock_class(
|
237
|
+
return new_sequence(CLASS_OF(self), seq->h_next, seqblock_class(self), lookup_root_object(seq));
|
249
238
|
else
|
250
239
|
return Qnil;
|
251
240
|
}
|
@@ -262,7 +251,7 @@ rb_v_prev(VALUE self)
|
|
262
251
|
{
|
263
252
|
CvSeq *seq = CVSEQ(self);
|
264
253
|
if (seq->v_prev)
|
265
|
-
return new_sequence(CLASS_OF(self), seq->v_prev, seqblock_class(
|
254
|
+
return new_sequence(CLASS_OF(self), seq->v_prev, seqblock_class(self), lookup_root_object(seq));
|
266
255
|
else
|
267
256
|
return Qnil;
|
268
257
|
}
|
@@ -279,7 +268,7 @@ rb_v_next(VALUE self)
|
|
279
268
|
{
|
280
269
|
CvSeq *seq = CVSEQ(self);
|
281
270
|
if (seq->v_next)
|
282
|
-
return new_sequence(CLASS_OF(self), seq->v_next, seqblock_class(
|
271
|
+
return new_sequence(CLASS_OF(self), seq->v_next, seqblock_class(self), lookup_root_object(seq));
|
283
272
|
else
|
284
273
|
return Qnil;
|
285
274
|
}
|
@@ -288,7 +277,7 @@ VALUE
|
|
288
277
|
rb_seq_push(VALUE self, VALUE args, int flag)
|
289
278
|
{
|
290
279
|
CvSeq *seq = CVSEQ(self);
|
291
|
-
VALUE klass = seqblock_class(
|
280
|
+
VALUE klass = seqblock_class(self), object;
|
292
281
|
volatile void *elem = NULL;
|
293
282
|
int len = RARRAY_LEN(args);
|
294
283
|
for (int i = 0; i < len; ++i) {
|
@@ -361,7 +350,7 @@ rb_pop(VALUE self)
|
|
361
350
|
return Qnil;
|
362
351
|
|
363
352
|
VALUE object = Qnil;
|
364
|
-
VALUE klass = seqblock_class(
|
353
|
+
VALUE klass = seqblock_class(self);
|
365
354
|
try {
|
366
355
|
if (klass == rb_cFixnum) {
|
367
356
|
int n = 0;
|
@@ -431,13 +420,13 @@ rb_shift(VALUE self)
|
|
431
420
|
|
432
421
|
VALUE object = Qnil;
|
433
422
|
try {
|
434
|
-
if (seqblock_class(
|
423
|
+
if (seqblock_class(self) == rb_cFixnum) {
|
435
424
|
int n = 0;
|
436
425
|
cvSeqPopFront(seq, &n);
|
437
426
|
object = INT2NUM(n);
|
438
427
|
}
|
439
428
|
else {
|
440
|
-
object = GENERIC_OBJECT(seqblock_class(
|
429
|
+
object = GENERIC_OBJECT(seqblock_class(self), malloc(seq->elem_size));
|
441
430
|
cvSeqPopFront(seq, DATA_PTR(object));
|
442
431
|
}
|
443
432
|
}
|
@@ -465,7 +454,7 @@ rb_each(VALUE self)
|
|
465
454
|
{
|
466
455
|
CvSeq *seq = CVSEQ(self);
|
467
456
|
if (seq->total > 0) {
|
468
|
-
VALUE klass = seqblock_class(
|
457
|
+
VALUE klass = seqblock_class(self);
|
469
458
|
try {
|
470
459
|
if (klass == rb_cFixnum)
|
471
460
|
for (int i = 0; i < seq->total; ++i)
|
@@ -508,7 +497,7 @@ rb_insert(VALUE self, VALUE index, VALUE object)
|
|
508
497
|
{
|
509
498
|
Check_Type(index, T_FIXNUM);
|
510
499
|
CvSeq *seq = CVSEQ(self);
|
511
|
-
VALUE klass = seqblock_class(
|
500
|
+
VALUE klass = seqblock_class(self);
|
512
501
|
if (CLASS_OF(object) != klass)
|
513
502
|
rb_raise(rb_eTypeError, "arguments should be %s.", rb_class2name(klass));
|
514
503
|
try {
|
@@ -547,10 +536,11 @@ VALUE
|
|
547
536
|
new_sequence(VALUE klass, CvSeq *seq, VALUE element_klass, VALUE storage)
|
548
537
|
{
|
549
538
|
register_root_object(seq, storage);
|
550
|
-
|
551
|
-
if (!NIL_P(element_klass))
|
552
|
-
register_elem_class(
|
553
|
-
|
539
|
+
VALUE object = Data_Wrap_Struct(klass, mark_root_object, 0, seq);
|
540
|
+
if (!NIL_P(element_klass)) {
|
541
|
+
register_elem_class(object, element_klass);
|
542
|
+
}
|
543
|
+
return object;
|
554
544
|
}
|
555
545
|
|
556
546
|
void
|
data/ext/opencv/cvseq.h
CHANGED
@@ -21,9 +21,8 @@ __NAMESPACE_BEGIN_CVSEQ
|
|
21
21
|
VALUE rb_class();
|
22
22
|
void init_ruby_class();
|
23
23
|
|
24
|
-
VALUE seqblock_class(
|
25
|
-
void register_elem_class(
|
26
|
-
void unregister_elem_class(void *ptr);
|
24
|
+
VALUE seqblock_class(VALUE object);
|
25
|
+
void register_elem_class(VALUE object, VALUE klass);
|
27
26
|
|
28
27
|
VALUE rb_allocate(VALUE klass);
|
29
28
|
|
data/ruby-opencv.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: ruby-opencv 0.0.13.
|
2
|
+
# stub: ruby-opencv 0.0.13.20160606151615 ruby lib
|
3
3
|
# stub: ext/opencv/extconf.rb
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "bonanza-ruby-opencv"
|
7
|
-
s.version = "0.0.13.
|
7
|
+
s.version = "0.0.13.20160606151615"
|
8
8
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
10
|
s.require_paths = ["lib"]
|
11
11
|
s.authors = ["lsxi", "ser1zw", "pcting"]
|
12
|
-
s.date = "2016-
|
12
|
+
s.date = "2016-06-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."
|
14
14
|
s.email = ["masakazu.yonekura@gmail.com", "azariahsawtikes@gmail.com", "pcting@gmail.com"]
|
15
15
|
s.extensions = ["ext/opencv/extconf.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonanza-ruby-opencv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.13.
|
4
|
+
version: 0.0.13.20160606151615
|
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: 2016-
|
13
|
+
date: 2016-06-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdoc
|