ruby-opencv 0.0.8.pre-mswin32 → 0.0.9.pre2-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/DEVELOPERS_NOTE.md +137 -0
  3. data/Gemfile +1 -1
  4. data/License.txt +30 -30
  5. data/Manifest.txt +7 -5
  6. data/README.md +98 -0
  7. data/Rakefile +63 -5
  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 +44 -43
  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 +28 -56
  67. data/README.rdoc +0 -149
  68. data/ext/opencv/lib/opencv.rb +0 -3
  69. data/ext/opencv/lib/opencv/psyched_yaml.rb +0 -22
  70. data/ext/opencv/lib/opencv/version.rb +0 -3
data/test/test_cvsize.rb CHANGED
@@ -1,75 +1,75 @@
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::CvSize
10
- class TestCvSize < OpenCVTestCase
11
- class MySize; end
12
-
13
- def test_width
14
- size = CvSize.new
15
- size.width = 100
16
- assert_equal(100, size.width)
17
- size.width = 200
18
- assert_equal(200, size.width)
19
- end
20
-
21
- def test_height
22
- size = CvSize.new
23
- size.height = 100
24
- assert_equal(100, size.height)
25
- size.height = 200
26
- assert_equal(200, size.height)
27
- end
28
-
29
- def test_compatible
30
- assert(!(CvSize.compatible? MySize.new))
31
- MySize.class_eval { def width; end }
32
- assert(!(CvSize.compatible? MySize.new))
33
- MySize.class_eval { def height; end }
34
- assert(CvSize.compatible? MySize.new)
35
- assert(CvSize.compatible? CvSize.new)
36
- end
37
-
38
- def test_initialize
39
- size = CvSize.new
40
- assert_equal(0, size.width)
41
- assert_equal(0, size.height)
42
-
43
- size = CvSize.new(10, 20)
44
- assert_equal(10, size.width)
45
- assert_equal(20, size.height)
46
-
47
- size = CvSize.new(CvSize.new(10, 20))
48
- assert_equal(10, size.width)
49
- assert_equal(20, size.height)
50
-
51
- assert_raise(TypeError) {
52
- CvSize.new(DUMMY_OBJ)
53
- }
54
- assert_raise(ArgumentError) {
55
- CvSize.new(1, 2, 3)
56
- }
57
- end
58
-
59
- def test_to_s
60
- size = CvSize.new(10, 20)
61
- assert_equal('<OpenCV::CvSize:10x20>', size.to_s)
62
- end
63
-
64
- def test_to_ary
65
- a = CvSize.new(10, 20).to_ary
66
- assert_equal(10, a[0])
67
- assert_equal(20, a[1])
68
-
69
- # Alias
70
- a = CvSize.new(10, 20).to_a
71
- assert_equal(10, a[0])
72
- assert_equal(20, a[1])
73
- end
74
- end
75
-
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::CvSize
10
+ class TestCvSize < OpenCVTestCase
11
+ class MySize; end
12
+
13
+ def test_width
14
+ size = CvSize.new
15
+ size.width = 100
16
+ assert_equal(100, size.width)
17
+ size.width = 200
18
+ assert_equal(200, size.width)
19
+ end
20
+
21
+ def test_height
22
+ size = CvSize.new
23
+ size.height = 100
24
+ assert_equal(100, size.height)
25
+ size.height = 200
26
+ assert_equal(200, size.height)
27
+ end
28
+
29
+ def test_compatible
30
+ assert(!(CvSize.compatible? MySize.new))
31
+ MySize.class_eval { def width; end }
32
+ assert(!(CvSize.compatible? MySize.new))
33
+ MySize.class_eval { def height; end }
34
+ assert(CvSize.compatible? MySize.new)
35
+ assert(CvSize.compatible? CvSize.new)
36
+ end
37
+
38
+ def test_initialize
39
+ size = CvSize.new
40
+ assert_equal(0, size.width)
41
+ assert_equal(0, size.height)
42
+
43
+ size = CvSize.new(10, 20)
44
+ assert_equal(10, size.width)
45
+ assert_equal(20, size.height)
46
+
47
+ size = CvSize.new(CvSize.new(10, 20))
48
+ assert_equal(10, size.width)
49
+ assert_equal(20, size.height)
50
+
51
+ assert_raise(TypeError) {
52
+ CvSize.new(DUMMY_OBJ)
53
+ }
54
+ assert_raise(ArgumentError) {
55
+ CvSize.new(1, 2, 3)
56
+ }
57
+ end
58
+
59
+ def test_to_s
60
+ size = CvSize.new(10, 20)
61
+ assert_equal('<OpenCV::CvSize:10x20>', size.to_s)
62
+ end
63
+
64
+ def test_to_ary
65
+ a = CvSize.new(10, 20).to_ary
66
+ assert_equal(10, a[0])
67
+ assert_equal(20, a[1])
68
+
69
+ # Alias
70
+ a = CvSize.new(10, 20).to_a
71
+ assert_equal(10, a[0])
72
+ assert_equal(20, a[1])
73
+ end
74
+ end
75
+
@@ -1,75 +1,75 @@
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::CvSize2D32f
10
- class TestCvSize2D32f < OpenCVTestCase
11
- class MySize; end
12
-
13
- def test_width
14
- size = CvSize2D32f.new
15
- size.width = 1.1
16
- assert_in_delta(1.1, size.width, 0.001)
17
- size.width = 2.2
18
- assert_in_delta(2.2, size.width, 0.001)
19
- end
20
-
21
- def test_height
22
- size = CvSize2D32f.new
23
- size.height = 1.1
24
- assert_in_delta(1.1, size.height, 0.001)
25
- size.height = 2.2
26
- assert_in_delta(2.2, size.height, 0.001)
27
- end
28
-
29
- def test_compatible
30
- assert(!(CvSize2D32f.compatible? MySize.new))
31
- MySize.class_eval { def width; end }
32
- assert(!(CvSize2D32f.compatible? MySize.new))
33
- MySize.class_eval { def height; end }
34
- assert(CvSize2D32f.compatible? MySize.new)
35
- assert(CvSize2D32f.compatible? CvSize2D32f.new)
36
- end
37
-
38
- def test_initialize
39
- size = CvSize2D32f.new
40
- assert_in_delta(0, size.width, 0.001)
41
- assert_in_delta(0, size.height, 0.001)
42
-
43
- size = CvSize2D32f.new(1.1, 2.2)
44
- assert_in_delta(1.1, size.width, 0.001)
45
- assert_in_delta(2.2, size.height, 0.001)
46
-
47
- size = CvSize2D32f.new(CvSize2D32f.new(1.1, 2.2))
48
- assert_in_delta(1.1, size.width, 0.001)
49
- assert_in_delta(2.2, size.height, 0.001)
50
-
51
- assert_raise(TypeError) {
52
- CvSize2D32f.new(DUMMY_OBJ)
53
- }
54
- assert_raise(ArgumentError) {
55
- CvSize2D32f.new(1, 2, 3)
56
- }
57
- end
58
-
59
- def test_to_s
60
- size = CvSize2D32f.new(1.1, 2.2)
61
- assert_equal('<OpenCV::CvSize2D32f:1.1x2.2>', size.to_s)
62
- end
63
-
64
- def test_to_ary
65
- a = CvSize2D32f.new(1.1, 2.2).to_ary
66
- assert_in_delta(1.1, a[0], 0.001)
67
- assert_in_delta(2.2, a[1], 0.001)
68
-
69
- # Alias
70
- a = CvSize2D32f.new(1.1, 2.2).to_a
71
- assert_in_delta(1.1, a[0], 0.001)
72
- assert_in_delta(2.2, a[1], 0.001)
73
- end
74
- end
75
-
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::CvSize2D32f
10
+ class TestCvSize2D32f < OpenCVTestCase
11
+ class MySize; end
12
+
13
+ def test_width
14
+ size = CvSize2D32f.new
15
+ size.width = 1.1
16
+ assert_in_delta(1.1, size.width, 0.001)
17
+ size.width = 2.2
18
+ assert_in_delta(2.2, size.width, 0.001)
19
+ end
20
+
21
+ def test_height
22
+ size = CvSize2D32f.new
23
+ size.height = 1.1
24
+ assert_in_delta(1.1, size.height, 0.001)
25
+ size.height = 2.2
26
+ assert_in_delta(2.2, size.height, 0.001)
27
+ end
28
+
29
+ def test_compatible
30
+ assert(!(CvSize2D32f.compatible? MySize.new))
31
+ MySize.class_eval { def width; end }
32
+ assert(!(CvSize2D32f.compatible? MySize.new))
33
+ MySize.class_eval { def height; end }
34
+ assert(CvSize2D32f.compatible? MySize.new)
35
+ assert(CvSize2D32f.compatible? CvSize2D32f.new)
36
+ end
37
+
38
+ def test_initialize
39
+ size = CvSize2D32f.new
40
+ assert_in_delta(0, size.width, 0.001)
41
+ assert_in_delta(0, size.height, 0.001)
42
+
43
+ size = CvSize2D32f.new(1.1, 2.2)
44
+ assert_in_delta(1.1, size.width, 0.001)
45
+ assert_in_delta(2.2, size.height, 0.001)
46
+
47
+ size = CvSize2D32f.new(CvSize2D32f.new(1.1, 2.2))
48
+ assert_in_delta(1.1, size.width, 0.001)
49
+ assert_in_delta(2.2, size.height, 0.001)
50
+
51
+ assert_raise(TypeError) {
52
+ CvSize2D32f.new(DUMMY_OBJ)
53
+ }
54
+ assert_raise(ArgumentError) {
55
+ CvSize2D32f.new(1, 2, 3)
56
+ }
57
+ end
58
+
59
+ def test_to_s
60
+ size = CvSize2D32f.new(1.1, 2.2)
61
+ assert_equal('<OpenCV::CvSize2D32f:1.1x2.2>', size.to_s)
62
+ end
63
+
64
+ def test_to_ary
65
+ a = CvSize2D32f.new(1.1, 2.2).to_ary
66
+ assert_in_delta(1.1, a[0], 0.001)
67
+ assert_in_delta(2.2, a[1], 0.001)
68
+
69
+ # Alias
70
+ a = CvSize2D32f.new(1.1, 2.2).to_a
71
+ assert_in_delta(1.1, a[0], 0.001)
72
+ assert_in_delta(2.2, a[1], 0.001)
73
+ end
74
+ end
75
+
data/test/test_cvslice.rb CHANGED
@@ -1,31 +1,31 @@
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::CvSlice
10
- class TestCvSlice < OpenCVTestCase
11
- def setup
12
- @slice = CvSlice.new(2, 4)
13
- end
14
-
15
- def test_initialize
16
- assert_equal(CvSlice, @slice.class)
17
- end
18
-
19
- def test_start_index
20
- assert_equal(2, @slice.start_index)
21
- @slice.start_index = 3
22
- assert_equal(3, @slice.start_index)
23
- end
24
-
25
- def test_end_index
26
- assert_equal(4, @slice.end_index)
27
- @slice.end_index = 5
28
- assert_equal(5, @slice.end_index)
29
- end
30
- end
31
-
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::CvSlice
10
+ class TestCvSlice < OpenCVTestCase
11
+ def setup
12
+ @slice = CvSlice.new(2, 4)
13
+ end
14
+
15
+ def test_initialize
16
+ assert_equal(CvSlice, @slice.class)
17
+ end
18
+
19
+ def test_start_index
20
+ assert_equal(2, @slice.start_index)
21
+ @slice.start_index = 3
22
+ assert_equal(3, @slice.start_index)
23
+ end
24
+
25
+ def test_end_index
26
+ assert_equal(4, @slice.end_index)
27
+ @slice.end_index = 5
28
+ assert_equal(5, @slice.end_index)
29
+ end
30
+ end
31
+
@@ -1,57 +1,57 @@
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::CvSURFParams
10
- class TestCvSURFParams < OpenCVTestCase
11
- def setup
12
- @surf_param1 = CvSURFParams.new(345.6)
13
- end
14
-
15
- def test_initialize
16
- sp1 = CvSURFParams.new(345.6)
17
- assert_equal(false, sp1.extended)
18
- assert_in_delta(345.6, sp1.hessian_threshold, 0.001)
19
- assert_equal(3, sp1.n_octaves)
20
- assert_equal(4, sp1.n_octave_layers)
21
-
22
- sp2 = CvSURFParams.new(456.7, true, 4, 5)
23
- assert_equal(true, sp2.extended)
24
- assert_in_delta(456.7, sp2.hessian_threshold, 0.001)
25
- assert_equal(4, sp2.n_octaves)
26
- assert_equal(5, sp2.n_octave_layers)
27
- end
28
-
29
- def test_extended
30
- assert_equal(false, @surf_param1.extended)
31
-
32
- @surf_param1.extended = true
33
- assert_equal(true, @surf_param1.extended)
34
- end
35
-
36
- def test_hessian_threshold
37
- assert_in_delta(345.6, @surf_param1.hessian_threshold, 0.001)
38
-
39
- @surf_param1.hessian_threshold = 456.7
40
- assert_in_delta(456.7, @surf_param1.hessian_threshold, 0.001)
41
- end
42
-
43
- def test_n_octaves
44
- assert_equal(3, @surf_param1.n_octaves)
45
-
46
- @surf_param1.n_octaves = 4
47
- assert_equal(4, @surf_param1.n_octaves)
48
- end
49
-
50
- def test_n_octave_layers
51
- assert_equal(4, @surf_param1.n_octave_layers)
52
-
53
- @surf_param1.n_octave_layers = 5
54
- assert_equal(5, @surf_param1.n_octave_layers)
55
- end
56
- end
57
-
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::CvSURFParams
10
+ class TestCvSURFParams < OpenCVTestCase
11
+ def setup
12
+ @surf_param1 = CvSURFParams.new(345.6)
13
+ end
14
+
15
+ def test_initialize
16
+ sp1 = CvSURFParams.new(345.6)
17
+ assert_equal(false, sp1.extended)
18
+ assert_in_delta(345.6, sp1.hessian_threshold, 0.001)
19
+ assert_equal(3, sp1.n_octaves)
20
+ assert_equal(4, sp1.n_octave_layers)
21
+
22
+ sp2 = CvSURFParams.new(456.7, true, 4, 5)
23
+ assert_equal(true, sp2.extended)
24
+ assert_in_delta(456.7, sp2.hessian_threshold, 0.001)
25
+ assert_equal(4, sp2.n_octaves)
26
+ assert_equal(5, sp2.n_octave_layers)
27
+ end
28
+
29
+ def test_extended
30
+ assert_equal(false, @surf_param1.extended)
31
+
32
+ @surf_param1.extended = true
33
+ assert_equal(true, @surf_param1.extended)
34
+ end
35
+
36
+ def test_hessian_threshold
37
+ assert_in_delta(345.6, @surf_param1.hessian_threshold, 0.001)
38
+
39
+ @surf_param1.hessian_threshold = 456.7
40
+ assert_in_delta(456.7, @surf_param1.hessian_threshold, 0.001)
41
+ end
42
+
43
+ def test_n_octaves
44
+ assert_equal(3, @surf_param1.n_octaves)
45
+
46
+ @surf_param1.n_octaves = 4
47
+ assert_equal(4, @surf_param1.n_octaves)
48
+ end
49
+
50
+ def test_n_octave_layers
51
+ assert_equal(4, @surf_param1.n_octave_layers)
52
+
53
+ @surf_param1.n_octave_layers = 5
54
+ assert_equal(5, @surf_param1.n_octave_layers)
55
+ end
56
+ end
57
+