jf-ruby-opencv 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +28 -0
  3. data/.yardopts +3 -0
  4. data/DEVELOPERS_NOTE.md +137 -0
  5. data/Gemfile +9 -0
  6. data/History.txt +5 -0
  7. data/License.txt +30 -0
  8. data/Manifest.txt +239 -0
  9. data/README.md +94 -0
  10. data/Rakefile +99 -0
  11. data/config.yml +7 -0
  12. data/examples/alpha_blend.rb +21 -0
  13. data/examples/contours/bitmap-contours-with-labels.png +0 -0
  14. data/examples/contours/bitmap-contours.png +0 -0
  15. data/examples/contours/bounding-box-detect-canny.rb +62 -0
  16. data/examples/contours/contour_retrieval_modes.rb +139 -0
  17. data/examples/contours/rotated-boxes.jpg +0 -0
  18. data/examples/convexhull.rb +47 -0
  19. data/examples/face_detect.rb +20 -0
  20. data/examples/facerec/create_csv.rb +43 -0
  21. data/examples/facerec/facerec_eigenfaces.rb +132 -0
  22. data/examples/facerec/facerec_fisherfaces.rb +131 -0
  23. data/examples/facerec/facerec_lbph.rb +116 -0
  24. data/examples/facerec/readme.md +111 -0
  25. data/examples/find_obj.rb +169 -0
  26. data/examples/houghcircle.rb +22 -0
  27. data/examples/images/box.png +0 -0
  28. data/examples/images/box_in_scene.png +0 -0
  29. data/examples/images/inpaint.png +0 -0
  30. data/examples/images/lena-256x256.jpg +0 -0
  31. data/examples/images/lena-eyes.jpg +0 -0
  32. data/examples/images/lenna-rotated.jpg +0 -0
  33. data/examples/images/lenna.jpg +0 -0
  34. data/examples/images/stuff.jpg +0 -0
  35. data/examples/images/tiffany.jpg +0 -0
  36. data/examples/inpaint.rb +57 -0
  37. data/examples/match_kdtree.rb +88 -0
  38. data/examples/match_template.rb +26 -0
  39. data/examples/paint.rb +70 -0
  40. data/examples/snake.rb +43 -0
  41. data/ext/opencv/algorithm.cpp +291 -0
  42. data/ext/opencv/algorithm.h +38 -0
  43. data/ext/opencv/curve.cpp +127 -0
  44. data/ext/opencv/curve.h +34 -0
  45. data/ext/opencv/cvavgcomp.cpp +64 -0
  46. data/ext/opencv/cvavgcomp.h +39 -0
  47. data/ext/opencv/cvbox2d.cpp +195 -0
  48. data/ext/opencv/cvbox2d.h +61 -0
  49. data/ext/opencv/cvcapture.cpp +633 -0
  50. data/ext/opencv/cvcapture.h +82 -0
  51. data/ext/opencv/cvchain.cpp +233 -0
  52. data/ext/opencv/cvchain.h +46 -0
  53. data/ext/opencv/cvcircle32f.cpp +126 -0
  54. data/ext/opencv/cvcircle32f.h +52 -0
  55. data/ext/opencv/cvconnectedcomp.cpp +156 -0
  56. data/ext/opencv/cvconnectedcomp.h +49 -0
  57. data/ext/opencv/cvcontour.cpp +384 -0
  58. data/ext/opencv/cvcontour.h +51 -0
  59. data/ext/opencv/cvcontourtree.cpp +96 -0
  60. data/ext/opencv/cvcontourtree.h +41 -0
  61. data/ext/opencv/cvconvexitydefect.cpp +92 -0
  62. data/ext/opencv/cvconvexitydefect.h +42 -0
  63. data/ext/opencv/cverror.cpp +115 -0
  64. data/ext/opencv/cverror.h +28 -0
  65. data/ext/opencv/cvfeaturetree.cpp +123 -0
  66. data/ext/opencv/cvfeaturetree.h +55 -0
  67. data/ext/opencv/cvfont.cpp +228 -0
  68. data/ext/opencv/cvfont.h +64 -0
  69. data/ext/opencv/cvhaarclassifiercascade.cpp +148 -0
  70. data/ext/opencv/cvhaarclassifiercascade.h +39 -0
  71. data/ext/opencv/cvhistogram.cpp +717 -0
  72. data/ext/opencv/cvhistogram.h +73 -0
  73. data/ext/opencv/cvhumoments.cpp +178 -0
  74. data/ext/opencv/cvhumoments.h +51 -0
  75. data/ext/opencv/cvline.cpp +159 -0
  76. data/ext/opencv/cvline.h +54 -0
  77. data/ext/opencv/cvmat.cpp +6086 -0
  78. data/ext/opencv/cvmat.h +290 -0
  79. data/ext/opencv/cvmemstorage.cpp +73 -0
  80. data/ext/opencv/cvmemstorage.h +50 -0
  81. data/ext/opencv/cvmoments.cpp +293 -0
  82. data/ext/opencv/cvmoments.h +75 -0
  83. data/ext/opencv/cvpoint.cpp +234 -0
  84. data/ext/opencv/cvpoint.h +64 -0
  85. data/ext/opencv/cvpoint2d32f.cpp +216 -0
  86. data/ext/opencv/cvpoint2d32f.h +63 -0
  87. data/ext/opencv/cvpoint3d32f.cpp +252 -0
  88. data/ext/opencv/cvpoint3d32f.h +66 -0
  89. data/ext/opencv/cvrect.cpp +338 -0
  90. data/ext/opencv/cvrect.h +79 -0
  91. data/ext/opencv/cvscalar.cpp +241 -0
  92. data/ext/opencv/cvscalar.h +71 -0
  93. data/ext/opencv/cvseq.cpp +663 -0
  94. data/ext/opencv/cvseq.h +75 -0
  95. data/ext/opencv/cvsize.cpp +227 -0
  96. data/ext/opencv/cvsize.h +65 -0
  97. data/ext/opencv/cvsize2d32f.cpp +215 -0
  98. data/ext/opencv/cvsize2d32f.h +64 -0
  99. data/ext/opencv/cvslice.cpp +126 -0
  100. data/ext/opencv/cvslice.h +61 -0
  101. data/ext/opencv/cvsurfparams.cpp +208 -0
  102. data/ext/opencv/cvsurfparams.h +58 -0
  103. data/ext/opencv/cvsurfpoint.cpp +246 -0
  104. data/ext/opencv/cvsurfpoint.h +52 -0
  105. data/ext/opencv/cvtermcriteria.cpp +198 -0
  106. data/ext/opencv/cvtermcriteria.h +71 -0
  107. data/ext/opencv/cvtwopoints.cpp +122 -0
  108. data/ext/opencv/cvtwopoints.h +51 -0
  109. data/ext/opencv/cvutils.cpp +192 -0
  110. data/ext/opencv/cvutils.h +30 -0
  111. data/ext/opencv/cvvideowriter.cpp +142 -0
  112. data/ext/opencv/cvvideowriter.h +43 -0
  113. data/ext/opencv/eigenfaces.cpp +75 -0
  114. data/ext/opencv/eigenfaces.h +30 -0
  115. data/ext/opencv/extconf.rb +77 -0
  116. data/ext/opencv/facerecognizer.cpp +219 -0
  117. data/ext/opencv/facerecognizer.h +46 -0
  118. data/ext/opencv/fisherfaces.cpp +75 -0
  119. data/ext/opencv/fisherfaces.h +30 -0
  120. data/ext/opencv/gui.cpp +71 -0
  121. data/ext/opencv/gui.h +30 -0
  122. data/ext/opencv/iplconvkernel.cpp +198 -0
  123. data/ext/opencv/iplconvkernel.h +71 -0
  124. data/ext/opencv/iplimage.cpp +651 -0
  125. data/ext/opencv/iplimage.h +73 -0
  126. data/ext/opencv/lbph.cpp +78 -0
  127. data/ext/opencv/lbph.h +30 -0
  128. data/ext/opencv/mouseevent.cpp +186 -0
  129. data/ext/opencv/mouseevent.h +56 -0
  130. data/ext/opencv/opencv.cpp +819 -0
  131. data/ext/opencv/opencv.h +408 -0
  132. data/ext/opencv/pointset.cpp +280 -0
  133. data/ext/opencv/pointset.h +68 -0
  134. data/ext/opencv/trackbar.cpp +127 -0
  135. data/ext/opencv/trackbar.h +69 -0
  136. data/ext/opencv/window.cpp +377 -0
  137. data/ext/opencv/window.h +66 -0
  138. data/images/CvMat_sobel.png +0 -0
  139. data/images/CvMat_sub_rect.png +0 -0
  140. data/images/CvSeq_relationmap.png +0 -0
  141. data/lib/opencv.rb +12 -0
  142. data/lib/opencv/psyched_yaml.rb +22 -0
  143. data/lib/opencv/version.rb +3 -0
  144. data/ruby-opencv.gemspec +44 -0
  145. data/test/eigenfaces_save.xml +7524 -0
  146. data/test/fisherfaces_save.xml +7530 -0
  147. data/test/helper.rb +167 -0
  148. data/test/lbph_save.xml +4304 -0
  149. data/test/runner.rb +30 -0
  150. data/test/samples/airplane.jpg +0 -0
  151. data/test/samples/baboon.jpg +0 -0
  152. data/test/samples/baboon200.jpg +0 -0
  153. data/test/samples/baboon200_rotated.jpg +0 -0
  154. data/test/samples/blank0.jpg +0 -0
  155. data/test/samples/blank1.jpg +0 -0
  156. data/test/samples/blank2.jpg +0 -0
  157. data/test/samples/blank3.jpg +0 -0
  158. data/test/samples/blank4.jpg +0 -0
  159. data/test/samples/blank5.jpg +0 -0
  160. data/test/samples/blank6.jpg +0 -0
  161. data/test/samples/blank7.jpg +0 -0
  162. data/test/samples/blank8.jpg +0 -0
  163. data/test/samples/blank9.jpg +0 -0
  164. data/test/samples/cat.jpg +0 -0
  165. data/test/samples/chessboard.jpg +0 -0
  166. data/test/samples/contours.jpg +0 -0
  167. data/test/samples/fruits.jpg +0 -0
  168. data/test/samples/haarcascade_frontalface_alt.xml.gz +0 -0
  169. data/test/samples/inpaint-mask.bmp +0 -0
  170. data/test/samples/lena-256x256.jpg +0 -0
  171. data/test/samples/lena-32x32.jpg +0 -0
  172. data/test/samples/lena-eyes.jpg +0 -0
  173. data/test/samples/lena-inpaint.jpg +0 -0
  174. data/test/samples/lena.jpg +0 -0
  175. data/test/samples/lines.jpg +0 -0
  176. data/test/samples/messy0.jpg +0 -0
  177. data/test/samples/messy1.jpg +0 -0
  178. data/test/samples/movie_sample.avi +0 -0
  179. data/test/samples/one_way_train_0000.jpg +0 -0
  180. data/test/samples/one_way_train_0001.jpg +0 -0
  181. data/test/samples/partially_blank0.jpg +0 -0
  182. data/test/samples/partially_blank1.jpg +0 -0
  183. data/test/samples/smooth0.jpg +0 -0
  184. data/test/samples/smooth1.jpg +0 -0
  185. data/test/samples/smooth2.jpg +0 -0
  186. data/test/samples/smooth3.jpg +0 -0
  187. data/test/samples/smooth4.jpg +0 -0
  188. data/test/samples/smooth5.jpg +0 -0
  189. data/test/samples/smooth6.jpg +0 -0
  190. data/test/samples/str-cv-rotated.jpg +0 -0
  191. data/test/samples/str-cv.jpg +0 -0
  192. data/test/samples/str-ov.jpg +0 -0
  193. data/test/samples/stuff.jpg +0 -0
  194. data/test/test_curve.rb +43 -0
  195. data/test/test_cvavgcomp.rb +24 -0
  196. data/test/test_cvbox2d.rb +76 -0
  197. data/test/test_cvcapture.rb +191 -0
  198. data/test/test_cvchain.rb +108 -0
  199. data/test/test_cvcircle32f.rb +41 -0
  200. data/test/test_cvconnectedcomp.rb +61 -0
  201. data/test/test_cvcontour.rb +171 -0
  202. data/test/test_cvcontourtree.rb +43 -0
  203. data/test/test_cverror.rb +50 -0
  204. data/test/test_cvfeaturetree.rb +65 -0
  205. data/test/test_cvfont.rb +58 -0
  206. data/test/test_cvhaarclassifiercascade.rb +63 -0
  207. data/test/test_cvhistogram.rb +271 -0
  208. data/test/test_cvhumoments.rb +83 -0
  209. data/test/test_cvline.rb +50 -0
  210. data/test/test_cvmat.rb +3036 -0
  211. data/test/test_cvmat_drawing.rb +349 -0
  212. data/test/test_cvmat_dxt.rb +150 -0
  213. data/test/test_cvmat_imageprocessing.rb +2085 -0
  214. data/test/test_cvmoments.rb +180 -0
  215. data/test/test_cvpoint.rb +75 -0
  216. data/test/test_cvpoint2d32f.rb +75 -0
  217. data/test/test_cvpoint3d32f.rb +93 -0
  218. data/test/test_cvrect.rb +144 -0
  219. data/test/test_cvscalar.rb +113 -0
  220. data/test/test_cvseq.rb +311 -0
  221. data/test/test_cvsize.rb +75 -0
  222. data/test/test_cvsize2d32f.rb +75 -0
  223. data/test/test_cvslice.rb +31 -0
  224. data/test/test_cvsurfparams.rb +57 -0
  225. data/test/test_cvsurfpoint.rb +66 -0
  226. data/test/test_cvtermcriteria.rb +56 -0
  227. data/test/test_cvtwopoints.rb +40 -0
  228. data/test/test_cvvideowriter.rb +58 -0
  229. data/test/test_eigenfaces.rb +93 -0
  230. data/test/test_fisherfaces.rb +93 -0
  231. data/test/test_iplconvkernel.rb +54 -0
  232. data/test/test_iplimage.rb +232 -0
  233. data/test/test_lbph.rb +166 -0
  234. data/test/test_mouseevent.rb +17 -0
  235. data/test/test_opencv.rb +360 -0
  236. data/test/test_pointset.rb +128 -0
  237. data/test/test_preliminary.rb +130 -0
  238. data/test/test_trackbar.rb +47 -0
  239. data/test/test_window.rb +115 -0
  240. data/yard_extension.rb +5 -0
  241. metadata +352 -0
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8 -*-
3
+ require 'test/unit'
4
+
5
+ src_testdir = File.dirname(File.expand_path(__FILE__))
6
+ if Test::Unit.methods.include? :setup_argv
7
+ srcdir = File.dirname(src_testdir)
8
+ Test::Unit.setup_argv {|files|
9
+ if files.empty?
10
+ [src_testdir]
11
+ else
12
+ files.map {|f|
13
+ if File.exist? "#{src_testdir}/#{f}"
14
+ "#{src_testdir}/#{f}"
15
+ elsif File.exist? "#{srcdir}/#{f}"
16
+ "#{srcdir}/#{f}"
17
+ elsif File.exist? f
18
+ f
19
+ else
20
+ raise ArgumentError, "not found: #{f}"
21
+ end
22
+ }
23
+ end
24
+ }
25
+ elsif Test::Unit.constants.map {|c| c.to_sym }.include? :AutoRunner
26
+ Test::Unit::AutoRunner.run(true, src_testdir)
27
+ else
28
+ raise 'Test runner not found'
29
+ end
30
+
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,43 @@
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::Curve
10
+ class TestCurve < OpenCVTestCase
11
+ def setup
12
+ @contour1 = CvContour.new
13
+
14
+ mat0 = create_cvmat(128, 128, :cv8u, 1) { |j, i|
15
+ (j - 64) ** 2 + (i - 64) ** 2 <= (32 ** 2) ? CvColor::White : CvColor::Black
16
+ }
17
+ @contour2 = mat0.find_contours
18
+ end
19
+
20
+ def test_closed
21
+ assert_false(@contour1.closed?)
22
+ assert(@contour2.closed?)
23
+ end
24
+
25
+ def test_convex
26
+ assert_false(@contour1.convex?)
27
+ end
28
+
29
+ def test_hole
30
+ assert_false(@contour1.hole?)
31
+ end
32
+
33
+ def test_simple
34
+ assert(@contour1.simple?)
35
+ end
36
+
37
+ def test_arc_length
38
+ assert_in_delta(211.480, @contour2.arc_length, 0.001)
39
+ assert_in_delta(32.181, @contour2.arc_length(CvSlice.new(0, 9), true), 0.001)
40
+ assert_in_delta(32.181, @contour2.arc_length(0..10, true), 0.001)
41
+ end
42
+ end
43
+
@@ -0,0 +1,24 @@
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::CvAvgComp
10
+ class TestCvAvgComp < OpenCVTestCase
11
+ def setup
12
+ @avgcomp = CvAvgComp.new
13
+ end
14
+
15
+ def test_initialize
16
+ assert_equal(CvAvgComp, @avgcomp.class)
17
+ assert(@avgcomp.is_a? CvRect)
18
+ end
19
+
20
+ def test_neighbors
21
+ assert_kind_of(Integer, @avgcomp.neighbors)
22
+ end
23
+ end
24
+
@@ -0,0 +1,76 @@
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::CvBox2D
10
+ class TestCvBox2D < OpenCVTestCase
11
+ class MyPoint; end
12
+ def test_initialize
13
+ box = CvBox2D.new
14
+ assert_in_delta(0, box.center.x, 0.001)
15
+ assert_in_delta(0, box.center.y, 0.001)
16
+ assert_in_delta(0, box.size.width, 0.001)
17
+ assert_in_delta(0, box.size.height, 0.001)
18
+ assert_in_delta(0, box.angle, 0.001)
19
+
20
+ box = CvBox2D.new(CvPoint2D32f.new(1.1, 2.2), CvSize2D32f.new(3.3, 4.4), 5.5)
21
+ assert_in_delta(1.1, box.center.x, 0.001)
22
+ assert_in_delta(2.2, box.center.y, 0.001)
23
+ assert_in_delta(3.3, box.size.width, 0.001)
24
+ assert_in_delta(4.4, box.size.height, 0.001)
25
+ assert_in_delta(5.5, box.angle, 0.001)
26
+ end
27
+
28
+ def test_center
29
+ box = CvBox2D.new
30
+ box.center = CvPoint2D32f.new(1.1, 2.2)
31
+ assert_in_delta(1.1, box.center.x, 0.001)
32
+ assert_in_delta(2.2, box.center.y, 0.001)
33
+
34
+ box.center.x = 3.3
35
+ box.center.y = 4.4
36
+ assert_in_delta(3.3, box.center.x, 0.001)
37
+ assert_in_delta(4.4, box.center.y, 0.001)
38
+ end
39
+
40
+ def test_size
41
+ box = CvBox2D.new
42
+ box.size = CvSize2D32f.new(1.1, 2.2)
43
+ assert_in_delta(1.1, box.size.width, 0.001)
44
+ assert_in_delta(2.2, box.size.height, 0.001)
45
+
46
+ box.size.width = 3.3
47
+ box.size.height = 4.4
48
+ assert_in_delta(3.3, box.size.width, 0.001)
49
+ assert_in_delta(4.4, box.size.height, 0.001)
50
+ end
51
+
52
+ def test_angle
53
+ box = CvBox2D.new
54
+ box.angle = 1.1
55
+ assert_in_delta(1.1, box.angle, 0.001)
56
+ end
57
+
58
+ def test_points
59
+ box = CvBox2D.new
60
+ box.center = CvPoint2D32f.new(10, 20)
61
+ box.size = CvSize2D32f.new(5, 7)
62
+ pt = box.points
63
+
64
+ assert_equal(4, pt.size)
65
+ assert_in_delta(7.5, pt[0].x, 0.001)
66
+ assert_in_delta(23.5, pt[0].y, 0.001)
67
+ assert_in_delta(7.5, pt[1].x, 0.001)
68
+ assert_in_delta(16.5, pt[1].y, 0.001)
69
+ assert_in_delta(12.5, pt[2].x, 0.001)
70
+ assert_in_delta(16.5, pt[2].y, 0.001)
71
+ assert_in_delta(12.5, pt[3].x, 0.001)
72
+ assert_in_delta(23.5, pt[3].y, 0.001)
73
+ end
74
+ end
75
+
76
+
@@ -0,0 +1,191 @@
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::CvCapture
10
+ class TestCvCapture < OpenCVTestCase
11
+ def setup
12
+ @cap = CvCapture.open(AVI_SAMPLE)
13
+ @cap.query
14
+ end
15
+
16
+ def teardown
17
+ @cap = nil
18
+ end
19
+
20
+ def test_INTERFACE
21
+ assert_equal(CvCapture::INTERFACE[:any], 0)
22
+ assert_equal(CvCapture::INTERFACE[:mil], 100)
23
+ assert_equal(CvCapture::INTERFACE[:vfw], 200)
24
+ assert_equal(CvCapture::INTERFACE[:v4l], 200)
25
+ assert_equal(CvCapture::INTERFACE[:v4l2], 200)
26
+ assert_equal(CvCapture::INTERFACE[:fireware], 300)
27
+ assert_equal(CvCapture::INTERFACE[:ieee1394], 300)
28
+ assert_equal(CvCapture::INTERFACE[:dc1394], 300)
29
+ assert_equal(CvCapture::INTERFACE[:cmu1394], 300)
30
+ assert_equal(CvCapture::INTERFACE[:stereo], 400)
31
+ assert_equal(CvCapture::INTERFACE[:tyzx], 400)
32
+ assert_equal(CvCapture::INTERFACE[:tyzx_left], 400)
33
+ assert_equal(CvCapture::INTERFACE[:tyzx_right], 401)
34
+ assert_equal(CvCapture::INTERFACE[:tyzx_color], 402)
35
+ assert_equal(CvCapture::INTERFACE[:tyzx_z], 403)
36
+ assert_equal(CvCapture::INTERFACE[:qt], 500)
37
+ assert_equal(CvCapture::INTERFACE[:quicktime], 500)
38
+ end
39
+
40
+ def test_open
41
+ cap1 = CvCapture.open(AVI_SAMPLE)
42
+ assert_equal(CvCapture, cap1.class)
43
+
44
+ # Uncomment the following lines to test capturing from camera
45
+ # cap2 = CvCapture.open(0)
46
+ # assert_equal(CvCapture, cap2.class)
47
+ # CvCapture::INTERFACE.each { |k, v|
48
+ # cap3 = CvCapture.open(k)
49
+ # assert_equal(CvCapture, cap3.class)
50
+ # }
51
+ end
52
+
53
+ def test_close
54
+ cap1 = CvCapture.open(AVI_SAMPLE)
55
+ cap1.close
56
+ assert_raise(IOError) do
57
+ cap1.query
58
+ end
59
+ end
60
+
61
+ def test_grab
62
+ assert(@cap.grab)
63
+ end
64
+
65
+ def test_retrieve
66
+ @cap.grab
67
+ img = @cap.retrieve
68
+ assert_equal(IplImage, img.class)
69
+ end
70
+
71
+ def test_query
72
+ img = @cap.query
73
+ assert_equal(IplImage, img.class)
74
+ end
75
+
76
+ def test_millisecond
77
+ @cap.millisecond = 10
78
+ assert(@cap.millisecond.is_a? Numeric)
79
+ # assert_equal(10, @cap.millisecond)
80
+ @cap.millisecond = 20
81
+ assert(@cap.millisecond.is_a? Numeric)
82
+ # assert_equal(20, @cap.millisecond)
83
+ end
84
+
85
+ def test_frames
86
+ @cap.frames = 10
87
+ assert(@cap.frames.is_a? Numeric)
88
+ # assert_equal(10, @cap.frames)
89
+ @cap.frames = 20
90
+ assert(@cap.frames.is_a? Numeric)
91
+ # assert_equal(20, @cap.frames)
92
+ end
93
+
94
+ def test_avi_ratio
95
+ @cap.avi_ratio = 0.1
96
+ assert(@cap.avi_ratio.is_a? Numeric)
97
+ # assert_equal(0.1, @cap.avi_ratio)
98
+ @cap.avi_ratio = 0.8
99
+ assert(@cap.avi_ratio.is_a? Numeric)
100
+ # assert_equal(0.8, @cap.avi_ratio)
101
+ end
102
+
103
+ def test_size
104
+ @cap.size = CvSize.new(320, 240)
105
+ assert_equal(CvSize, @cap.size.class)
106
+ # assert_equal(320, @cap.size.width)
107
+ # assert_equal(240, @cap.size.height)
108
+
109
+ @cap.size = CvSize.new(640, 480)
110
+ assert_equal(CvSize, @cap.size.class)
111
+ # assert_equal(640, @cap.size.width)
112
+ # assert_equal(480, @cap.size.height)
113
+ end
114
+
115
+ def test_width
116
+ @cap.width = 320
117
+ assert(@cap.width.is_a? Numeric)
118
+ # assert_equal(320, @cap.width)
119
+ @cap.width = 640
120
+ assert(@cap.width.is_a? Numeric)
121
+ # assert_equal(640, @cap.width)
122
+ end
123
+
124
+ def test_height
125
+ @cap.height = 240
126
+ assert(@cap.height.is_a? Numeric)
127
+ # assert_equal(240, @cap.height)
128
+ @cap.height = 480
129
+ assert(@cap.height.is_a? Numeric)
130
+ # assert_equal(480, @cap.height)
131
+ end
132
+
133
+ def test_fps
134
+ @cap.fps = 15
135
+ assert(@cap.fps.is_a? Numeric)
136
+ # assert_equal(15, @cap.fps)
137
+ @cap.fps = 30
138
+ assert(@cap.fps.is_a? Numeric)
139
+ # assert_equal(30, @cap.fps)
140
+ end
141
+
142
+ def test_fourcc
143
+ assert_equal(String, @cap.fourcc.class)
144
+ end
145
+
146
+ def test_frame_count
147
+ assert(@cap.frame_count.is_a? Numeric)
148
+ end
149
+
150
+ def test_format
151
+ assert(@cap.format.is_a? Numeric)
152
+ end
153
+
154
+ def test_mode
155
+ assert(@cap.mode.is_a? Numeric)
156
+ end
157
+
158
+ def test_brightness
159
+ assert(@cap.brightness.is_a? Numeric)
160
+ end
161
+
162
+ def test_contrast
163
+ assert(@cap.contrast.is_a? Numeric)
164
+ end
165
+
166
+ def test_saturation
167
+ assert(@cap.saturation.is_a? Numeric)
168
+ end
169
+
170
+ def test_hue
171
+ assert(@cap.hue.is_a? Numeric)
172
+ end
173
+
174
+ def test_gain
175
+ assert(@cap.gain.is_a? Numeric)
176
+ end
177
+
178
+ def test_exposure
179
+ assert(@cap.exposure.is_a? Numeric)
180
+ end
181
+
182
+ def test_convert_rgb
183
+ assert((@cap.convert_rgb == true) ||
184
+ (@cap.convert_rgb == false))
185
+ end
186
+
187
+ def test_rectification
188
+ assert(@cap.rectification.is_a? Numeric)
189
+ end
190
+ end
191
+