ruby-opencv 0.0.8-x86-mingw32 → 0.0.9.pre2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/DEVELOPERS_NOTE.md +29 -12
  3. data/Gemfile +1 -2
  4. data/License.txt +30 -30
  5. data/Manifest.txt +5 -4
  6. data/README.md +1 -1
  7. data/Rakefile +62 -4
  8. data/config.yml +7 -0
  9. data/examples/alpha_blend.rb +21 -21
  10. data/examples/find_obj.rb +169 -169
  11. data/examples/match_kdtree.rb +88 -88
  12. data/ext/opencv/cvcapture.cpp +19 -12
  13. data/ext/opencv/cvutils.cpp +192 -194
  14. data/ext/opencv/cvutils.h +30 -29
  15. data/{extconf.rb → ext/opencv/extconf.rb} +12 -4
  16. data/lib/opencv.rb +12 -3
  17. data/lib/opencv/psyched_yaml.rb +22 -22
  18. data/lib/opencv/version.rb +1 -1
  19. data/ruby-opencv.gemspec +17 -16
  20. data/test/helper.rb +1 -1
  21. data/test/runner.rb +30 -30
  22. data/test/test_curve.rb +1 -1
  23. data/test/test_cvavgcomp.rb +24 -24
  24. data/test/test_cvbox2d.rb +76 -76
  25. data/test/test_cvcapture.rb +183 -183
  26. data/test/test_cvchain.rb +108 -108
  27. data/test/test_cvcircle32f.rb +41 -41
  28. data/test/test_cvconnectedcomp.rb +61 -61
  29. data/test/test_cvcontour.rb +150 -150
  30. data/test/test_cvcontourtree.rb +43 -43
  31. data/test/test_cverror.rb +1 -1
  32. data/test/test_cvfeaturetree.rb +65 -65
  33. data/test/test_cvfont.rb +58 -58
  34. data/test/test_cvhaarclassifiercascade.rb +63 -63
  35. data/test/test_cvhistogram.rb +1 -1
  36. data/test/test_cvhumoments.rb +83 -83
  37. data/test/test_cvline.rb +50 -50
  38. data/test/test_cvmat.rb +1 -1
  39. data/test/test_cvmat_drawing.rb +1 -1
  40. data/test/test_cvmat_dxt.rb +1 -1
  41. data/test/test_cvmat_imageprocessing.rb +1 -1
  42. data/test/test_cvmat_matching.rb +1 -1
  43. data/test/test_cvmoments.rb +180 -180
  44. data/test/test_cvpoint.rb +75 -75
  45. data/test/test_cvpoint2d32f.rb +75 -75
  46. data/test/test_cvpoint3d32f.rb +93 -93
  47. data/test/test_cvrect.rb +144 -144
  48. data/test/test_cvscalar.rb +113 -113
  49. data/test/test_cvseq.rb +295 -295
  50. data/test/test_cvsize.rb +75 -75
  51. data/test/test_cvsize2d32f.rb +75 -75
  52. data/test/test_cvslice.rb +31 -31
  53. data/test/test_cvsurfparams.rb +57 -57
  54. data/test/test_cvsurfpoint.rb +66 -66
  55. data/test/test_cvtermcriteria.rb +56 -56
  56. data/test/test_cvtwopoints.rb +40 -40
  57. data/test/test_cvvideowriter.rb +58 -58
  58. data/test/test_iplconvkernel.rb +54 -54
  59. data/test/test_iplimage.rb +1 -1
  60. data/test/test_mouseevent.rb +17 -17
  61. data/test/test_opencv.rb +1 -1
  62. data/test/test_pointset.rb +1 -1
  63. data/test/test_preliminary.rb +130 -130
  64. data/test/test_trackbar.rb +47 -47
  65. data/test/test_window.rb +115 -115
  66. metadata +26 -54
  67. data/ext/opencv/lib/opencv.rb +0 -3
  68. data/ext/opencv/lib/opencv/psyched_yaml.rb +0 -22
  69. data/ext/opencv/lib/opencv/version.rb +0 -3
