ruby-opencv 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4167570217e86b8b50a744e19375a4e6691f879a
4
- data.tar.gz: 3bb849ae998b8330cecfcc29ba8e2cd164b0168d
3
+ metadata.gz: a9ab69e46cbd94956c429710dd017b78ee16f718
4
+ data.tar.gz: f6773286bb9c80677d4c35da2b24608991c104a9
5
5
  SHA512:
6
- metadata.gz: a5a43d61e47c1364e42b0a33b27b589939caace91b878dcfda4174a02d0be78ac631e39c20e7b2af55766089bb01abd1c8be8a8f701542d36ef3806ddb121fb3
7
- data.tar.gz: a577c48d4261d033b25fd5e72e1f108db091920604ab95d1bc7482ba129303d2bc6641ca8c5e993fa41e73c6c65588f331001eec1f84aaf5038855e60f8cd536
6
+ metadata.gz: b90d2239d49e50a6f08b1d79cb584e0f035f4951debeadf308e8996a7c5baf5428c3419efc4a55d39aacd3037e4671627fdfb47e54c6c839b394d1beb590450e
7
+ data.tar.gz: '089851b80f9cb2dadefb8f432fd25da0bb83c9e6726d217456cc8d8b4540c20d8629ea299dfbcfbaec21a9c8b5b684aa7f4325d68bba24303c6a930c6ad7879e'
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ Hoe.plugin :gemspec
17
17
  hoespec = Hoe.spec 'ruby-opencv' do |s|
18
18
  s.summary = 'OpenCV wrapper for Ruby'
19
19
  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.'
20
- s.licenses = ['The BSD License']
20
+ s.licenses = ['BSD-3-Clause']
21
21
  s.developer('lsxi', 'masakazu.yonekura@gmail.com')
22
22
  s.developer('ser1zw', 'azariahsawtikes@gmail.com')
23
23
  s.developer('pcting', 'pcting@gmail.com')
@@ -292,6 +292,39 @@ rb_point_polygon_test(VALUE self, VALUE point, VALUE measure_dist)
292
292
  return rb_float_new(dist);
293
293
  }
294
294
 
295
+ /*
296
+ * call-seq:
297
+ * match_shapes(object, method) -> float
298
+ *
299
+ * Compares two shapes(self and object). <i>object</i> should be CvContour.
300
+ *
301
+ * A - object1, B - object2:
302
+ * * method=CV_CONTOURS_MATCH_I1
303
+ * I1(A,B)=sumi=1..7abs(1/mAi - 1/mBi)
304
+ * * method=CV_CONTOURS_MATCH_I2
305
+ * I2(A,B)=sumi=1..7abs(mAi - mBi)
306
+ * * method=CV_CONTOURS_MATCH_I3
307
+ * I3(A,B)=sumi=1..7abs(mAi - mBi)/abs(mAi)
308
+ */
309
+ VALUE
310
+ rb_match_shapes(int argc, VALUE *argv, VALUE self)
311
+ {
312
+ VALUE object, method, param;
313
+ rb_scan_args(argc, argv, "21", &object, &method, &param);
314
+ int method_flag = CVMETHOD("COMPARISON_METHOD", method);
315
+ if (!rb_obj_is_kind_of(object, cCvContour::rb_class()))
316
+ rb_raise(rb_eTypeError, "argument 1 (shape) should be %s",
317
+ rb_class2name(cCvContour::rb_class()));
318
+ double result = 0;
319
+ try {
320
+ result = cvMatchShapes(CVARR(self), CVARR(object), method_flag);
321
+ }
322
+ catch (cv::Exception& e) {
323
+ raise_cverror(e);
324
+ }
325
+ return rb_float_new(result);
326
+ }
327
+
295
328
  VALUE new_object()
296
329
  {
297
330
  VALUE object = rb_allocate(rb_klass);
@@ -343,6 +376,7 @@ init_ruby_class()
343
376
  rb_define_method(rb_klass, "in?", RUBY_METHOD_FUNC(rb_in_q), 1);
344
377
  rb_define_method(rb_klass, "measure_distance", RUBY_METHOD_FUNC(rb_measure_distance), 1);
345
378
  rb_define_method(rb_klass, "point_polygon_test", RUBY_METHOD_FUNC(rb_point_polygon_test), 2);
379
+ rb_define_method(rb_klass, "match_shapes", RUBY_METHOD_FUNC(rb_match_shapes), -1);
346
380
  }
