bonanza-ruby-opencv 0.0.13.20160706180126 → 0.0.13.20170103170729
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 +4 -0
- data/ext/opencv/cvhistogram.cpp +32 -0
- data/ext/opencv/cvmat.cpp +30 -0
- data/ext/opencv/cvseq.cpp +24 -0
- data/ruby-opencv.gemspec +4 -4
- 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: 4b8b6ede2d88a28c3046cc19e81688b8c918956b
|
4
|
+
data.tar.gz: 97e6bd52ad70913551b7ccfa884ed88463694e70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47f88a62f00c3c3b2116a2b7106834e9eb7cafc2108313ad38674b196d41cf35d187a05b632215827a4c81428d53e4881dcbd23bce9ccf57d9f7c1b87d6be870
|
7
|
+
data.tar.gz: 2ed38a4df87cdf9507e2fa1dcb850fac2072eb1c87e06f9fd52b29a0612389fc050c41d9db897ceabf9050d1c93c15fd55331611d9e5f951365f93e7c67cb4a4
|
data/ext/opencv/cvchain.cpp
CHANGED
@@ -62,7 +62,11 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
62
62
|
raise_cverror(e);
|
63
63
|
}
|
64
64
|
CvSeq* self_ptr = CVSEQ(self);
|
65
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
66
|
+
cCvSeq::register_elem_class(self, rb_cInteger);
|
67
|
+
#else
|
65
68
|
cCvSeq::register_elem_class(self, rb_cFixnum);
|
69
|
+
#endif
|
66
70
|
register_root_object(self_ptr, storage_value);
|
67
71
|
|
68
72
|
return self;
|
data/ext/opencv/cvhistogram.cpp
CHANGED
@@ -257,6 +257,36 @@ rb_aref(VALUE self, VALUE args)
|
|
257
257
|
return rb_float_new((double)value);
|
258
258
|
}
|
259
259
|
|
260
|
+
VALUE
|
261
|
+
rb_at(VALUE self, VALUE x)
|
262
|
+
{
|
263
|
+
float value = 0.0;
|
264
|
+
CvHistogram* self_ptr = CVHISTOGRAM(self);
|
265
|
+
try {
|
266
|
+
value = cvQueryHistValue_1D(self_ptr, NUM2INT(x));
|
267
|
+
}
|
268
|
+
catch (cv::Exception& e) {
|
269
|
+
raise_cverror(e);
|
270
|
+
}
|
271
|
+
|
272
|
+
return rb_float_new((double)value);
|
273
|
+
}
|
274
|
+
|
275
|
+
VALUE
|
276
|
+
rb_at_3d(VALUE self, VALUE x, VALUE y, VALUE z)
|
277
|
+
{
|
278
|
+
float value = 0.0;
|
279
|
+
CvHistogram* self_ptr = CVHISTOGRAM(self);
|
280
|
+
try {
|
281
|
+
value = cvQueryHistValue_3D(self_ptr, NUM2INT(x), NUM2INT(y), NUM2INT(z));
|
282
|
+
}
|
283
|
+
catch (cv::Exception& e) {
|
284
|
+
raise_cverror(e);
|
285
|
+
}
|
286
|
+
|
287
|
+
return rb_float_new((double)value);
|
288
|
+
}
|
289
|
+
|
260
290
|
/*
|
261
291
|
* Finds the minimum and maximum histogram bins.
|
262
292
|
* @overload min_max_value
|
@@ -682,6 +712,8 @@ init_ruby_class()
|
|
682
712
|
rb_define_method(rb_klass, "calc_hist", RUBY_METHOD_FUNC(rb_calc_hist), -1);
|
683
713
|
rb_define_method(rb_klass, "calc_hist!", RUBY_METHOD_FUNC(rb_calc_hist_bang), -1);
|
684
714
|
rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), -2);
|
715
|
+
rb_define_method(rb_klass, "at", RUBY_METHOD_FUNC(rb_at), 1);
|
716
|
+
rb_define_method(rb_klass, "at_3d", RUBY_METHOD_FUNC(rb_at_3d), 3);
|
685
717
|
rb_define_alias(rb_klass, "query_hist_value", "[]");
|
686
718
|
rb_define_method(rb_klass, "min_max_value", RUBY_METHOD_FUNC(rb_min_max_value), 0);
|
687
719
|
rb_define_method(rb_klass, "copy_hist", RUBY_METHOD_FUNC(rb_copy_hist), 0);
|
data/ext/opencv/cvmat.cpp
CHANGED
@@ -5192,6 +5192,35 @@ rb_flood_fill_bang(int argc, VALUE *argv, VALUE self)
|
|
5192
5192
|
return rb_ary_new3(3, self, cCvRect::new_object(cvRect(rect.x, rect.y, rect.width, rect.height)), mask);
|
5193
5193
|
}
|
5194
5194
|
|
5195
|
+
VALUE
|
5196
|
+
rb_flood_fill_mask(VALUE self, VALUE seed_point, VALUE mask, VALUE lo_diff, VALUE up_diff, VALUE connectivity, VALUE fixed_range)
|
5197
|
+
{
|
5198
|
+
int flags = NUM2INT(connectivity);
|
5199
|
+
if (RTEST(fixed_range)) {
|
5200
|
+
flags |= CV_FLOODFILL_FIXED_RANGE;
|
5201
|
+
}
|
5202
|
+
flags |= CV_FLOODFILL_MASK_ONLY;
|
5203
|
+
cv::Rect rect;
|
5204
|
+
try {
|
5205
|
+
cv::Mat selfMat(CVMAT(self));
|
5206
|
+
cv::Mat maskMat(CVMAT(mask));
|
5207
|
+
|
5208
|
+
cv::floodFill(
|
5209
|
+
selfMat,
|
5210
|
+
maskMat,
|
5211
|
+
cv::Point(VALUE_TO_CVPOINT(seed_point)),
|
5212
|
+
cv::Scalar(cvScalar(0)),
|
5213
|
+
&rect,
|
5214
|
+
cv::Scalar(NIL_P(lo_diff) ? cvScalar(0) : VALUE_TO_CVSCALAR(lo_diff)),
|
5215
|
+
cv::Scalar(NIL_P(up_diff) ? cvScalar(0) : VALUE_TO_CVSCALAR(up_diff)),
|
5216
|
+
flags);
|
5217
|
+
}
|
5218
|
+
catch (cv::Exception& e) {
|
5219
|
+
raise_cverror(e);
|
5220
|
+
}
|
5221
|
+
return cCvRect::new_object(cvRect(rect.x, rect.y, rect.width, rect.height));
|
5222
|
+
}
|
5223
|
+
|
5195
5224
|
/*
|
5196
5225
|
* Finds contours in binary image.
|
5197
5226
|
*
|
@@ -6845,6 +6874,7 @@ init_ruby_class()
|
|
6845
6874
|
|
6846
6875
|
rb_define_method(rb_klass, "flood_fill", RUBY_METHOD_FUNC(rb_flood_fill), -1);
|
6847
6876
|
rb_define_method(rb_klass, "flood_fill!", RUBY_METHOD_FUNC(rb_flood_fill_bang), -1);
|
6877
|
+
rb_define_method(rb_klass, "flood_fill_mask", RUBY_METHOD_FUNC(rb_flood_fill_mask), 6);
|
6848
6878
|
rb_define_method(rb_klass, "find_contours", RUBY_METHOD_FUNC(rb_find_contours), -1);
|
6849
6879
|
rb_define_method(rb_klass, "find_contours!", RUBY_METHOD_FUNC(rb_find_contours_bang), -1);
|
6850
6880
|
rb_define_method(rb_klass, "draw_contours", RUBY_METHOD_FUNC(rb_draw_contours), -1);
|
data/ext/opencv/cvseq.cpp
CHANGED
@@ -88,7 +88,11 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
88
88
|
raise_typeerror(klass, rb_cClass);
|
89
89
|
|
90
90
|
int type = 0, size = 0;
|
91
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
92
|
+
if (klass == rb_cInteger) {
|
93
|
+
#else
|
91
94
|
if (klass == rb_cFixnum) {
|
95
|
+
#endif
|
92
96
|
type = CV_SEQ_ELTYPE_INDEX;
|
93
97
|
size = sizeof(int);
|
94
98
|
}
|
@@ -170,7 +174,11 @@ rb_aref(VALUE self, VALUE index)
|
|
170
174
|
|
171
175
|
VALUE result = Qnil;
|
172
176
|
try {
|
177
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
178
|
+
if (seqblock_class(self) == rb_cInteger)
|
179
|
+
#else
|
173
180
|
if (seqblock_class(self) == rb_cFixnum)
|
181
|
+
#endif
|
174
182
|
result = INT2NUM(*CV_GET_SEQ_ELEM(int, seq, idx));
|
175
183
|
else
|
176
184
|
result = REFER_OBJECT(seqblock_class(self), cvGetSeqElem(seq, idx), self);
|
@@ -352,7 +360,11 @@ rb_pop(VALUE self)
|
|
352
360
|
VALUE object = Qnil;
|
353
361
|
VALUE klass = seqblock_class(self);
|
354
362
|
try {
|
363
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
364
|
+
if (klass == rb_cInteger) {
|
365
|
+
#else
|
355
366
|
if (klass == rb_cFixnum) {
|
367
|
+
#endif
|
356
368
|
int n = 0;
|
357
369
|
cvSeqPop(seq, &n);
|
358
370
|
object = INT2FIX(n);
|
@@ -420,7 +432,11 @@ rb_shift(VALUE self)
|
|
420
432
|
|
421
433
|
VALUE object = Qnil;
|
422
434
|
try {
|
435
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
436
|
+
if (seqblock_class(self) == rb_cInteger) {
|
437
|
+
#else
|
423
438
|
if (seqblock_class(self) == rb_cFixnum) {
|
439
|
+
#endif
|
424
440
|
int n = 0;
|
425
441
|
cvSeqPopFront(seq, &n);
|
426
442
|
object = INT2NUM(n);
|
@@ -456,7 +472,11 @@ rb_each(VALUE self)
|
|
456
472
|
if (seq->total > 0) {
|
457
473
|
VALUE klass = seqblock_class(self);
|
458
474
|
try {
|
475
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
476
|
+
if (klass == rb_cInteger)
|
477
|
+
#else
|
459
478
|
if (klass == rb_cFixnum)
|
479
|
+
#endif
|
460
480
|
for (int i = 0; i < seq->total; ++i)
|
461
481
|
rb_yield(INT2NUM(*CV_GET_SEQ_ELEM(int, seq, i)));
|
462
482
|
else
|
@@ -501,7 +521,11 @@ rb_insert(VALUE self, VALUE index, VALUE object)
|
|
501
521
|
if (CLASS_OF(object) != klass)
|
502
522
|
rb_raise(rb_eTypeError, "arguments should be %s.", rb_class2name(klass));
|
503
523
|
try {
|
524
|
+
#ifdef RUBY_INTEGER_UNIFICATION
|
525
|
+
if (klass == rb_cInteger) {
|
526
|
+
#else
|
504
527
|
if (klass == rb_cFixnum) {
|
528
|
+
#endif
|
505
529
|
int n = NUM2INT(object);
|
506
530
|
cvSeqInsert(seq, NUM2INT(index), &n);
|
507
531
|
}
|
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.20170103170729 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.20170103170729"
|
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 = "
|
12
|
+
s.date = "2017-01-03"
|
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"]
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.homepage = "https://github.com/ruby-opencv/ruby-opencv/"
|
19
19
|
s.licenses = ["The BSD License"]
|
20
20
|
s.rdoc_options = ["--main", "README.md"]
|
21
|
-
s.rubygems_version = "2.2.2"
|
21
|
+
#s.rubygems_version = "2.2.2"
|
22
22
|
s.summary = "OpenCV wrapper for Ruby"
|
23
23
|
s.test_files = ["test/test_cvcontour.rb", "test/test_eigenfaces.rb", "test/test_cvmoments.rb", "test/test_cvseq.rb", "test/test_cvcontourtree.rb", "test/test_cvbox2d.rb", "test/test_iplimage.rb", "test/test_cvvideowriter.rb", "test/test_cvline.rb", "test/test_cvhumoments.rb", "test/test_cvfont.rb", "test/test_cvconnectedcomp.rb", "test/test_cvhistogram.rb", "test/test_trackbar.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvhaarclassifiercascade.rb", "test/test_cvcircle32f.rb", "test/test_cvcapture.rb", "test/test_cvmat_dxt.rb", "test/test_cvrect.rb", "test/test_iplconvkernel.rb", "test/test_cvsurfpoint.rb", "test/test_cvavgcomp.rb", "test/test_cvscalar.rb", "test/test_pointset.rb", "test/test_curve.rb", "test/test_cvtermcriteria.rb", "test/test_cvtwopoints.rb", "test/test_cvsurfparams.rb", "test/test_cvpoint2d32f.rb", "test/test_cvpoint3d32f.rb", "test/test_cvfeaturetree.rb", "test/test_mouseevent.rb", "test/test_cvchain.rb", "test/test_cvmat.rb", "test/test_fisherfaces.rb", "test/test_cverror.rb", "test/test_cvpoint.rb", "test/test_cvsize2d32f.rb", "test/test_preliminary.rb", "test/test_cvmat_drawing.rb", "test/test_lbph.rb", "test/test_cvsize.rb", "test/test_window.rb", "test/test_cvslice.rb", "test/test_opencv.rb"]
|
24
24
|
|
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.20170103170729
|
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-01-03 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.
|
349
|
+
rubygems_version: 2.5.1
|
350
350
|
signing_key:
|
351
351
|
specification_version: 4
|
352
352
|
summary: OpenCV wrapper for Ruby
|