@@ -1,66 +1,66 @@
1
- #!/usr/bin/env ruby
2
- # -*- mode: ruby; coding: utf-8-unix -*-
3
- require 'test/unit'
4
- require 'opencv'
5
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
-
7
- include OpenCV
8
-
9
- # Tests for OpenCV::CvSURFPoint
10
- class TestCvSURFPoint < OpenCVTestCase
11
- def setup
12
- @surf_point1 = CvSURFPoint.new(CvPoint2D32f.new(0, 0), 0, 0, 0, 0)
13
- end
14
-
15
- def test_initialize
16
- sp1 = CvSURFPoint.new(CvPoint2D32f.new(1.1, 2.2), 1, 10, 12.3, 45.6)
17
- assert_in_delta(1.1, sp1.pt.x, 0.001)
18
- assert_in_delta(2.2, sp1.pt.y, 0.001)
19
- assert_equal(1, sp1.laplacian)
20
- assert_equal(10, sp1.size)
21
- assert_in_delta(12.3, sp1.dir, 0.001)
22
- assert_in_delta(45.6, sp1.hessian, 0.001)
23
- end
24
-
25
- def test_pt
26
- assert_in_delta(0, @surf_point1.pt.x, 0.001)
27
- assert_in_delta(0, @surf_point1.pt.y, 0.001)
28
-
29
- @surf_point1.pt = CvPoint2D32f.new(12.3, 45.6)
30
- assert_in_delta(12.3, @surf_point1.pt.x, 0.001)
31
- assert_in_delta(45.6, @surf_point1.pt.y, 0.001)
32
-
33
- assert_raise(TypeError) {
34
- @surf_point1.pt = DUMMY_OBJ
35
- }
36
- end
37
-
38
- def test_laplacian
39
- assert_equal(0, @surf_point1.laplacian)
40
-
41
- @surf_point1.laplacian = -1
42
- assert_equal(-1, @surf_point1.laplacian)
43
- end
44
-
45
- def test_size
46
- assert_equal(0, @surf_point1.size)
47
-
48
- @surf_point1.size = 10
49
- assert_equal(10, @surf_point1.size)
50
- end
51
-
52
- def test_dir
53
- assert_in_delta(0, @surf_point1.dir, 0.001)
54
-
55
- @surf_point1.dir = 23.4
56
- assert_in_delta(23.4, @surf_point1.dir, 0.001)
57
- end
58
-
59
- def test_hessian
60
- assert_in_delta(0, @surf_point1.hessian, 0.001)
61
-
62
- @surf_point1.hessian = 2.1
63
- assert_in_delta(2.1, @surf_point1.hessian, 0.001)
64
- end
65
- end
66
-
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8 -*-
3
+ require 'test/unit'
4
+ require 'opencv'
5
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
+
7
+ include OpenCV
8
+
9
+ # Tests for OpenCV::CvSURFPoint
10
+ class TestCvSURFPoint < OpenCVTestCase
11
+ def setup
12
+ @surf_point1 = CvSURFPoint.new(CvPoint2D32f.new(0, 0), 0, 0, 0, 0)
13
+ end
14
+
15
+ def test_initialize
16
+ sp1 = CvSURFPoint.new(CvPoint2D32f.new(1.1, 2.2), 1, 10, 12.3, 45.6)
17
+ assert_in_delta(1.1, sp1.pt.x, 0.001)
18
+ assert_in_delta(2.2, sp1.pt.y, 0.001)
19
+ assert_equal(1, sp1.laplacian)
20
+ assert_equal(10, sp1.size)
21
+ assert_in_delta(12.3, sp1.dir, 0.001)
22
+ assert_in_delta(45.6, sp1.hessian, 0.001)
23
+ end
24
+
25
+ def test_pt
26
+ assert_in_delta(0, @surf_point1.pt.x, 0.001)
27
+ assert_in_delta(0, @surf_point1.pt.y, 0.001)
28
+
29
+ @surf_point1.pt = CvPoint2D32f.new(12.3, 45.6)
30
+ assert_in_delta(12.3, @surf_point1.pt.x, 0.001)
31
+ assert_in_delta(45.6, @surf_point1.pt.y, 0.001)
32
+
33
+ assert_raise(TypeError) {
34
+ @surf_point1.pt = DUMMY_OBJ
35
+ }
36
+ end
37
+
38
+ def test_laplacian
39
+ assert_equal(0, @surf_point1.laplacian)
40
+
41
+ @surf_point1.laplacian = -1
42
+ assert_equal(-1, @surf_point1.laplacian)
43
+ end
44
+
45
+ def test_size
46
+ assert_equal(0, @surf_point1.size)
47
+
48
+ @surf_point1.size = 10
49
+ assert_equal(10, @surf_point1.size)
50
+ end
51
+
52
+ def test_dir
53
+ assert_in_delta(0, @surf_point1.dir, 0.001)
54
+
55
+ @surf_point1.dir = 23.4
56
+ assert_in_delta(23.4, @surf_point1.dir, 0.001)
57
+ end
58
+
59
+ def test_hessian
60
+ assert_in_delta(0, @surf_point1.hessian, 0.001)
61
+
62
+ @surf_point1.hessian = 2.1
63
+ assert_in_delta(2.1, @surf_point1.hessian, 0.001)
64
+ end
65
+ end
66
+
@@ -1,56 +1,56 @@
1
- #!/usr/bin/env ruby
2
- # -*- mode: ruby; coding: utf-8-unix -*-
3
- require 'test/unit'
4
- require 'opencv'
5
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
-
7
- include OpenCV
8
-
9
- # Tests for OpenCV::CvTermCriteria
10
- class TestCvTermCriteria < OpenCVTestCase
11
- def setup
12
- @criteria1 = CvTermCriteria.new
13
- @criteria2 = CvTermCriteria.new(100)
14
- @criteria3 = CvTermCriteria.new(nil, 0.01)
15
- @criteria4 = CvTermCriteria.new(100, 0.01)
16
- end
17
-
18
- def test_initialize
19
- assert_not_nil(@criteria1)
20
- assert_equal(CvTermCriteria, @criteria1.class)
21
- assert_not_nil(@criteria2)
22
- assert_equal(CvTermCriteria, @criteria2.class)
23
- assert_not_nil(@criteria3)
24
- assert_equal(CvTermCriteria, @criteria3.class)
25
- assert_not_nil(@criteria4)
26
- assert_equal(CvTermCriteria, @criteria4.class)
27
- end
28
-
29
- def test_type
30
- assert_equal(0, @criteria1.type)
31
- assert_equal(CV_TERMCRIT_ITER, @criteria2.type)
32
- assert_equal(CV_TERMCRIT_EPS, @criteria3.type)
33
- assert_equal(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, @criteria4.type)
34
- end
35
-
36
- def test_max
37
- assert_nil(@criteria1.max)
38
- assert_equal(100, @criteria2.max)
39
- assert_nil(@criteria3.max)
40
- assert_equal(100, @criteria4.max)
41
-
42
- @criteria1.max = 999
43
- assert_equal(999, @criteria1.max)
44
- end
45
-
46
- def test_eps
47
- assert_nil(@criteria1.eps)
48
- assert_nil(@criteria2.eps)
49
- assert_in_delta(0.01, @criteria3.eps, 0.001)
50
- assert_in_delta(0.01, @criteria4.eps, 0.001)
51
-
52
- @criteria1.eps = 3.14
53
- assert_in_delta(3.14, @criteria1.eps, 0.001)
54
- end
55
- end
56
-
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8 -*-
3
+ require 'test/unit'
4
+ require 'opencv'
5
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
+
7
+ include OpenCV
8
+
9
+ # Tests for OpenCV::CvTermCriteria
10
+ class TestCvTermCriteria < OpenCVTestCase
11
+ def setup
12
+ @criteria1 = CvTermCriteria.new
13
+ @criteria2 = CvTermCriteria.new(100)
14
+ @criteria3 = CvTermCriteria.new(nil, 0.01)
15
+ @criteria4 = CvTermCriteria.new(100, 0.01)
16
+ end
17
+
18
+ def test_initialize
19
+ assert_not_nil(@criteria1)
20
+ assert_equal(CvTermCriteria, @criteria1.class)
21
+ assert_not_nil(@criteria2)
22
+ assert_equal(CvTermCriteria, @criteria2.class)
23
+ assert_not_nil(@criteria3)
24
+ assert_equal(CvTermCriteria, @criteria3.class)
25
+ assert_not_nil(@criteria4)
26
+ assert_equal(CvTermCriteria, @criteria4.class)
27
+ end
28
+
29
+ def test_type
30
+ assert_equal(0, @criteria1.type)
31
+ assert_equal(CV_TERMCRIT_ITER, @criteria2.type)
32
+ assert_equal(CV_TERMCRIT_EPS, @criteria3.type)
33
+ assert_equal(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, @criteria4.type)
34
+ end
35
+
36
+ def test_max
37
+ assert_nil(@criteria1.max)
38
+ assert_equal(100, @criteria2.max)
39
+ assert_nil(@criteria3.max)
40
+ assert_equal(100, @criteria4.max)
41
+
42
+ @criteria1.max = 999
43
+ assert_equal(999, @criteria1.max)
44
+ end
45
+
46
+ def test_eps
47
+ assert_nil(@criteria1.eps)
48
+ assert_nil(@criteria2.eps)
49
+ assert_in_delta(0.01, @criteria3.eps, 0.001)
50
+ assert_in_delta(0.01, @criteria4.eps, 0.001)
51
+
52
+ @criteria1.eps = 3.14
53
+ assert_in_delta(3.14, @criteria1.eps, 0.001)
54
+ end
55
+ end
56
+
@@ -1,40 +1,40 @@
1
- #!/usr/bin/env ruby
2
- # -*- mode: ruby; coding: utf-8-unix -*-
3
- require 'test/unit'
4
- require 'opencv'
5
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
-
7
- include OpenCV
8
-
9
- # Tests for OpenCV::CvTwoPoints
10
- class TestCvTwoPoints < OpenCVTestCase
11
- def setup
12
- @twopoints = CvTwoPoints.new
13
- end
14
-
15
- def test_initialize
16
- assert_not_nil(@twopoints)
17
- assert_equal(CvTwoPoints, @twopoints.class)
18
- end
19
-
20
- def test_point
21
- assert_not_nil(@twopoints.point1)
22
- assert_not_nil(@twopoints.point2)
23
- assert_equal(CvPoint, @twopoints.point1.class)
24
- assert_equal(CvPoint, @twopoints.point2.class)
25
- end
26
-
27
- def test_aref
28
- assert_not_nil(@twopoints[0])
29
- assert_not_nil(@twopoints[1])
30
- assert_equal(CvPoint, @twopoints[0].class)
31
- assert_equal(CvPoint, @twopoints[1].class)
32
- end
33
-
34
- def test_to_ary
35
- assert_equal(Array, @twopoints.to_ary.class)
36
- assert_equal(2, @twopoints.to_ary.size)
37
- assert_equal(2, @twopoints.to_a.size)
38
- end
39
- end
40
-
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8 -*-
3
+ require 'test/unit'
4
+ require 'opencv'
5
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
+
7
+ include OpenCV
8
+
9
+ # Tests for OpenCV::CvTwoPoints
10
+ class TestCvTwoPoints < OpenCVTestCase
11
+ def setup
12
+ @twopoints = CvTwoPoints.new
13
+ end
14
+
15
+ def test_initialize
16
+ assert_not_nil(@twopoints)
17
+ assert_equal(CvTwoPoints, @twopoints.class)
18
+ end
19
+
20
+ def test_point
21
+ assert_not_nil(@twopoints.point1)
22
+ assert_not_nil(@twopoints.point2)
23
+ assert_equal(CvPoint, @twopoints.point1.class)
24
+ assert_equal(CvPoint, @twopoints.point2.class)
25
+ end
26
+
27
+ def test_aref
28
+ assert_not_nil(@twopoints[0])
29
+ assert_not_nil(@twopoints[1])
30
+ assert_equal(CvPoint, @twopoints[0].class)
31
+ assert_equal(CvPoint, @twopoints[1].class)
32
+ end
33
+
34
+ def test_to_ary
35
+ assert_equal(Array, @twopoints.to_ary.class)
36
+ assert_equal(2, @twopoints.to_ary.size)
37
+ assert_equal(2, @twopoints.to_a.size)
38
+ end
39
+ end
40
+
@@ -1,58 +1,58 @@
1
- #!/usr/bin/env ruby
2
- # -*- mode: ruby; coding: utf-8-unix -*-
3
- require 'test/unit'
4
- require 'opencv'
5
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
-
7
- include OpenCV
8
-
9
- # Tests for OpenCV::CvVideoWriter
10
- class TestCvVideoWriter < OpenCVTestCase
11
- OUTPUT_FILENAME = 'videowriter_result.avi'
12
-
13
- def test_initialize
14
- vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240))
15
- assert_equal(CvVideoWriter, vw.class)
16
- vw.close
17
-
18
- vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240), false)
19
- assert_equal(CvVideoWriter, vw.class)
20
- vw.close
21
-
22
- ## Supported only Windows(?)
23
- # vw = CvVideoWriter.new(OUTPUT_FILENAME, nil, 15, CvSize.new(320, 240), false)
24
- # assert_equal(CvVideoWriter, vw.class)
25
- # vw.close
26
-
27
- CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240)) { |vw|
28
- assert_equal(CvVideoWriter, vw.class)
29
- }
30
-
31
- assert_raise(TypeError) {
32
- vw = CvVideoWriter.new(123, 'MJPG', 15, CvSize.new(320, 240), false)
33
- }
34
- end
35
-
36
- def test_write
37
- img = IplImage.load(FILENAME_LENA256x256)
38
- vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(256, 256))
39
- vw.write img
40
- vw.close
41
-
42
- CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(256, 256)) { |vw|
43
- vw.write img
44
- }
45
-
46
- assert_raise(TypeError) {
47
- CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(256, 256)) { |vw|
48
- vw.write DUMMY_OBJ
49
- }
50
- }
51
- end
52
-
53
- def test_close
54
- vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240))
55
- vw.close
56
- end
57
- end
58
-
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8 -*-
3
+ require 'test/unit'
4
+ require 'opencv'
5
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
+
7
+ include OpenCV
8
+
9
+ # Tests for OpenCV::CvVideoWriter
10
+ class TestCvVideoWriter < OpenCVTestCase
11
+ OUTPUT_FILENAME = 'videowriter_result.avi'
12
+
13
+ def test_initialize
14
+ vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240))
15
+ assert_equal(CvVideoWriter, vw.class)
16
+ vw.close
17
+
18
+ vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240), false)
19
+ assert_equal(CvVideoWriter, vw.class)
20
+ vw.close
21
+
22
+ ## Supported only Windows(?)
23
+ # vw = CvVideoWriter.new(OUTPUT_FILENAME, nil, 15, CvSize.new(320, 240), false)
24
+ # assert_equal(CvVideoWriter, vw.class)
25
+ # vw.close
26
+
27
+ CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240)) { |vw|
28
+ assert_equal(CvVideoWriter, vw.class)
29
+ }
30
+
31
+ assert_raise(TypeError) {
32
+ vw = CvVideoWriter.new(123, 'MJPG', 15, CvSize.new(320, 240), false)
33
+ }
34
+ end
35
+
36
+ def test_write
37
+ img = IplImage.load(FILENAME_LENA256x256)
38
+ vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(256, 256))
39
+ vw.write img
40
+ vw.close
41
+
42
+ CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(256, 256)) { |vw|
43
+ vw.write img
44
+ }
45
+
46
+ assert_raise(TypeError) {
47
+ CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(256, 256)) { |vw|
48
+ vw.write DUMMY_OBJ
49
+ }
50
+ }
51
+ end
52
+
53
+ def test_close
54
+ vw = CvVideoWriter.new(OUTPUT_FILENAME, 'MJPG', 15, CvSize.new(320, 240))
55
+ vw.close
56
+ end
57
+ end
58
+
@@ -1,54 +1,54 @@
1
- #!/usr/bin/env ruby
2
- # -*- mode: ruby; coding: utf-8-unix -*-
3
- require 'test/unit'
4
- require 'opencv'
5
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
-
7
- include OpenCV
8
-
9
- # Tests for OpenCV::IplConvKernel
10
- class TestIplConvKernel < OpenCVTestCase
11
- def test_initialize
12
- [:rect, :cross, :ellipse, CV_SHAPE_RECT, CV_SHAPE_CROSS, CV_SHAPE_ELLIPSE].each { |shape|
13
- kernel = IplConvKernel.new(5, 5, 2, 2, shape)
14
- assert_not_nil(kernel)
15
- }
16
-
17
- values = [1] * 25
18
- [:custom, CV_SHAPE_CUSTOM].each { |shape|
19
- kernel = IplConvKernel.new(5, 5, 2, 2, shape, values)
20
- assert_not_nil(kernel)
21
- }
22
-
23
- [:custom, CV_SHAPE_CUSTOM].each { |shape|
24
- assert_raise(ArgumentError) {
25
- IplConvKernel.new(5, 5, 2, 2, shape)
26
- }
27
- }
28
-
29
- assert_raise(TypeError) {
30
- IplConvKernel.new(5, 5, 2, 2, :foobar)
31
- }
32
- end
33
-
34
- def test_size
35
- kernel = IplConvKernel.new(5, 4, 2, 2, :rect)
36
- size = kernel.size
37
- assert_equal(5, size.width)
38
- assert_equal(4, size.height)
39
-
40
- assert_equal(5, kernel.cols)
41
- assert_equal(4, kernel.rows)
42
- end
43
-
44
- def test_anchor
45
- kernel = IplConvKernel.new(5, 4, 3, 2, :rect)
46
- a = kernel.anchor
47
- assert_equal(3, a.x)
48
- assert_equal(2, a.y)
49
-
50
- assert_equal(3, kernel.anchor_x)
51
- assert_equal(2, kernel.anchor_y)
52
- end
53
- end
54
-
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8 -*-
3
+ require 'test/unit'
4
+ require 'opencv'
5
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
6
+
7
+ include OpenCV
8
+
9
+ # Tests for OpenCV::IplConvKernel
10
+ class TestIplConvKernel < OpenCVTestCase
11
+ def test_initialize
12
+ [:rect, :cross, :ellipse, CV_SHAPE_RECT, CV_SHAPE_CROSS, CV_SHAPE_ELLIPSE].each { |shape|
13
+ kernel = IplConvKernel.new(5, 5, 2, 2, shape)
14
+ assert_not_nil(kernel)
15
+ }
16
+
17
+ values = [1] * 25
18
+ [:custom, CV_SHAPE_CUSTOM].each { |shape|
19
+ kernel = IplConvKernel.new(5, 5, 2, 2, shape, values)
20
+ assert_not_nil(kernel)
21
+ }
22
+
23
+ [:custom, CV_SHAPE_CUSTOM].each { |shape|
24
+ assert_raise(ArgumentError) {
25
+ IplConvKernel.new(5, 5, 2, 2, shape)
26
+ }
27
+ }
28
+
29
+ assert_raise(TypeError) {
30
+ IplConvKernel.new(5, 5, 2, 2, :foobar)
31
+ }
32
+ end
33
+
34
+ def test_size
35
+ kernel = IplConvKernel.new(5, 4, 2, 2, :rect)
36
+ size = kernel.size
37
+ assert_equal(5, size.width)
38
+ assert_equal(4, size.height)
39
+
40
+ assert_equal(5, kernel.cols)
41
+ assert_equal(4, kernel.rows)
42
+ end
43
+
44
+ def test_anchor
45
+ kernel = IplConvKernel.new(5, 4, 3, 2, :rect)
46
+ a = kernel.anchor
47
+ assert_equal(3, a.x)
48
+ assert_equal(2, a.y)
49
+
50
+ assert_equal(3, kernel.anchor_x)
51
+ assert_equal(2, kernel.anchor_y)
52
+ end
53
+ end
54
+