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.
- checksums.yaml +7 -0
- data/DEVELOPERS_NOTE.md +137 -0
- data/Gemfile +1 -1
- data/License.txt +30 -30
- data/Manifest.txt +7 -5
- data/README.md +98 -0
- data/Rakefile +63 -5
- data/config.yml +7 -0
- data/examples/alpha_blend.rb +21 -21
- data/examples/find_obj.rb +169 -169
- data/examples/match_kdtree.rb +88 -88
- data/ext/opencv/cvcapture.cpp +19 -12
- data/ext/opencv/cvutils.cpp +192 -194
- data/ext/opencv/cvutils.h +30 -29
- data/{extconf.rb → ext/opencv/extconf.rb} +12 -4
- data/lib/opencv.rb +12 -3
- data/lib/opencv/psyched_yaml.rb +22 -22
- data/lib/opencv/version.rb +1 -1
- data/ruby-opencv.gemspec +44 -43
- data/test/helper.rb +1 -1
- data/test/runner.rb +30 -30
- data/test/test_curve.rb +1 -1
- data/test/test_cvavgcomp.rb +24 -24
- data/test/test_cvbox2d.rb +76 -76
- data/test/test_cvcapture.rb +183 -183
- data/test/test_cvchain.rb +108 -108
- data/test/test_cvcircle32f.rb +41 -41
- data/test/test_cvconnectedcomp.rb +61 -61
- data/test/test_cvcontour.rb +150 -150
- data/test/test_cvcontourtree.rb +43 -43
- data/test/test_cverror.rb +1 -1
- data/test/test_cvfeaturetree.rb +65 -65
- data/test/test_cvfont.rb +58 -58
- data/test/test_cvhaarclassifiercascade.rb +63 -63
- data/test/test_cvhistogram.rb +1 -1
- data/test/test_cvhumoments.rb +83 -83
- data/test/test_cvline.rb +50 -50
- data/test/test_cvmat.rb +1 -1
- data/test/test_cvmat_drawing.rb +1 -1
- data/test/test_cvmat_dxt.rb +1 -1
- data/test/test_cvmat_imageprocessing.rb +1 -1
- data/test/test_cvmat_matching.rb +1 -1
- data/test/test_cvmoments.rb +180 -180
- data/test/test_cvpoint.rb +75 -75
- data/test/test_cvpoint2d32f.rb +75 -75
- data/test/test_cvpoint3d32f.rb +93 -93
- data/test/test_cvrect.rb +144 -144
- data/test/test_cvscalar.rb +113 -113
- data/test/test_cvseq.rb +295 -295
- data/test/test_cvsize.rb +75 -75
- data/test/test_cvsize2d32f.rb +75 -75
- data/test/test_cvslice.rb +31 -31
- data/test/test_cvsurfparams.rb +57 -57
- data/test/test_cvsurfpoint.rb +66 -66
- data/test/test_cvtermcriteria.rb +56 -56
- data/test/test_cvtwopoints.rb +40 -40
- data/test/test_cvvideowriter.rb +58 -58
- data/test/test_iplconvkernel.rb +54 -54
- data/test/test_iplimage.rb +1 -1
- data/test/test_mouseevent.rb +17 -17
- data/test/test_opencv.rb +1 -1
- data/test/test_pointset.rb +1 -1
- data/test/test_preliminary.rb +130 -130
- data/test/test_trackbar.rb +47 -47
- data/test/test_window.rb +115 -115
- metadata +28 -56
- data/README.rdoc +0 -149
- data/ext/opencv/lib/opencv.rb +0 -3
- data/ext/opencv/lib/opencv/psyched_yaml.rb +0 -22
- data/ext/opencv/lib/opencv/version.rb +0 -3
data/test/test_cvpoint.rb
CHANGED
@@ -1,75 +1,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::CvPoint
|
10
|
-
class TestCvPoint < OpenCVTestCase
|
11
|
-
class MyPoint; end
|
12
|
-
def test_x
|
13
|
-
point = CvPoint.new
|
14
|
-
point.x = 100
|
15
|
-
assert_equal(100, point.x)
|
16
|
-
point.x = 200
|
17
|
-
assert_equal(200, point.x)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_y
|
21
|
-
point = CvPoint.new
|
22
|
-
point.y = 100
|
23
|
-
assert_equal(100, point.y)
|
24
|
-
point.y = 200
|
25
|
-
assert_equal(200, point.y)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_compatible
|
29
|
-
assert(!(CvPoint.compatible? MyPoint.new))
|
30
|
-
MyPoint.class_eval { def x; end }
|
31
|
-
assert(!(CvPoint.compatible? MyPoint.new))
|
32
|
-
MyPoint.class_eval { def y; end }
|
33
|
-
assert(CvPoint.compatible? MyPoint.new)
|
34
|
-
assert(CvPoint.compatible? CvPoint.new)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_initialize
|
38
|
-
point = CvPoint.new
|
39
|
-
assert_equal(0, point.x)
|
40
|
-
assert_equal(0, point.y)
|
41
|
-
|
42
|
-
point = CvPoint.new(10, 20)
|
43
|
-
assert_equal(10, point.x)
|
44
|
-
assert_equal(20, point.y)
|
45
|
-
|
46
|
-
point = CvPoint.new(CvPoint.new(10, 20))
|
47
|
-
assert_equal(10, point.x)
|
48
|
-
assert_equal(20, point.y)
|
49
|
-
|
50
|
-
assert_raise(TypeError) {
|
51
|
-
CvPoint.new(DUMMY_OBJ)
|
52
|
-
}
|
53
|
-
assert_raise(ArgumentError) {
|
54
|
-
CvPoint.new(1, 2, 3)
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_to_s
|
59
|
-
point = CvPoint.new(10, 20)
|
60
|
-
assert_equal('<OpenCV::CvPoint:(10,20)>', point.to_s)
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_to_ary
|
64
|
-
a = CvPoint.new(10, 20).to_ary
|
65
|
-
assert_equal(10, a[0])
|
66
|
-
assert_equal(20, a[1])
|
67
|
-
|
68
|
-
# Alias
|
69
|
-
a = CvPoint.new(10, 20).to_a
|
70
|
-
assert_equal(10, a[0])
|
71
|
-
assert_equal(20, a[1])
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
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::CvPoint
|
10
|
+
class TestCvPoint < OpenCVTestCase
|
11
|
+
class MyPoint; end
|
12
|
+
def test_x
|
13
|
+
point = CvPoint.new
|
14
|
+
point.x = 100
|
15
|
+
assert_equal(100, point.x)
|
16
|
+
point.x = 200
|
17
|
+
assert_equal(200, point.x)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_y
|
21
|
+
point = CvPoint.new
|
22
|
+
point.y = 100
|
23
|
+
assert_equal(100, point.y)
|
24
|
+
point.y = 200
|
25
|
+
assert_equal(200, point.y)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_compatible
|
29
|
+
assert(!(CvPoint.compatible? MyPoint.new))
|
30
|
+
MyPoint.class_eval { def x; end }
|
31
|
+
assert(!(CvPoint.compatible? MyPoint.new))
|
32
|
+
MyPoint.class_eval { def y; end }
|
33
|
+
assert(CvPoint.compatible? MyPoint.new)
|
34
|
+
assert(CvPoint.compatible? CvPoint.new)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_initialize
|
38
|
+
point = CvPoint.new
|
39
|
+
assert_equal(0, point.x)
|
40
|
+
assert_equal(0, point.y)
|
41
|
+
|
42
|
+
point = CvPoint.new(10, 20)
|
43
|
+
assert_equal(10, point.x)
|
44
|
+
assert_equal(20, point.y)
|
45
|
+
|
46
|
+
point = CvPoint.new(CvPoint.new(10, 20))
|
47
|
+
assert_equal(10, point.x)
|
48
|
+
assert_equal(20, point.y)
|
49
|
+
|
50
|
+
assert_raise(TypeError) {
|
51
|
+
CvPoint.new(DUMMY_OBJ)
|
52
|
+
}
|
53
|
+
assert_raise(ArgumentError) {
|
54
|
+
CvPoint.new(1, 2, 3)
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_to_s
|
59
|
+
point = CvPoint.new(10, 20)
|
60
|
+
assert_equal('<OpenCV::CvPoint:(10,20)>', point.to_s)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_to_ary
|
64
|
+
a = CvPoint.new(10, 20).to_ary
|
65
|
+
assert_equal(10, a[0])
|
66
|
+
assert_equal(20, a[1])
|
67
|
+
|
68
|
+
# Alias
|
69
|
+
a = CvPoint.new(10, 20).to_a
|
70
|
+
assert_equal(10, a[0])
|
71
|
+
assert_equal(20, a[1])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
data/test/test_cvpoint2d32f.rb
CHANGED
@@ -1,75 +1,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::CvPoint2D32f
|
10
|
-
class TestCvPoint2D32f < OpenCVTestCase
|
11
|
-
class MyPoint; end
|
12
|
-
def test_x
|
13
|
-
point = CvPoint2D32f.new
|
14
|
-
point.x = 1.1
|
15
|
-
assert_in_delta(1.1, point.x, 0.001)
|
16
|
-
point.x = 2.2
|
17
|
-
assert_in_delta(2.2, point.x, 0.001)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_y
|
21
|
-
point = CvPoint2D32f.new
|
22
|
-
point.y = 1.1
|
23
|
-
assert_in_delta(1.1, point.y, 0.001)
|
24
|
-
point.y = 2.2
|
25
|
-
assert_in_delta(2.2, point.y, 0.001)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_compatible
|
29
|
-
assert(!(CvPoint2D32f.compatible? MyPoint.new))
|
30
|
-
MyPoint.class_eval { def x; end }
|
31
|
-
assert(!(CvPoint2D32f.compatible? MyPoint.new))
|
32
|
-
MyPoint.class_eval { def y; end }
|
33
|
-
assert(CvPoint2D32f.compatible? MyPoint.new)
|
34
|
-
assert(CvPoint2D32f.compatible? CvPoint2D32f.new)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_initialize
|
38
|
-
point = CvPoint2D32f.new
|
39
|
-
assert_in_delta(0, point.x, 0.001)
|
40
|
-
assert_in_delta(0, point.y, 0.001)
|
41
|
-
|
42
|
-
point = CvPoint2D32f.new(1.1, 2.2)
|
43
|
-
assert_in_delta(1.1, point.x, 0.001)
|
44
|
-
assert_in_delta(2.2, point.y, 0.001)
|
45
|
-
|
46
|
-
point = CvPoint2D32f.new(CvPoint2D32f.new(1.1, 2.2))
|
47
|
-
assert_in_delta(1.1, point.x, 0.001)
|
48
|
-
assert_in_delta(2.2, point.y, 0.001)
|
49
|
-
|
50
|
-
assert_raise(TypeError) {
|
51
|
-
CvPoint2D32f.new(DUMMY_OBJ)
|
52
|
-
}
|
53
|
-
assert_raise(ArgumentError) {
|
54
|
-
CvPoint2D32f.new(1, 2, 3)
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_to_s
|
59
|
-
point = CvPoint2D32f.new(1.1, 2.2)
|
60
|
-
assert_equal('<OpenCV::CvPoint2D32f:(1.1,2.2)>', point.to_s)
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_to_ary
|
64
|
-
a = CvPoint2D32f.new(1.1, 2.2).to_ary
|
65
|
-
assert_in_delta(1.1, a[0], 0.001)
|
66
|
-
assert_in_delta(2.2, a[1], 0.001)
|
67
|
-
|
68
|
-
# Alias
|
69
|
-
a = CvPoint2D32f.new(1.1, 2.2).to_a
|
70
|
-
assert_in_delta(1.1, a[0], 0.001)
|
71
|
-
assert_in_delta(2.2, a[1], 0.001)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
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::CvPoint2D32f
|
10
|
+
class TestCvPoint2D32f < OpenCVTestCase
|
11
|
+
class MyPoint; end
|
12
|
+
def test_x
|
13
|
+
point = CvPoint2D32f.new
|
14
|
+
point.x = 1.1
|
15
|
+
assert_in_delta(1.1, point.x, 0.001)
|
16
|
+
point.x = 2.2
|
17
|
+
assert_in_delta(2.2, point.x, 0.001)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_y
|
21
|
+
point = CvPoint2D32f.new
|
22
|
+
point.y = 1.1
|
23
|
+
assert_in_delta(1.1, point.y, 0.001)
|
24
|
+
point.y = 2.2
|
25
|
+
assert_in_delta(2.2, point.y, 0.001)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_compatible
|
29
|
+
assert(!(CvPoint2D32f.compatible? MyPoint.new))
|
30
|
+
MyPoint.class_eval { def x; end }
|
31
|
+
assert(!(CvPoint2D32f.compatible? MyPoint.new))
|
32
|
+
MyPoint.class_eval { def y; end }
|
33
|
+
assert(CvPoint2D32f.compatible? MyPoint.new)
|
34
|
+
assert(CvPoint2D32f.compatible? CvPoint2D32f.new)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_initialize
|
38
|
+
point = CvPoint2D32f.new
|
39
|
+
assert_in_delta(0, point.x, 0.001)
|
40
|
+
assert_in_delta(0, point.y, 0.001)
|
41
|
+
|
42
|
+
point = CvPoint2D32f.new(1.1, 2.2)
|
43
|
+
assert_in_delta(1.1, point.x, 0.001)
|
44
|
+
assert_in_delta(2.2, point.y, 0.001)
|
45
|
+
|
46
|
+
point = CvPoint2D32f.new(CvPoint2D32f.new(1.1, 2.2))
|
47
|
+
assert_in_delta(1.1, point.x, 0.001)
|
48
|
+
assert_in_delta(2.2, point.y, 0.001)
|
49
|
+
|
50
|
+
assert_raise(TypeError) {
|
51
|
+
CvPoint2D32f.new(DUMMY_OBJ)
|
52
|
+
}
|
53
|
+
assert_raise(ArgumentError) {
|
54
|
+
CvPoint2D32f.new(1, 2, 3)
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_to_s
|
59
|
+
point = CvPoint2D32f.new(1.1, 2.2)
|
60
|
+
assert_equal('<OpenCV::CvPoint2D32f:(1.1,2.2)>', point.to_s)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_to_ary
|
64
|
+
a = CvPoint2D32f.new(1.1, 2.2).to_ary
|
65
|
+
assert_in_delta(1.1, a[0], 0.001)
|
66
|
+
assert_in_delta(2.2, a[1], 0.001)
|
67
|
+
|
68
|
+
# Alias
|
69
|
+
a = CvPoint2D32f.new(1.1, 2.2).to_a
|
70
|
+
assert_in_delta(1.1, a[0], 0.001)
|
71
|
+
assert_in_delta(2.2, a[1], 0.001)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
data/test/test_cvpoint3d32f.rb
CHANGED
@@ -1,93 +1,93 @@
|
|
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::CvPoint3D32f
|
10
|
-
class TestCvPoint3D32f < OpenCVTestCase
|
11
|
-
class MyPoint; end
|
12
|
-
def test_x
|
13
|
-
point = CvPoint3D32f.new
|
14
|
-
point.x = 1.1
|
15
|
-
assert_in_delta(1.1, point.x, 0.001)
|
16
|
-
point.x = 2.2
|
17
|
-
assert_in_delta(2.2, point.x, 0.001)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_y
|
21
|
-
point = CvPoint3D32f.new
|
22
|
-
point.y = 1.1
|
23
|
-
assert_in_delta(1.1, point.y, 0.001)
|
24
|
-
point.y = 2.2
|
25
|
-
assert_in_delta(2.2, point.y, 0.001)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_z
|
29
|
-
point = CvPoint3D32f.new
|
30
|
-
point.z = 1.1
|
31
|
-
assert_in_delta(1.1, point.z, 0.001)
|
32
|
-
point.z = 2.2
|
33
|
-
assert_in_delta(2.2, point.z, 0.001)
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_compatible
|
37
|
-
assert(!(CvPoint3D32f.compatible? MyPoint.new))
|
38
|
-
MyPoint.class_eval { def x; end }
|
39
|
-
assert(!(CvPoint3D32f.compatible? MyPoint.new))
|
40
|
-
MyPoint.class_eval { def y; end }
|
41
|
-
assert(!(CvPoint3D32f.compatible? MyPoint.new))
|
42
|
-
MyPoint.class_eval { def z; end }
|
43
|
-
assert(CvPoint3D32f.compatible? MyPoint.new)
|
44
|
-
assert(CvPoint3D32f.compatible? CvPoint3D32f.new)
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_initialize
|
48
|
-
point = CvPoint3D32f.new
|
49
|
-
assert_in_delta(0, point.x, 0.001)
|
50
|
-
assert_in_delta(0, point.y, 0.001)
|
51
|
-
assert_in_delta(0, point.z, 0.001)
|
52
|
-
|
53
|
-
point = CvPoint3D32f.new(1.1, 2.2, 3.3)
|
54
|
-
assert_in_delta(1.1, point.x, 0.001)
|
55
|
-
assert_in_delta(2.2, point.y, 0.001)
|
56
|
-
assert_in_delta(3.3, point.z, 0.001)
|
57
|
-
|
58
|
-
point = CvPoint3D32f.new(CvPoint3D32f.new(1.1, 2.2, 3.3))
|
59
|
-
assert_in_delta(1.1, point.x, 0.001)
|
60
|
-
assert_in_delta(2.2, point.y, 0.001)
|
61
|
-
assert_in_delta(3.3, point.z, 0.001)
|
62
|
-
|
63
|
-
assert_raise(TypeError) {
|
64
|
-
CvPoint3D32f.new(DUMMY_OBJ)
|
65
|
-
}
|
66
|
-
assert_raise(ArgumentError) {
|
67
|
-
CvPoint3D32f.new(1, 2)
|
68
|
-
}
|
69
|
-
assert_raise(ArgumentError) {
|
70
|
-
CvPoint3D32f.new(1, 2, 3, 4)
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_to_s
|
75
|
-
point = CvPoint3D32f.new(1.1, 2.2, 3.3)
|
76
|
-
assert_equal('<OpenCV::CvPoint3D32f:(1.1,2.2,3.3)>', point.to_s)
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_to_ary
|
80
|
-
a = CvPoint3D32f.new(1.1, 2.2, 3.3).to_ary
|
81
|
-
assert_in_delta(1.1, a[0], 0.001)
|
82
|
-
assert_in_delta(2.2, a[1], 0.001)
|
83
|
-
assert_in_delta(3.3, a[2], 0.001)
|
84
|
-
|
85
|
-
# Alias
|
86
|
-
a = CvPoint3D32f.new(1.1, 2.2, 3.3).to_a
|
87
|
-
assert_in_delta(1.1, a[0], 0.001)
|
88
|
-
assert_in_delta(2.2, a[1], 0.001)
|
89
|
-
assert_in_delta(3.3, a[2], 0.001)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
|
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::CvPoint3D32f
|
10
|
+
class TestCvPoint3D32f < OpenCVTestCase
|
11
|
+
class MyPoint; end
|
12
|
+
def test_x
|
13
|
+
point = CvPoint3D32f.new
|
14
|
+
point.x = 1.1
|
15
|
+
assert_in_delta(1.1, point.x, 0.001)
|
16
|
+
point.x = 2.2
|
17
|
+
assert_in_delta(2.2, point.x, 0.001)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_y
|
21
|
+
point = CvPoint3D32f.new
|
22
|
+
point.y = 1.1
|
23
|
+
assert_in_delta(1.1, point.y, 0.001)
|
24
|
+
point.y = 2.2
|
25
|
+
assert_in_delta(2.2, point.y, 0.001)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_z
|
29
|
+
point = CvPoint3D32f.new
|
30
|
+
point.z = 1.1
|
31
|
+
assert_in_delta(1.1, point.z, 0.001)
|
32
|
+
point.z = 2.2
|
33
|
+
assert_in_delta(2.2, point.z, 0.001)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_compatible
|
37
|
+
assert(!(CvPoint3D32f.compatible? MyPoint.new))
|
38
|
+
MyPoint.class_eval { def x; end }
|
39
|
+
assert(!(CvPoint3D32f.compatible? MyPoint.new))
|
40
|
+
MyPoint.class_eval { def y; end }
|
41
|
+
assert(!(CvPoint3D32f.compatible? MyPoint.new))
|
42
|
+
MyPoint.class_eval { def z; end }
|
43
|
+
assert(CvPoint3D32f.compatible? MyPoint.new)
|
44
|
+
assert(CvPoint3D32f.compatible? CvPoint3D32f.new)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_initialize
|
48
|
+
point = CvPoint3D32f.new
|
49
|
+
assert_in_delta(0, point.x, 0.001)
|
50
|
+
assert_in_delta(0, point.y, 0.001)
|
51
|
+
assert_in_delta(0, point.z, 0.001)
|
52
|
+
|
53
|
+
point = CvPoint3D32f.new(1.1, 2.2, 3.3)
|
54
|
+
assert_in_delta(1.1, point.x, 0.001)
|
55
|
+
assert_in_delta(2.2, point.y, 0.001)
|
56
|
+
assert_in_delta(3.3, point.z, 0.001)
|
57
|
+
|
58
|
+
point = CvPoint3D32f.new(CvPoint3D32f.new(1.1, 2.2, 3.3))
|
59
|
+
assert_in_delta(1.1, point.x, 0.001)
|
60
|
+
assert_in_delta(2.2, point.y, 0.001)
|
61
|
+
assert_in_delta(3.3, point.z, 0.001)
|
62
|
+
|
63
|
+
assert_raise(TypeError) {
|
64
|
+
CvPoint3D32f.new(DUMMY_OBJ)
|
65
|
+
}
|
66
|
+
assert_raise(ArgumentError) {
|
67
|
+
CvPoint3D32f.new(1, 2)
|
68
|
+
}
|
69
|
+
assert_raise(ArgumentError) {
|
70
|
+
CvPoint3D32f.new(1, 2, 3, 4)
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_to_s
|
75
|
+
point = CvPoint3D32f.new(1.1, 2.2, 3.3)
|
76
|
+
assert_equal('<OpenCV::CvPoint3D32f:(1.1,2.2,3.3)>', point.to_s)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_to_ary
|
80
|
+
a = CvPoint3D32f.new(1.1, 2.2, 3.3).to_ary
|
81
|
+
assert_in_delta(1.1, a[0], 0.001)
|
82
|
+
assert_in_delta(2.2, a[1], 0.001)
|
83
|
+
assert_in_delta(3.3, a[2], 0.001)
|
84
|
+
|
85
|
+
# Alias
|
86
|
+
a = CvPoint3D32f.new(1.1, 2.2, 3.3).to_a
|
87
|
+
assert_in_delta(1.1, a[0], 0.001)
|
88
|
+
assert_in_delta(2.2, a[1], 0.001)
|
89
|
+
assert_in_delta(3.3, a[2], 0.001)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|