347
381
 
348
382
  __NAMESPACE_END_CVCONTOUR
@@ -33,6 +33,9 @@ VALUE rb_in_q(VALUE self, VALUE point);
33
33
  VALUE rb_measure_distance(VALUE self, VALUE point);
34
34
  VALUE rb_point_polygon_test(VALUE self, VALUE point, VALUE measure_dist);
35
35
 
36
+ /* Matching*/
37
+ VALUE rb_match_shapes(int argc, VALUE *argv, VALUE self);
38
+
36
39
  VALUE new_object();
37
40
  __NAMESPACE_END_CVCONTOUR
38
41
 
data/ext/opencv/cvseq.cpp CHANGED
@@ -27,13 +27,48 @@ rb_class()
27
27
  return rb_klass;
28
28
  }
29
29
 
30
+ int
31
+ eltype2class(int eltype, VALUE* ret) {
32
+ int found = 1;
33
+
34
+ switch (eltype) {
35
+ case CV_SEQ_ELTYPE_POINT:
36
+ *ret = cCvPoint::rb_class();
37
+ break;
38
+ case CV_32FC2:
39
+ *ret = cCvPoint2D32f::rb_class();
40
+ break;
41
+ case CV_SEQ_ELTYPE_POINT3D:
42
+ *ret = cCvPoint3D32f::rb_class();
43
+ break;
44
+ case CV_SEQ_ELTYPE_CODE:
45
+ case CV_SEQ_ELTYPE_INDEX:
46
+ *ret = rb_cFixnum;
47
+ break;
48
+ case CV_SEQ_ELTYPE_PPOINT: // or CV_SEQ_ELTYPE_PTR:
49
+ // Not supported
50
+ rb_raise(rb_eArgError, "seq_flags %d is not supported.", eltype);
51
+ break;
52
+ default:
53
+ found = 0;
54
+ *ret = cCvPoint::rb_class();
55
+ break;
56
+ }
57
+
58
+ return found;
59
+ }
60
+
30
61
  VALUE
31
62
  seqblock_class(void *ptr)
