afeld-opencv 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. data/.gitignore +23 -0
  2. data/Gemfile +6 -0
  3. data/History.txt +5 -0
  4. data/License.txt +30 -0
  5. data/Manifest.txt +217 -0
  6. data/README.rdoc +161 -0
  7. data/Rakefile +52 -0
  8. data/examples/alpha_blend.rb +21 -0
  9. data/examples/box.png +0 -0
  10. data/examples/box_in_scene.png +0 -0
  11. data/examples/contours/bitmap-contours-with-labels.png +0 -0
  12. data/examples/contours/bitmap-contours.png +0 -0
  13. data/examples/contours/bounding-box-detect-canny.rb +62 -0
  14. data/examples/contours/contour_retrieval_modes.rb +139 -0
  15. data/examples/contours/rotated-boxes.jpg +0 -0
  16. data/examples/convexhull.rb +47 -0
  17. data/examples/face_detect.rb +20 -0
  18. data/examples/find_obj.rb +169 -0
  19. data/examples/houghcircle.rb +22 -0
  20. data/examples/inpaint.png +0 -0
  21. data/examples/inpaint.rb +57 -0
  22. data/examples/lenna-rotated.jpg +0 -0
  23. data/examples/lenna.jpg +0 -0
  24. data/examples/match_kdtree.rb +88 -0
  25. data/examples/paint.rb +70 -0
  26. data/examples/snake.rb +43 -0
  27. data/examples/stuff.jpg +0 -0
  28. data/examples/tiffany.jpg +0 -0
  29. data/ext/opencv/curve.cpp +112 -0
  30. data/ext/opencv/curve.h +34 -0
  31. data/ext/opencv/cvavgcomp.cpp +67 -0
  32. data/ext/opencv/cvavgcomp.h +39 -0
  33. data/ext/opencv/cvbox2d.cpp +197 -0
  34. data/ext/opencv/cvbox2d.h +61 -0
  35. data/ext/opencv/cvcapture.cpp +499 -0
  36. data/ext/opencv/cvcapture.h +72 -0
  37. data/ext/opencv/cvchain.cpp +230 -0
  38. data/ext/opencv/cvchain.h +46 -0
  39. data/ext/opencv/cvcircle32f.cpp +116 -0
  40. data/ext/opencv/cvcircle32f.h +52 -0
  41. data/ext/opencv/cvcondensation.cpp +282 -0
  42. data/ext/opencv/cvcondensation.h +49 -0
  43. data/ext/opencv/cvconnectedcomp.cpp +143 -0
  44. data/ext/opencv/cvconnectedcomp.h +49 -0
  45. data/ext/opencv/cvcontour.cpp +297 -0
  46. data/ext/opencv/cvcontour.h +48 -0
  47. data/ext/opencv/cvcontourtree.cpp +91 -0
  48. data/ext/opencv/cvcontourtree.h +41 -0
  49. data/ext/opencv/cvconvexitydefect.cpp +103 -0
  50. data/ext/opencv/cvconvexitydefect.h +42 -0
  51. data/ext/opencv/cverror.cpp +159 -0
  52. data/ext/opencv/cverror.h +28 -0
  53. data/ext/opencv/cvfeaturetree.cpp +125 -0
  54. data/ext/opencv/cvfeaturetree.h +55 -0
  55. data/ext/opencv/cvfont.cpp +208 -0
  56. data/ext/opencv/cvfont.h +64 -0
  57. data/ext/opencv/cvhaarclassifiercascade.cpp +168 -0
  58. data/ext/opencv/cvhaarclassifiercascade.h +39 -0
  59. data/ext/opencv/cvhistogram.cpp +546 -0
  60. data/ext/opencv/cvhistogram.h +73 -0
  61. data/ext/opencv/cvhumoments.cpp +139 -0
  62. data/ext/opencv/cvhumoments.h +51 -0
  63. data/ext/opencv/cvline.cpp +154 -0
  64. data/ext/opencv/cvline.h +54 -0
  65. data/ext/opencv/cvmat.cpp +5627 -0
  66. data/ext/opencv/cvmat.h +280 -0
  67. data/ext/opencv/cvmatnd.cpp +44 -0
  68. data/ext/opencv/cvmatnd.h +28 -0
  69. data/ext/opencv/cvmemstorage.cpp +68 -0
  70. data/ext/opencv/cvmemstorage.h +53 -0
  71. data/ext/opencv/cvmoments.cpp +287 -0
  72. data/ext/opencv/cvmoments.h +75 -0
  73. data/ext/opencv/cvpoint.cpp +228 -0
  74. data/ext/opencv/cvpoint.h +64 -0
  75. data/ext/opencv/cvpoint2d32f.cpp +211 -0
  76. data/ext/opencv/cvpoint2d32f.h +63 -0
  77. data/ext/opencv/cvpoint3d32f.cpp +246 -0
  78. data/ext/opencv/cvpoint3d32f.h +66 -0
  79. data/ext/opencv/cvrect.cpp +333 -0
  80. data/ext/opencv/cvrect.h +79 -0
  81. data/ext/opencv/cvscalar.cpp +236 -0
  82. data/ext/opencv/cvscalar.h +71 -0
  83. data/ext/opencv/cvseq.cpp +599 -0
  84. data/ext/opencv/cvseq.h +72 -0
  85. data/ext/opencv/cvsize.cpp +221 -0
  86. data/ext/opencv/cvsize.h +65 -0
  87. data/ext/opencv/cvsize2d32f.cpp +209 -0
  88. data/ext/opencv/cvsize2d32f.h +64 -0
  89. data/ext/opencv/cvslice.cpp +120 -0
  90. data/ext/opencv/cvslice.h +61 -0
  91. data/ext/opencv/cvsparsemat.cpp +44 -0
  92. data/ext/opencv/cvsparsemat.h +28 -0
  93. data/ext/opencv/cvsurfparams.cpp +199 -0
  94. data/ext/opencv/cvsurfparams.h +58 -0
  95. data/ext/opencv/cvsurfpoint.cpp +223 -0
  96. data/ext/opencv/cvsurfpoint.h +52 -0
  97. data/ext/opencv/cvtermcriteria.cpp +192 -0
  98. data/ext/opencv/cvtermcriteria.h +71 -0
  99. data/ext/opencv/cvtwopoints.cpp +116 -0
  100. data/ext/opencv/cvtwopoints.h +51 -0
  101. data/ext/opencv/cvutils.cpp +194 -0
  102. data/ext/opencv/cvutils.h +29 -0
  103. data/ext/opencv/cvvideowriter.cpp +137 -0
  104. data/ext/opencv/cvvideowriter.h +43 -0
  105. data/ext/opencv/gui.cpp +68 -0
  106. data/ext/opencv/gui.h +30 -0
  107. data/ext/opencv/iplconvkernel.cpp +192 -0
  108. data/ext/opencv/iplconvkernel.h +71 -0
  109. data/ext/opencv/iplimage.cpp +576 -0
  110. data/ext/opencv/iplimage.h +70 -0
  111. data/ext/opencv/lib/opencv.rb +3 -0
  112. data/ext/opencv/lib/opencv/psyched_yaml.rb +22 -0
  113. data/ext/opencv/lib/opencv/version.rb +3 -0
  114. data/ext/opencv/mouseevent.cpp +181 -0
  115. data/ext/opencv/mouseevent.h +56 -0
  116. data/ext/opencv/opencv.cpp +710 -0
  117. data/ext/opencv/opencv.h +400 -0
  118. data/ext/opencv/pointset.cpp +284 -0
  119. data/ext/opencv/pointset.h +69 -0
  120. data/ext/opencv/trackbar.cpp +121 -0
  121. data/ext/opencv/trackbar.h +69 -0
  122. data/ext/opencv/window.cpp +357 -0
  123. data/ext/opencv/window.h +66 -0
  124. data/extconf.rb +65 -0
  125. data/images/CvMat_sobel.png +0 -0
  126. data/images/CvMat_sub_rect.png +0 -0
  127. data/images/CvSeq_relationmap.png +0 -0
  128. data/images/face_detect_from_lena.jpg +0 -0
  129. data/test/helper.rb +146 -0
  130. data/test/runner.rb +30 -0
  131. data/test/samples/airplane.jpg +0 -0
  132. data/test/samples/baboon.jpg +0 -0
  133. data/test/samples/baboon200.jpg +0 -0
  134. data/test/samples/baboon200_rotated.jpg +0 -0
  135. data/test/samples/blank0.jpg +0 -0
  136. data/test/samples/blank1.jpg +0 -0
  137. data/test/samples/blank2.jpg +0 -0
  138. data/test/samples/blank3.jpg +0 -0
  139. data/test/samples/blank4.jpg +0 -0
  140. data/test/samples/blank5.jpg +0 -0
  141. data/test/samples/blank6.jpg +0 -0
  142. data/test/samples/blank7.jpg +0 -0
  143. data/test/samples/blank8.jpg +0 -0
  144. data/test/samples/blank9.jpg +0 -0
  145. data/test/samples/cat.jpg +0 -0
  146. data/test/samples/contours.jpg +0 -0
  147. data/test/samples/fruits.jpg +0 -0
  148. data/test/samples/haarcascade_frontalface_alt.xml.gz +0 -0
  149. data/test/samples/inpaint-mask.bmp +0 -0
  150. data/test/samples/lena-256x256.jpg +0 -0
  151. data/test/samples/lena-32x32.jpg +0 -0
  152. data/test/samples/lena-eyes.jpg +0 -0
  153. data/test/samples/lena-inpaint.jpg +0 -0
  154. data/test/samples/lena.jpg +0 -0
  155. data/test/samples/lines.jpg +0 -0
  156. data/test/samples/messy0.jpg +0 -0
  157. data/test/samples/messy1.jpg +0 -0
  158. data/test/samples/movie_sample.avi +0 -0
  159. data/test/samples/one_way_train_0000.jpg +0 -0
  160. data/test/samples/one_way_train_0001.jpg +0 -0
  161. data/test/samples/partially_blank0.jpg +0 -0
  162. data/test/samples/partially_blank1.jpg +0 -0
  163. data/test/samples/smooth0.jpg +0 -0
  164. data/test/samples/smooth1.jpg +0 -0
  165. data/test/samples/smooth2.jpg +0 -0
  166. data/test/samples/smooth3.jpg +0 -0
  167. data/test/samples/smooth4.jpg +0 -0
  168. data/test/samples/smooth5.jpg +0 -0
  169. data/test/samples/smooth6.jpg +0 -0
  170. data/test/samples/str-cv-rotated.jpg +0 -0
  171. data/test/samples/str-cv.jpg +0 -0
  172. data/test/samples/str-ov.jpg +0 -0
  173. data/test/samples/stuff.jpg +0 -0
  174. data/test/test_curve.rb +43 -0
  175. data/test/test_cvavgcomp.rb +24 -0
  176. data/test/test_cvbox2d.rb +76 -0
  177. data/test/test_cvcapture.rb +183 -0
  178. data/test/test_cvchain.rb +108 -0
  179. data/test/test_cvcircle32f.rb +41 -0
  180. data/test/test_cvconnectedcomp.rb +61 -0
  181. data/test/test_cvcontour.rb +150 -0
  182. data/test/test_cvcontourtree.rb +43 -0
  183. data/test/test_cverror.rb +50 -0
  184. data/test/test_cvfeaturetree.rb +65 -0
  185. data/test/test_cvfont.rb +58 -0
  186. data/test/test_cvhaarclassifiercascade.rb +63 -0
  187. data/test/test_cvhistogram.rb +271 -0
  188. data/test/test_cvhumoments.rb +83 -0
  189. data/test/test_cvline.rb +50 -0
  190. data/test/test_cvmat.rb +2752 -0
  191. data/test/test_cvmat_drawing.rb +318 -0
  192. data/test/test_cvmat_dxt.rb +147 -0
  193. data/test/test_cvmat_imageprocessing.rb +1943 -0
  194. data/test/test_cvmoments.rb +180 -0
  195. data/test/test_cvpoint.rb +75 -0
  196. data/test/test_cvpoint2d32f.rb +75 -0
  197. data/test/test_cvpoint3d32f.rb +93 -0
  198. data/test/test_cvrect.rb +144 -0
  199. data/test/test_cvscalar.rb +113 -0
  200. data/test/test_cvseq.rb +295 -0
  201. data/test/test_cvsize.rb +75 -0
  202. data/test/test_cvsize2d32f.rb +75 -0
  203. data/test/test_cvslice.rb +31 -0
  204. data/test/test_cvsurfparams.rb +57 -0
  205. data/test/test_cvsurfpoint.rb +66 -0
  206. data/test/test_cvtermcriteria.rb +56 -0
  207. data/test/test_cvtwopoints.rb +40 -0
  208. data/test/test_cvvideowriter.rb +58 -0
  209. data/test/test_iplconvkernel.rb +54 -0
  210. data/test/test_iplimage.rb +156 -0
  211. data/test/test_mouseevent.rb +17 -0
  212. data/test/test_opencv.rb +340 -0
  213. data/test/test_pointset.rb +130 -0
  214. data/test/test_preliminary.rb +130 -0
  215. data/test/test_trackbar.rb +47 -0
  216. data/test/test_window.rb +115 -0
  217. metadata +399 -0
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8-unix -*-
3
+ require 'test/unit'
4
+ require 'digest/md5'
5
+ require 'opencv'
6
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
7
+
8
+ include OpenCV
9
+
10
+ # Tests to run first; check the handful of basic operations that the later tests rely on
11
+ class TestPreliminary < OpenCVTestCase
12
+ def test_assert_array_equal
13
+ assert_array_equal([1, 2, 3, 4], [1, 2, 3, 4])
14
+
15
+ # Uncomment the following line to check the fail case
16
+ # assert_array_equal([1, 2, 3, 4], [1, 2, 3, 0])
17
+ end
18
+
19
+ def test_assert_cvscalar_equal
20
+ assert_cvscalar_equal(CvScalar.new(1, 2, 3, 4), CvScalar.new(1, 2, 3, 4))
21
+ assert_cvscalar_equal(CvScalar.new(0.1, 0.2, 0.3, 0.4), CvScalar.new(0.1, 0.2, 0.3, 0.4))
22
+
23
+ # Uncomment the following lines to check the fail cases
24
+ # assert_cvscalar_equal(CvScalar.new(1, 2, 3, 4), CvScalar.new(1, 2, 3, 0))
25
+ # assert_cvscalar_equal(CvScalar.new(0.1, 0.2, 0.3, 0.4), CvScalar.new(0.1, 0.2, 0.3, 0.0))
26
+ end
27
+
28
+ def test_assert_in_delta
29
+ assert_in_delta(1, 0.9999, 0.1)
30
+ assert_in_delta(CvScalar.new(1, 2, 3, 4), CvScalar.new(1.01, 2.01, 3.01, 4.01), 0.1)
31
+ assert_in_delta(CvScalar.new(1, 2, 3, 4), [1.01, 2.01, 3.01, 4.01], 0.1)
32
+ assert_in_delta([1, 2, 3, 4], CvScalar.new(1.01, 2.01, 3.01, 4.01), 0.1)
33
+ assert_in_delta([1, 2, 3, 4], [1.01, 2.01, 3.01, 4.01], 0.1)
34
+
35
+ # Uncomment the following lines to check the fail cases
36
+ # assert_in_delta(1, 0.009, 0.1)
37
+ # assert_in_delta(CvScalar.new(1, 2, 3, 4), CvScalar.new(1.01, 2.01, 3.01, 4.01), 0.001)
38
+ # assert_in_delta(CvScalar.new(1, 2, 3, 4), [1.01, 2.01, 3.01, 4.01], 0.001)
39
+ # assert_in_delta([1, 2, 3, 4], CvScalar.new(1.01, 2.01, 3.01, 4.01), 0.001)
40
+ # assert_in_delta([1, 2, 3, 4], [1.01, 2.01, 3.01, 4.01], 0.001)
41
+ end
42
+
43
+ def test_assert_each_cvscalar
44
+ mat1 = CvMat.new(5, 5, :cv32f, 4)
45
+ mat2 = CvMat.new(5, 5, :cv32f, 4)
46
+ c = 0
47
+ mat1.height.times { |j|
48
+ mat1.width.times { |i|
49
+ mat1[j, i] = CvScalar.new(c * 0.1, c * 0.2, c * 0.3, c * 0.4)
50
+ mat2[j, i] = CvScalar.new(c, c, c, c)
51
+ c += 1
52
+ }
53
+ }
54
+
55
+ assert_each_cvscalar(mat1, 0.001) { |j, i, n|
56
+ CvScalar.new(n * 0.1, n * 0.2, n * 0.3, n * 0.4)
57
+ }
58
+ assert_each_cvscalar(mat2) { |j, i, n|
59
+ CvScalar.new(n, n, n, n)
60
+ }
61
+
62
+ # Uncomment the following lines to check the fail cases
63
+ # assert_each_cvscalar(mat1, 0.001) { |j, i, n|
64
+ # CvScalar.new(n * 0.1, n * 0.2, n * 0.3, 0)
65
+ # }
66
+ # assert_each_cvscalar(mat1, 0.001) { |j, i, n|
67
+ # CvScalar.new(1, 2, 3, 4)
68
+ # }
69
+ # assert_each_cvscalar(mat2) { |j, i, n|
70
+ # CvScalar.new(n * 0.1, n * 0.2, n * 0.3, 0)
71
+ # }
72
+ # assert_each_cvscalar(mat2) { |j, i, n|
73
+ # CvScalar.new(1, 2, 3, 0)
74
+ # }
75
+ end
76
+
77
+
78
+ def test_create_cvmat
79
+ mat = create_cvmat(3, 4)
80
+ assert_equal(3, mat.height)
81
+ assert_equal(4, mat.width)
82
+ assert_equal(:cv8u, mat.depth)
83
+ assert_equal(4, mat.channel)
84
+ c = 0
85
+ mat.height.times { |j|
86
+ mat.width.times { |i|
87
+ s = CvScalar.new(c + 1, c + 1, c + 1, c + 1)
88
+ assert_cvscalar_equal(s, mat[j, i])
89
+ c += 1
90
+ }
91
+ }
92
+
93
+ mat = create_cvmat(2, 3, :cv16s, 2)
94
+ assert_equal(2, mat.height)
95
+ assert_equal(3, mat.width)
96
+ assert_equal(:cv16s, mat.depth)
97
+ assert_equal(2, mat.channel)
98
+ c = 0
99
+ mat.height.times { |j|
100
+ mat.width.times { |i|
101
+ s = CvScalar.new(c + 1, c + 1, 0, 0)
102
+ assert_cvscalar_equal(s, mat[j, i])
103
+ c += 1
104
+ }
105
+ }
106
+
107
+ mat = create_cvmat(2, 3, :cv16u, 3) { |j, i, cnt|
108
+ n = j + i + cnt
109
+ CvScalar.new(n, n, n, 0)
110
+ }
111
+ assert_equal(2, mat.height)
112
+ assert_equal(3, mat.width)
113
+ assert_equal(:cv16u, mat.depth)
114
+ assert_equal(3, mat.channel)
115
+ c = 0
116
+ mat.height.times { |j|
117
+ mat.width.times { |i|
118
+ n = j + i + c
119
+ assert_cvscalar_equal(CvScalar.new(n, n, n, 0), mat[j, i])
120
+ c += 1
121
+ }
122
+ }
123
+ end
124
+
125
+ def test_types
126
+ assert_equal(IplImage.new(7, 5, CV_8U, 1).class, IplImage)
127
+ assert_equal(CvMat.new(5, 7, CV_32F).class, CvMat)
128
+ end
129
+ end
130
+
@@ -0,0 +1,47 @@
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
+ include GUI
9
+
10
+ # Tests for OpenCV::Trackbar
11
+ class TestTrackbar < OpenCVTestCase
12
+ def setup
13
+ @trackbar1 = Trackbar.new('trackbar1', 100) {}
14
+ @trackbar2 = Trackbar.new('trackbar1', 100, 1) {}
15
+ end
16
+
17
+ def test_initialize
18
+ assert_not_nil(Trackbar.new('trackbar', 100, 1) {})
19
+ assert_not_nil(Trackbar.new('trackbar', 100) {})
20
+ block = proc {}
21
+ assert_not_nil(Trackbar.new('trackbar', 100, 1, &block))
22
+ assert_not_nil(Trackbar.new('trackbar', 100, &block))
23
+
24
+ assert_raise(TypeError) {
25
+ Trackbar.new(123, 100, 1) {}
26
+ }
27
+ assert_raise(ArgumentError) {
28
+ Trackbar.new('trackbar', 100, 1)
29
+ }
30
+ end
31
+
32
+ def test_name
33
+ assert_equal('trackbar1', @trackbar1.name)
34
+ end
35
+
36
+ def test_max
37
+ assert_equal(100, @trackbar1.max)
38
+ end
39
+
40
+ def test_value
41
+ assert_equal(0, @trackbar1.value)
42
+ assert_equal(1, @trackbar2.value)
43
+ @trackbar1.value = 50
44
+ assert_equal(50, @trackbar1.value)
45
+ end
46
+ end
47
+
@@ -0,0 +1,115 @@
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
+ include GUI
9
+
10
+ # Tests for OpenCV::Window
11
+ class TestWindow < OpenCVTestCase
12
+ def setup
13
+ @window1 = Window.new('window1')
14
+ @window2 = Window.new('window2', CV_WINDOW_AUTOSIZE)
15
+ @window3 = Window.new('window3', 0)
16
+ end
17
+
18
+ def teardown
19
+ Window::destroy_all
20
+ end
21
+
22
+ def test_initialize
23
+ [Window.new('w1'), Window.new('w2', CV_WINDOW_AUTOSIZE), Window.new('w3', 0)].each { |w|
24
+ assert_not_nil(w)
25
+ assert_equal(Window, w.class)
26
+ }
27
+
28
+ assert_raise(TypeError) {
29
+ Window.new('w4', 'foobar')
30
+ }
31
+
32
+ assert_raise(StandardError) {
33
+ Window.new('w5')
34
+ Window.new('w5')
35
+ }
36
+ end
37
+
38
+ def test_alive
39
+ assert(@window1.alive?)
40
+ @window1.destroy
41
+ assert(!(@window1.alive?))
42
+ end
43
+
44
+ def test_destroy
45
+ @window1.destroy
46
+ assert(!(@window1.alive?))
47
+ end
48
+
49
+ def test_destroy_all
50
+ Window::destroy_all
51
+ assert(!(@window1.alive?))
52
+ assert(!(@window2.alive?))
53
+ assert(!(@window3.alive?))
54
+ end
55
+
56
+ def test_resize
57
+ @window1.resize(CvSize.new(10, 20))
58
+ @window2.resize(100, 200)
59
+ assert_raise(ArgumentError) {
60
+ @window3.resize
61
+ }
62
+
63
+ # Uncomment the following lines to show the results
64
+ # @window1.show(CvMat.new(10, 20))
65
+ # @window1.resize(100, 200)
66
+ # GUI::wait_key
67
+ end
68
+
69
+ def test_move
70
+ @window1.move(CvPoint.new(10, 20))
71
+ @window2.move(100, 200)
72
+ assert_raise(ArgumentError) {
73
+ @window3.move
74
+ }
75
+
76
+ # Uncomment the following lines to show the results
77
+ # @window1.show(CvMat.new(10, 20))
78
+ # @window2.show(CvMat.new(100, 200))
79
+ # GUI::wait_key
80
+ end
81
+
82
+ def test_show_image
83
+ img = IplImage.load(FILENAME_CAT, CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR)
84
+ @window1.show_image(img)
85
+ @window2.show(img) # Alias
86
+
87
+ # Uncomment the following lines to show the results
88
+ # GUI::wait_key
89
+ end
90
+
91
+ def test_set_trackbar
92
+ tr1 = @window1.set_trackbar('trackbar1', 100) { |value|
93
+ puts value
94
+ }
95
+ assert_equal(Trackbar, tr1.class)
96
+
97
+ trackbar2 = Trackbar.new('trackbar2', 10, 1) {}
98
+ tr2 = @window2.set_trackbar(trackbar2)
99
+ assert_equal(Trackbar, tr2.class)
100
+ end
101
+
102
+ def test_set_mouseevent
103
+ @window1.set_mouse_callback { |mouse|
104
+ e = "#{mouse.x}, #{mouse.y} : #{mouse.event} : "
105
+ e << "<L>" if mouse.left_button?
106
+ e << "<R>" if mouse.right_button?
107
+ e << "<M>" if mouse.middle_button?
108
+ e << "[CTRL]" if mouse.ctrl_key?
109
+ e << "[SHIFT]" if mouse.shift_key?
110
+ e << "[ALT]" if mouse.alt_key?
111
+ puts e
112
+ }
113
+ end
114
+ end
115
+
metadata ADDED
@@ -0,0 +1,399 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: afeld-opencv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - lsxi
9
+ - ser1zw
10
+ - pcting
11
+ - afeld
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2012-07-13 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rdoc
19
+ requirement: !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: '3.10'
25
+ type: :development
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '3.10'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake-compiler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: hoe-gemspec
51
+ requirement: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ - !ruby/object:Gem::Dependency
66
+ name: rspec
67
+ requirement: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ type: :development
74
+ prerelease: false
75
+ version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: hoe
83
+ requirement: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: ! 'OpenCV wrapper for Ruby
98
+
99
+ '
100
+ email:
101
+ - masakazu.yonekura@gmail.com
102
+ - ''
103
+ - pcting@gmail.com
104
+ - aidan.feldman@gmail.com
105
+ executables: []
106
+ extensions:
107
+ - extconf.rb
108
+ extra_rdoc_files:
109
+ - History.txt
110
+ - License.txt
111
+ - Manifest.txt
112
+ - README.rdoc
113
+ files:
114
+ - .gitignore
115
+ - Gemfile
116
+ - History.txt
117
+ - License.txt
118
+ - Manifest.txt
119
+ - README.rdoc
120
+ - Rakefile
121
+ - examples/alpha_blend.rb
122
+ - examples/box.png
123
+ - examples/box_in_scene.png
124
+ - examples/contours/bitmap-contours-with-labels.png
125
+ - examples/contours/bitmap-contours.png
126
+ - examples/contours/bounding-box-detect-canny.rb
127
+ - examples/contours/contour_retrieval_modes.rb
128
+ - examples/contours/rotated-boxes.jpg
129
+ - examples/convexhull.rb
130
+ - examples/face_detect.rb
131
+ - examples/find_obj.rb
132
+ - examples/houghcircle.rb
133
+ - examples/inpaint.png
134
+ - examples/inpaint.rb
135
+ - examples/lenna-rotated.jpg
136
+ - examples/lenna.jpg
137
+ - examples/match_kdtree.rb
138
+ - examples/paint.rb
139
+ - examples/snake.rb
140
+ - examples/stuff.jpg
141
+ - examples/tiffany.jpg
142
+ - ext/opencv/curve.cpp
143
+ - ext/opencv/curve.h
144
+ - ext/opencv/cvavgcomp.cpp
145
+ - ext/opencv/cvavgcomp.h
146
+ - ext/opencv/cvbox2d.cpp
147
+ - ext/opencv/cvbox2d.h
148
+ - ext/opencv/cvcapture.cpp
149
+ - ext/opencv/cvcapture.h
150
+ - ext/opencv/cvchain.cpp
151
+ - ext/opencv/cvchain.h
152
+ - ext/opencv/cvcircle32f.cpp
153
+ - ext/opencv/cvcircle32f.h
154
+ - ext/opencv/cvcondensation.cpp
155
+ - ext/opencv/cvcondensation.h
156
+ - ext/opencv/cvconnectedcomp.cpp
157
+ - ext/opencv/cvconnectedcomp.h
158
+ - ext/opencv/cvcontour.cpp
159
+ - ext/opencv/cvcontour.h
160
+ - ext/opencv/cvcontourtree.cpp
161
+ - ext/opencv/cvcontourtree.h
162
+ - ext/opencv/cvconvexitydefect.cpp
163
+ - ext/opencv/cvconvexitydefect.h
164
+ - ext/opencv/cverror.cpp
165
+ - ext/opencv/cverror.h
166
+ - ext/opencv/cvfeaturetree.cpp
167
+ - ext/opencv/cvfeaturetree.h
168
+ - ext/opencv/cvfont.cpp
169
+ - ext/opencv/cvfont.h
170
+ - ext/opencv/cvhaarclassifiercascade.cpp
171
+ - ext/opencv/cvhaarclassifiercascade.h
172
+ - ext/opencv/cvhistogram.cpp
173
+ - ext/opencv/cvhistogram.h
174
+ - ext/opencv/cvhumoments.cpp
175
+ - ext/opencv/cvhumoments.h
176
+ - ext/opencv/cvline.cpp
177
+ - ext/opencv/cvline.h
178
+ - ext/opencv/cvmat.cpp
179
+ - ext/opencv/cvmat.h
180
+ - ext/opencv/cvmatnd.cpp
181
+ - ext/opencv/cvmatnd.h
182
+ - ext/opencv/cvmemstorage.cpp
183
+ - ext/opencv/cvmemstorage.h
184
+ - ext/opencv/cvmoments.cpp
185
+ - ext/opencv/cvmoments.h
186
+ - ext/opencv/cvpoint.cpp
187
+ - ext/opencv/cvpoint.h
188
+ - ext/opencv/cvpoint2d32f.cpp
189
+ - ext/opencv/cvpoint2d32f.h
190
+ - ext/opencv/cvpoint3d32f.cpp
191
+ - ext/opencv/cvpoint3d32f.h
192
+ - ext/opencv/cvrect.cpp
193
+ - ext/opencv/cvrect.h
194
+ - ext/opencv/cvscalar.cpp
195
+ - ext/opencv/cvscalar.h
196
+ - ext/opencv/cvseq.cpp
197
+ - ext/opencv/cvseq.h
198
+ - ext/opencv/cvsize.cpp
199
+ - ext/opencv/cvsize.h
200
+ - ext/opencv/cvsize2d32f.cpp
201
+ - ext/opencv/cvsize2d32f.h
202
+ - ext/opencv/cvslice.cpp
203
+ - ext/opencv/cvslice.h
204
+ - ext/opencv/cvsparsemat.cpp
205
+ - ext/opencv/cvsparsemat.h
206
+ - ext/opencv/cvsurfparams.cpp
207
+ - ext/opencv/cvsurfparams.h
208
+ - ext/opencv/cvsurfpoint.cpp
209
+ - ext/opencv/cvsurfpoint.h
210
+ - ext/opencv/cvtermcriteria.cpp
211
+ - ext/opencv/cvtermcriteria.h
212
+ - ext/opencv/cvtwopoints.cpp
213
+ - ext/opencv/cvtwopoints.h
214
+ - ext/opencv/cvutils.cpp
215
+ - ext/opencv/cvutils.h
216
+ - ext/opencv/cvvideowriter.cpp
217
+ - ext/opencv/cvvideowriter.h
218
+ - ext/opencv/gui.cpp
219
+ - ext/opencv/gui.h
220
+ - ext/opencv/iplconvkernel.cpp
221
+ - ext/opencv/iplconvkernel.h
222
+ - ext/opencv/iplimage.cpp
223
+ - ext/opencv/iplimage.h
224
+ - ext/opencv/lib/opencv.rb
225
+ - ext/opencv/lib/opencv/psyched_yaml.rb
226
+ - ext/opencv/lib/opencv/version.rb
227
+ - ext/opencv/mouseevent.cpp
228
+ - ext/opencv/mouseevent.h
229
+ - ext/opencv/opencv.cpp
230
+ - ext/opencv/opencv.h
231
+ - ext/opencv/pointset.cpp
232
+ - ext/opencv/pointset.h
233
+ - ext/opencv/trackbar.cpp
234
+ - ext/opencv/trackbar.h
235
+ - ext/opencv/window.cpp
236
+ - ext/opencv/window.h
237
+ - extconf.rb
238
+ - images/CvMat_sobel.png
239
+ - images/CvMat_sub_rect.png
240
+ - images/CvSeq_relationmap.png
241
+ - images/face_detect_from_lena.jpg
242
+ - test/helper.rb
243
+ - test/runner.rb
244
+ - test/samples/airplane.jpg
245
+ - test/samples/baboon.jpg
246
+ - test/samples/baboon200.jpg
247
+ - test/samples/baboon200_rotated.jpg
248
+ - test/samples/blank0.jpg
249
+ - test/samples/blank1.jpg
250
+ - test/samples/blank2.jpg
251
+ - test/samples/blank3.jpg
252
+ - test/samples/blank4.jpg
253
+ - test/samples/blank5.jpg
254
+ - test/samples/blank6.jpg
255
+ - test/samples/blank7.jpg
256
+ - test/samples/blank8.jpg
257
+ - test/samples/blank9.jpg
258
+ - test/samples/cat.jpg
259
+ - test/samples/contours.jpg
260
+ - test/samples/fruits.jpg
261
+ - test/samples/haarcascade_frontalface_alt.xml.gz
262
+ - test/samples/inpaint-mask.bmp
263
+ - test/samples/lena-256x256.jpg
264
+ - test/samples/lena-32x32.jpg
265
+ - test/samples/lena-eyes.jpg
266
+ - test/samples/lena-inpaint.jpg
267
+ - test/samples/lena.jpg
268
+ - test/samples/lines.jpg
269
+ - test/samples/messy0.jpg
270
+ - test/samples/messy1.jpg
271
+ - test/samples/movie_sample.avi
272
+ - test/samples/one_way_train_0000.jpg
273
+ - test/samples/one_way_train_0001.jpg
274
+ - test/samples/partially_blank0.jpg
275
+ - test/samples/partially_blank1.jpg
276
+ - test/samples/smooth0.jpg
277
+ - test/samples/smooth1.jpg
278
+ - test/samples/smooth2.jpg
279
+ - test/samples/smooth3.jpg
280
+ - test/samples/smooth4.jpg
281
+ - test/samples/smooth5.jpg
282
+ - test/samples/smooth6.jpg
283
+ - test/samples/str-cv-rotated.jpg
284
+ - test/samples/str-cv.jpg
285
+ - test/samples/str-ov.jpg
286
+ - test/samples/stuff.jpg
287
+ - test/test_curve.rb
288
+ - test/test_cvavgcomp.rb
289
+ - test/test_cvbox2d.rb
290
+ - test/test_cvcapture.rb
291
+ - test/test_cvchain.rb
292
+ - test/test_cvcircle32f.rb
293
+ - test/test_cvconnectedcomp.rb
294
+ - test/test_cvcontour.rb
295
+ - test/test_cvcontourtree.rb
296
+ - test/test_cverror.rb
297
+ - test/test_cvfeaturetree.rb
298
+ - test/test_cvfont.rb
299
+ - test/test_cvhaarclassifiercascade.rb
300
+ - test/test_cvhistogram.rb
301
+ - test/test_cvhumoments.rb
302
+ - test/test_cvline.rb
303
+ - test/test_cvmat.rb
304
+ - test/test_cvmat_drawing.rb
305
+ - test/test_cvmat_dxt.rb
306
+ - test/test_cvmat_imageprocessing.rb
307
+ - test/test_cvmoments.rb
308
+ - test/test_cvpoint.rb
309
+ - test/test_cvpoint2d32f.rb
310
+ - test/test_cvpoint3d32f.rb
311
+ - test/test_cvrect.rb
312
+ - test/test_cvscalar.rb
313
+ - test/test_cvseq.rb
314
+ - test/test_cvsize.rb
315
+ - test/test_cvsize2d32f.rb
316
+ - test/test_cvslice.rb
317
+ - test/test_cvsurfparams.rb
318
+ - test/test_cvsurfpoint.rb
319
+ - test/test_cvtermcriteria.rb
320
+ - test/test_cvtwopoints.rb
321
+ - test/test_cvvideowriter.rb
322
+ - test/test_iplconvkernel.rb
323
+ - test/test_iplimage.rb
324
+ - test/test_mouseevent.rb
325
+ - test/test_opencv.rb
326
+ - test/test_pointset.rb
327
+ - test/test_preliminary.rb
328
+ - test/test_trackbar.rb
329
+ - test/test_window.rb
330
+ homepage: https://github.com/afeld/ruby-opencv
331
+ licenses: []
332
+ post_install_message:
333
+ rdoc_options:
334
+ - --main
335
+ - README.rdoc
336
+ require_paths:
337
+ - lib
338
+ required_ruby_version: !ruby/object:Gem::Requirement
339
+ none: false
340
+ requirements:
341
+ - - ! '>='
342
+ - !ruby/object:Gem::Version
343
+ version: '0'
344
+ required_rubygems_version: !ruby/object:Gem::Requirement
345
+ none: false
346
+ requirements:
347
+ - - ! '>='
348
+ - !ruby/object:Gem::Version
349
+ version: '0'
350
+ requirements: []
351
+ rubyforge_project: afeld-opencv
352
+ rubygems_version: 1.8.24
353
+ signing_key:
354
+ specification_version: 3
355
+ summary: OpenCV wrapper for Ruby.
356
+ test_files:
357
+ - test/test_curve.rb
358
+ - test/test_cvavgcomp.rb
359
+ - test/test_cvbox2d.rb
360
+ - test/test_cvcapture.rb
361
+ - test/test_cvchain.rb
362
+ - test/test_cvcircle32f.rb
363
+ - test/test_cvconnectedcomp.rb
364
+ - test/test_cvcontour.rb
365
+ - test/test_cvcontourtree.rb
366
+ - test/test_cverror.rb
367
+ - test/test_cvfeaturetree.rb
368
+ - test/test_cvfont.rb
369
+ - test/test_cvhaarclassifiercascade.rb
370
+ - test/test_cvhistogram.rb
371
+ - test/test_cvhumoments.rb
372
+ - test/test_cvline.rb
373
+ - test/test_cvmat.rb
374
+ - test/test_cvmat_drawing.rb
375
+ - test/test_cvmat_dxt.rb
376
+ - test/test_cvmat_imageprocessing.rb
377
+ - test/test_cvmoments.rb
378
+ - test/test_cvpoint.rb
379
+ - test/test_cvpoint2d32f.rb
380
+ - test/test_cvpoint3d32f.rb
381
+ - test/test_cvrect.rb
382
+ - test/test_cvscalar.rb
383
+ - test/test_cvseq.rb
384
+ - test/test_cvsize.rb
385
+ - test/test_cvsize2d32f.rb
386
+ - test/test_cvslice.rb
387
+ - test/test_cvsurfparams.rb
388
+ - test/test_cvsurfpoint.rb
389
+ - test/test_cvtermcriteria.rb
390
+ - test/test_cvtwopoints.rb
391
+ - test/test_cvvideowriter.rb
392
+ - test/test_iplconvkernel.rb
393
+ - test/test_iplimage.rb
394
+ - test/test_mouseevent.rb
395
+ - test/test_opencv.rb
396
+ - test/test_pointset.rb
397
+ - test/test_preliminary.rb
398
+ - test/test_trackbar.rb
399
+ - test/test_window.rb