32
63
  {
33
- VALUE klass;
34
- if (!st_lookup(seqblock_klass_table, (st_data_t)ptr, (st_data_t*)&klass)) {
35
- rb_raise(rb_eTypeError, "Invalid sequence error.");
64
+ VALUE klass = Qnil;
65
+ if (st_lookup(seqblock_klass_table, (st_data_t)ptr, (st_data_t*)&klass)) {
66
+ return klass;
36
67
  }
68
+
69
+ int eltype = CV_SEQ_ELTYPE((CvSeq*)ptr);
70
+ eltype2class(eltype, &klass);
71
+
37
72
  return klass;
38
73
  }
39
74
 
@@ -66,28 +101,8 @@ create_seq(int seq_flags, size_t header_size, VALUE storage_value)
66
101
  int eltype = seq_flags & CV_SEQ_ELTYPE_MASK;
67
102
  storage_value = CHECK_CVMEMSTORAGE(storage_value);
68
103
 
69
- switch (eltype) {
70
- case CV_SEQ_ELTYPE_POINT:
71
- klass = cCvPoint::rb_class();
72
- break;
73
- case CV_32FC2:
74
- klass = cCvPoint2D32f::rb_class();
75
- break;
76
- case CV_SEQ_ELTYPE_POINT3D:
77
- klass = cCvPoint3D32f::rb_class();
78
- break;
79
- case CV_SEQ_ELTYPE_CODE:
80
- case CV_SEQ_ELTYPE_INDEX:
81
- klass = rb_cFixnum;
82
- break;
83
- case CV_SEQ_ELTYPE_PPOINT: // or CV_SEQ_ELTYPE_PTR:
84
- // Not supported
85
- rb_raise(rb_eArgError, "seq_flags %d is not supported.", eltype);
86
- break;
87
- default:
104
+ if (!eltype2class(eltype, &klass)) {
88
105
  seq_flags = CV_SEQ_ELTYPE_POINT | CV_SEQ_KIND_GENERIC;
89
- klass = cCvPoint::rb_class();
90
- break;
91
106
  }
92
107
 
93
108
  int mat_type = CV_MAT_TYPE(seq_flags);
data/ext/opencv/opencv.h CHANGED
@@ -153,11 +153,8 @@ extern "C" {
153
153
  // useful macros
154
154
  #define IF_INT(val, ifnone) NIL_P(val) ? ifnone : NUM2INT(val)
155
155
  #define IF_DBL(val, ifnone) NIL_P(val) ? ifnone : NUM2DBL(val)
156
- #define IF_STRING(str) NIL_P(str) ? NULL : TYPE(str) == T_STRING ? rb
157
156
  #define IF_BOOL(val, t, f, ifnone) val == Qtrue ? t : val == Qfalse ? f : ifnone
158
157
 
159
- #define IF_DEPTH(val, ifnone) NIL_P(val) ? ifnone : NUM2INT(val)
160
-
161
158
  #define REGISTER_HASH(hash, str, value) rb_hash_aset(hash, ID2SYM(rb_intern(str)), INT2FIX(value))
162
159
  #define LOOKUP_HASH(hash, key_as_cstr) (rb_hash_lookup(hash, ID2SYM(rb_intern(key_as_cstr))))
163
160
 
@@ -1,4 +1,3 @@
1
1
  module OpenCV
2
- VERSION = '0.0.16'
2
+ VERSION = '0.0.17'
3
3
  end
4
-
data/ruby-opencv.gemspec CHANGED
@@ -1,24 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ruby-opencv 0.0.16.20160417000540 ruby lib
2
+ # stub: ruby-opencv 0.0.17.20160717014809 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.16.20160417000540"
7
+ s.version = "0.0.17"
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 = "2016-04-16"
12
+ s.date = "2016-07-16"
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]
16
16
  s.extra_rdoc_files = ["DEVELOPERS_NOTE.md".freeze, "History.txt".freeze, "License.txt".freeze, "Manifest.txt".freeze, "README.md".freeze, "examples/facerec/readme.md".freeze]
17
17
  s.files = [".gitignore".freeze, ".yardopts".freeze, "DEVELOPERS_NOTE.md".freeze, "Gemfile".freeze, "History.txt".freeze, "License.txt".freeze, "Manifest.txt".freeze, "README.md".freeze, "Rakefile".freeze, "config.yml".freeze, "examples/alpha_blend.rb".freeze, "examples/contours/bitmap-contours-with-labels.png".freeze, "examples/contours/bitmap-contours.png".freeze, "examples/contours/bounding-box-detect-canny.rb".freeze, "examples/contours/contour_retrieval_modes.rb".freeze, "examples/contours/rotated-boxes.jpg".freeze, "examples/convexhull.rb".freeze, "examples/face_detect.rb".freeze, "examples/facerec/create_csv.rb".freeze, "examples/facerec/facerec_eigenfaces.rb".freeze, "examples/facerec/facerec_fisherfaces.rb".freeze, "examples/facerec/facerec_lbph.rb".freeze, "examples/facerec/readme.md".freeze, "examples/find_obj.rb".freeze, "examples/houghcircle.rb".freeze, "examples/images/box.png".freeze, "examples/images/box_in_scene.png".freeze, "examples/images/inpaint.png".freeze, "examples/images/lena-256x256.jpg".freeze, "examples/images/lena-eyes.jpg".freeze, "examples/images/lenna-rotated.jpg".freeze, "examples/images/lenna.jpg".freeze, "examples/images/stuff.jpg".freeze, "examples/images/tiffany.jpg".freeze, "examples/inpaint.rb".freeze, "examples/match_kdtree.rb".freeze, "examples/match_template.rb".freeze, "examples/paint.rb".freeze, "examples/snake.rb".freeze, "ext/opencv/algorithm.cpp".freeze, "ext/opencv/algorithm.h".freeze, "ext/opencv/curve.cpp".freeze, "ext/opencv/curve.h".freeze, "ext/opencv/cvavgcomp.cpp".freeze, "ext/opencv/cvavgcomp.h".freeze, "ext/opencv/cvbox2d.cpp".freeze, "ext/opencv/cvbox2d.h".freeze, "ext/opencv/cvcapture.cpp".freeze, "ext/opencv/cvcapture.h".freeze, "ext/opencv/cvchain.cpp".freeze, "ext/opencv/cvchain.h".freeze, "ext/opencv/cvcircle32f.cpp".freeze, "ext/opencv/cvcircle32f.h".freeze, "ext/opencv/cvconnectedcomp.cpp".freeze, "ext/opencv/cvconnectedcomp.h".freeze, "ext/opencv/cvcontour.cpp".freeze, "ext/opencv/cvcontour.h".freeze, "ext/opencv/cvcontourtree.cpp".freeze, "ext/opencv/cvcontourtree.h".freeze, "ext/opencv/cvconvexitydefect.cpp".freeze, "ext/opencv/cvconvexitydefect.h".freeze, "ext/opencv/cverror.cpp".freeze, "ext/opencv/cverror.h".freeze, "ext/opencv/cvfeaturetree.cpp".freeze, "ext/opencv/cvfeaturetree.h".freeze, "ext/opencv/cvfont.cpp".freeze, "ext/opencv/cvfont.h".freeze, "ext/opencv/cvhaarclassifiercascade.cpp".freeze, "ext/opencv/cvhaarclassifiercascade.h".freeze, "ext/opencv/cvhistogram.cpp".freeze, "ext/opencv/cvhistogram.h".freeze, "ext/opencv/cvhumoments.cpp".freeze, "ext/opencv/cvhumoments.h".freeze, "ext/opencv/cvline.cpp".freeze, "ext/opencv/cvline.h".freeze, "ext/opencv/cvmat.cpp".freeze, "ext/opencv/cvmat.h".freeze, "ext/opencv/cvmemstorage.cpp".freeze, "ext/opencv/cvmemstorage.h".freeze, "ext/opencv/cvmoments.cpp".freeze, "ext/opencv/cvmoments.h".freeze, "ext/opencv/cvpoint.cpp".freeze, "ext/opencv/cvpoint.h".freeze, "ext/opencv/cvpoint2d32f.cpp".freeze, "ext/opencv/cvpoint2d32f.h".freeze, "ext/opencv/cvpoint3d32f.cpp".freeze, "ext/opencv/cvpoint3d32f.h".freeze, "ext/opencv/cvrect.cpp".freeze, "ext/opencv/cvrect.h".freeze, "ext/opencv/cvscalar.cpp".freeze, "ext/opencv/cvscalar.h".freeze, "ext/opencv/cvseq.cpp".freeze, "ext/opencv/cvseq.h".freeze, "ext/opencv/cvsize.cpp".freeze, "ext/opencv/cvsize.h".freeze, "ext/opencv/cvsize2d32f.cpp".freeze, "ext/opencv/cvsize2d32f.h".freeze, "ext/opencv/cvslice.cpp".freeze, "ext/opencv/cvslice.h".freeze, "ext/opencv/cvsurfparams.cpp".freeze, "ext/opencv/cvsurfparams.h".freeze, "ext/opencv/cvsurfpoint.cpp".freeze, "ext/opencv/cvsurfpoint.h".freeze, "ext/opencv/cvtermcriteria.cpp".freeze, "ext/opencv/cvtermcriteria.h".freeze, "ext/opencv/cvtwopoints.cpp".freeze, "ext/opencv/cvtwopoints.h".freeze, "ext/opencv/cvutils.cpp".freeze, "ext/opencv/cvutils.h".freeze, "ext/opencv/cvvideowriter.cpp".freeze, "ext/opencv/cvvideowriter.h".freeze, "ext/opencv/eigenfaces.cpp".freeze, "ext/opencv/eigenfaces.h".freeze, "ext/opencv/extconf.rb".freeze, "ext/opencv/facerecognizer.cpp".freeze, "ext/opencv/facerecognizer.h".freeze, "ext/opencv/fisherfaces.cpp".freeze, "ext/opencv/fisherfaces.h".freeze, "ext/opencv/gui.cpp".freeze, "ext/opencv/gui.h".freeze, "ext/opencv/iplconvkernel.cpp".freeze, "ext/opencv/iplconvkernel.h".freeze, "ext/opencv/iplimage.cpp".freeze, "ext/opencv/iplimage.h".freeze, "ext/opencv/lbph.cpp".freeze, "ext/opencv/lbph.h".freeze, "ext/opencv/mouseevent.cpp".freeze, "ext/opencv/mouseevent.h".freeze, "ext/opencv/opencv.cpp".freeze, "ext/opencv/opencv.h".freeze, "ext/opencv/pointset.cpp".freeze, "ext/opencv/pointset.h".freeze, "ext/opencv/trackbar.cpp".freeze, "ext/opencv/trackbar.h".freeze, "ext/opencv/window.cpp".freeze, "ext/opencv/window.h".freeze, "images/CvMat_sobel.png".freeze, "images/CvMat_sub_rect.png".freeze, "images/CvSeq_relationmap.png".freeze, "lib/opencv.rb".freeze, "lib/opencv/psyched_yaml.rb".freeze, "lib/opencv/version.rb".freeze, "ruby-opencv.gemspec".freeze, "test/eigenfaces_save.xml".freeze, "test/fisherfaces_save.xml".freeze, "test/helper.rb".freeze, "test/lbph_save.xml".freeze, "test/runner.rb".freeze, "test/samples/airplane.jpg".freeze, "test/samples/baboon.jpg".freeze, "test/samples/baboon200.jpg".freeze, "test/samples/baboon200_rotated.jpg".freeze, "test/samples/blank0.jpg".freeze, "test/samples/blank1.jpg".freeze, "test/samples/blank2.jpg".freeze, "test/samples/blank3.jpg".freeze, "test/samples/blank4.jpg".freeze, "test/samples/blank5.jpg".freeze, "test/samples/blank6.jpg".freeze, "test/samples/blank7.jpg".freeze, "test/samples/blank8.jpg".freeze, "test/samples/blank9.jpg".freeze, "test/samples/cat.jpg".freeze, "test/samples/chessboard.jpg".freeze, "test/samples/contours.jpg".freeze, "test/samples/fruits.jpg".freeze, "test/samples/haarcascade_frontalface_alt.xml.gz".freeze, "test/samples/inpaint-mask.bmp".freeze, "test/samples/lena-256x256.jpg".freeze, "test/samples/lena-32x32.jpg".freeze, "test/samples/lena-eyes.jpg".freeze, "test/samples/lena-inpaint.jpg".freeze, "test/samples/lena.jpg".freeze, "test/samples/lines.jpg".freeze, "test/samples/messy0.jpg".freeze, "test/samples/messy1.jpg".freeze, "test/samples/movie_sample.avi".freeze, "test/samples/one_way_train_0000.jpg".freeze, "test/samples/one_way_train_0001.jpg".freeze, "test/samples/partially_blank0.jpg".freeze, "test/samples/partially_blank1.jpg".freeze, "test/samples/smooth0.jpg".freeze, "test/samples/smooth1.jpg".freeze, "test/samples/smooth2.jpg".freeze, "test/samples/smooth3.jpg".freeze, "test/samples/smooth4.jpg".freeze, "test/samples/smooth5.jpg".freeze, "test/samples/smooth6.jpg".freeze, "test/samples/str-cv-rotated.jpg".freeze, "test/samples/str-cv.jpg".freeze, "test/samples/str-ov.jpg".freeze, "test/samples/stuff.jpg".freeze, "test/test_curve.rb".freeze, "test/test_cvavgcomp.rb".freeze, "test/test_cvbox2d.rb".freeze, "test/test_cvcapture.rb".freeze, "test/test_cvchain.rb".freeze, "test/test_cvcircle32f.rb".freeze, "test/test_cvconnectedcomp.rb".freeze, "test/test_cvcontour.rb".freeze, "test/test_cvcontourtree.rb".freeze, "test/test_cverror.rb".freeze, "test/test_cvfeaturetree.rb".freeze, "test/test_cvfont.rb".freeze, "test/test_cvhaarclassifiercascade.rb".freeze, "test/test_cvhistogram.rb".freeze, "test/test_cvhumoments.rb".freeze, "test/test_cvline.rb".freeze, "test/test_cvmat.rb".freeze, "test/test_cvmat_drawing.rb".freeze, "test/test_cvmat_dxt.rb".freeze, "test/test_cvmat_imageprocessing.rb".freeze, "test/test_cvmoments.rb".freeze, "test/test_cvpoint.rb".freeze, "test/test_cvpoint2d32f.rb".freeze, "test/test_cvpoint3d32f.rb".freeze, "test/test_cvrect.rb".freeze, "test/test_cvscalar.rb".freeze, "test/test_cvseq.rb".freeze, "test/test_cvsize.rb".freeze, "test/test_cvsize2d32f.rb".freeze, "test/test_cvslice.rb".freeze, "test/test_cvsurfparams.rb".freeze, "test/test_cvsurfpoint.rb".freeze, "test/test_cvtermcriteria.rb".freeze, "test/test_cvtwopoints.rb".freeze, "test/test_cvvideowriter.rb".freeze, "test/test_eigenfaces.rb".freeze, "test/test_fisherfaces.rb".freeze, "test/test_iplconvkernel.rb".freeze, "test/test_iplimage.rb".freeze, "test/test_lbph.rb".freeze, "test/test_mouseevent.rb".freeze, "test/test_opencv.rb".freeze, "test/test_pointset.rb".freeze, "test/test_preliminary.rb".freeze, "test/test_trackbar.rb".freeze, "test/test_window.rb".freeze, "yard_extension.rb".freeze]
18
18
  s.homepage = "https://github.com/ruby-opencv/ruby-opencv/".freeze
19
- s.licenses = ["The BSD License".freeze]
19
+ s.licenses = ["BSD-3-Clause".freeze]
20
20
  s.rdoc_options = ["--main".freeze, "README.md".freeze]
21
- s.rubygems_version = "2.6.3".freeze
21
+ s.rubygems_version = "2.6.6".freeze
22
22
  s.summary = "OpenCV wrapper for Ruby".freeze
23
23
 
24
24
  if s.respond_to? :specification_version then
data/test/helper.rb CHANGED
@@ -14,6 +14,7 @@ class OpenCVTestCase < Test::Unit::TestCase
14
14
  FILENAME_FRUITS = SAMPLE_DIR + 'fruits.jpg'
15
15
  FILENAME_CONTOURS = File.expand_path(File.dirname(__FILE__)) + '/samples/contours.jpg'
16
16
  FILENAME_CHESSBOARD = SAMPLE_DIR + 'chessboard.jpg'
17
+ FILENAME_LINES = SAMPLE_DIR + 'lines.jpg'
17
18
  HAARCASCADE_FRONTALFACE_ALT = SAMPLE_DIR + 'haarcascade_frontalface_alt.xml.gz'
18
19
  AVI_SAMPLE = SAMPLE_DIR + 'movie_sample.avi'
19
20
 
@@ -146,5 +146,26 @@ class TestCvContour < OpenCVTestCase
146
146
  assert_in_delta(31.01, contour.point_polygon_test(CvPoint.new(64, 64), 1), 0.01)
147
147
  assert_in_delta(31.01, contour.point_polygon_test(CvPoint.new(64, 64), true), 0.01)
148
148
  end
149
- end
150
149
 
150
+ def test_match_shapes
151
+ img1 = CvMat.load(FILENAME_CONTOURS, CV_LOAD_IMAGE_GRAYSCALE).threshold(127, 255, CV_THRESH_BINARY)
152
+ img2 = CvMat.load(FILENAME_LINES, CV_LOAD_IMAGE_GRAYSCALE).threshold(127, 255, CV_THRESH_BINARY)
153
+ c1 = img1.find_contours(mode: CV_RETR_EXTERNAL)
154
+ c2 = img2.find_contours(mode: CV_RETR_EXTERNAL)
155
+
156
+ [CV_CONTOURS_MATCH_I1, CV_CONTOURS_MATCH_I2, CV_CONTOURS_MATCH_I3].each { |method|
157
+ assert_in_delta(0, c1.match_shapes(c1, method), 0.01)
158
+ assert_in_delta(0, c1.match_shapes(c1, method, nil), 0.01)
159
+
160
+ assert(c1.match_shapes(c2, method) > 0)
161
+ assert(c1.match_shapes(c2, method, nil) > 0)
162
+ }
163
+
164
+ assert_raise(TypeError) {
165
+ c1.match_shapes(DUMMY_OBJ, CV_CONTOURS_MATCH_I1)
166
+ }
167
+ assert_raise(TypeError) {
168
+ c1.match_shapes(c2, DUMMY_OBJ)
169
+ }
170
+ end
171
+ end
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.16
4
+ version: 0.0.17
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-04-16 00:00:00.000000000 Z
13
+ date: 2016-07-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdoc
@@ -326,7 +326,7 @@ files:
326
326
  - yard_extension.rb
327
327
  homepage: https://github.com/ruby-opencv/ruby-opencv/
328
328
  licenses:
329
- - The BSD License
329
+ - BSD-3-Clause
330
330
  metadata: {}
331
331
  post_install_message:
332
332
  rdoc_options:
@@ -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.3
349
+ rubygems_version: 2.6.6
350
350
  signing_key:
351
351
  specification_version: 4
352
352
  summary: OpenCV wrapper for Ruby