ruby-opencv 0.0.9-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/DEVELOPERS_NOTE.md +137 -0
  4. data/Gemfile +8 -0
  5. data/History.txt +5 -0
  6. data/License.txt +30 -0
  7. data/Manifest.txt +227 -0
  8. data/README.md +98 -0
  9. data/Rakefile +90 -0
  10. data/config.yml +7 -0
  11. data/examples/alpha_blend.rb +21 -0
  12. data/examples/box.png +0 -0
  13. data/examples/box_in_scene.png +0 -0
  14. data/examples/contours/bitmap-contours-with-labels.png +0 -0
  15. data/examples/contours/bitmap-contours.png +0 -0
  16. data/examples/contours/bounding-box-detect-canny.rb +62 -0
  17. data/examples/contours/contour_retrieval_modes.rb +139 -0
  18. data/examples/contours/rotated-boxes.jpg +0 -0
  19. data/examples/convexhull.rb +47 -0
  20. data/examples/face_detect.rb +20 -0
  21. data/examples/find_obj.rb +169 -0
  22. data/examples/houghcircle.rb +22 -0
  23. data/examples/inpaint.png +0 -0
  24. data/examples/inpaint.rb +57 -0
  25. data/examples/lenna-rotated.jpg +0 -0
  26. data/examples/lenna.jpg +0 -0
  27. data/examples/match_kdtree.rb +88 -0
  28. data/examples/matching_to_many_images.rb +16 -0
  29. data/examples/matching_to_many_images/query.png +0 -0
  30. data/examples/matching_to_many_images/train/1.png +0 -0
  31. data/examples/matching_to_many_images/train/2.png +0 -0
  32. data/examples/matching_to_many_images/train/3.png +0 -0
  33. data/examples/matching_to_many_images/train/trainImages.txt +3 -0
  34. data/examples/paint.rb +70 -0
  35. data/examples/snake.rb +43 -0
  36. data/examples/stuff.jpg +0 -0
  37. data/examples/tiffany.jpg +0 -0
  38. data/ext/opencv/curve.cpp +112 -0
  39. data/ext/opencv/curve.h +34 -0
  40. data/ext/opencv/cvavgcomp.cpp +67 -0
  41. data/ext/opencv/cvavgcomp.h +39 -0
  42. data/ext/opencv/cvbox2d.cpp +197 -0
  43. data/ext/opencv/cvbox2d.h +61 -0
  44. data/ext/opencv/cvcapture.cpp +506 -0
  45. data/ext/opencv/cvcapture.h +72 -0
  46. data/ext/opencv/cvchain.cpp +233 -0
  47. data/ext/opencv/cvchain.h +46 -0
  48. data/ext/opencv/cvcircle32f.cpp +116 -0
  49. data/ext/opencv/cvcircle32f.h +52 -0
  50. data/ext/opencv/cvcondensation.cpp +282 -0
  51. data/ext/opencv/cvcondensation.h +49 -0
  52. data/ext/opencv/cvconnectedcomp.cpp +143 -0
  53. data/ext/opencv/cvconnectedcomp.h +49 -0
  54. data/ext/opencv/cvcontour.cpp +296 -0
  55. data/ext/opencv/cvcontour.h +48 -0
  56. data/ext/opencv/cvcontourtree.cpp +91 -0
  57. data/ext/opencv/cvcontourtree.h +41 -0
  58. data/ext/opencv/cvconvexitydefect.cpp +103 -0
  59. data/ext/opencv/cvconvexitydefect.h +42 -0
  60. data/ext/opencv/cverror.cpp +159 -0
  61. data/ext/opencv/cverror.h +28 -0
  62. data/ext/opencv/cvfeaturetree.cpp +125 -0
  63. data/ext/opencv/cvfeaturetree.h +55 -0
  64. data/ext/opencv/cvfont.cpp +208 -0
  65. data/ext/opencv/cvfont.h +64 -0
  66. data/ext/opencv/cvhaarclassifiercascade.cpp +168 -0
  67. data/ext/opencv/cvhaarclassifiercascade.h +39 -0
  68. data/ext/opencv/cvhistogram.cpp +546 -0
  69. data/ext/opencv/cvhistogram.h +73 -0
  70. data/ext/opencv/cvhumoments.cpp +139 -0
  71. data/ext/opencv/cvhumoments.h +51 -0
  72. data/ext/opencv/cvline.cpp +154 -0
  73. data/ext/opencv/cvline.h +54 -0
  74. data/ext/opencv/cvmat.cpp +5848 -0
  75. data/ext/opencv/cvmat.h +284 -0
  76. data/ext/opencv/cvmatnd.cpp +44 -0
  77. data/ext/opencv/cvmatnd.h +28 -0
  78. data/ext/opencv/cvmemstorage.cpp +68 -0
  79. data/ext/opencv/cvmemstorage.h +53 -0
  80. data/ext/opencv/cvmoments.cpp +287 -0
  81. data/ext/opencv/cvmoments.h +75 -0
  82. data/ext/opencv/cvpoint.cpp +228 -0
  83. data/ext/opencv/cvpoint.h +64 -0
  84. data/ext/opencv/cvpoint2d32f.cpp +211 -0
  85. data/ext/opencv/cvpoint2d32f.h +63 -0
  86. data/ext/opencv/cvpoint3d32f.cpp +245 -0
  87. data/ext/opencv/cvpoint3d32f.h +66 -0
  88. data/ext/opencv/cvrect.cpp +333 -0
  89. data/ext/opencv/cvrect.h +79 -0
  90. data/ext/opencv/cvscalar.cpp +236 -0
  91. data/ext/opencv/cvscalar.h +71 -0
  92. data/ext/opencv/cvseq.cpp +599 -0
  93. data/ext/opencv/cvseq.h +74 -0
  94. data/ext/opencv/cvsize.cpp +221 -0
  95. data/ext/opencv/cvsize.h +65 -0
  96. data/ext/opencv/cvsize2d32f.cpp +209 -0
  97. data/ext/opencv/cvsize2d32f.h +64 -0
  98. data/ext/opencv/cvslice.cpp +120 -0
  99. data/ext/opencv/cvslice.h +61 -0
  100. data/ext/opencv/cvsparsemat.cpp +44 -0
  101. data/ext/opencv/cvsparsemat.h +28 -0
  102. data/ext/opencv/cvsurfparams.cpp +199 -0
  103. data/ext/opencv/cvsurfparams.h +58 -0
  104. data/ext/opencv/cvsurfpoint.cpp +223 -0
  105. data/ext/opencv/cvsurfpoint.h +52 -0
  106. data/ext/opencv/cvtermcriteria.cpp +192 -0
  107. data/ext/opencv/cvtermcriteria.h +71 -0
  108. data/ext/opencv/cvtwopoints.cpp +116 -0
  109. data/ext/opencv/cvtwopoints.h +51 -0
  110. data/ext/opencv/cvutils.cpp +192 -0
  111. data/ext/opencv/cvutils.h +30 -0
  112. data/ext/opencv/cvvideowriter.cpp +137 -0
  113. data/ext/opencv/cvvideowriter.h +43 -0
  114. data/ext/opencv/extconf.rb +83 -0
  115. data/ext/opencv/gui.cpp +68 -0
  116. data/ext/opencv/gui.h +30 -0
  117. data/ext/opencv/iplconvkernel.cpp +192 -0
  118. data/ext/opencv/iplconvkernel.h +71 -0
  119. data/ext/opencv/iplimage.cpp +644 -0
  120. data/ext/opencv/iplimage.h +73 -0
  121. data/ext/opencv/mouseevent.cpp +181 -0
  122. data/ext/opencv/mouseevent.h +56 -0
  123. data/ext/opencv/opencv.cpp +722 -0
  124. data/ext/opencv/opencv.h +400 -0
  125. data/ext/opencv/pointset.cpp +274 -0
  126. data/ext/opencv/pointset.h +68 -0
  127. data/ext/opencv/trackbar.cpp +121 -0
  128. data/ext/opencv/trackbar.h +69 -0
  129. data/ext/opencv/window.cpp +357 -0
  130. data/ext/opencv/window.h +66 -0
  131. data/images/CvMat_sobel.png +0 -0
  132. data/images/CvMat_sub_rect.png +0 -0
  133. data/images/CvSeq_relationmap.png +0 -0
  134. data/images/face_detect_from_lena.jpg +0 -0
  135. data/lib/opencv.rb +12 -0
  136. data/lib/opencv/psyched_yaml.rb +22 -0
  137. data/lib/opencv/version.rb +3 -0
  138. data/ruby-opencv.gemspec +44 -0
  139. data/test/helper.rb +166 -0
  140. data/test/runner.rb +30 -0
  141. data/test/samples/airplane.jpg +0 -0
  142. data/test/samples/baboon.jpg +0 -0
  143. data/test/samples/baboon200.jpg +0 -0
  144. data/test/samples/baboon200_rotated.jpg +0 -0
  145. data/test/samples/blank0.jpg +0 -0
  146. data/test/samples/blank1.jpg +0 -0
  147. data/test/samples/blank2.jpg +0 -0
  148. data/test/samples/blank3.jpg +0 -0
  149. data/test/samples/blank4.jpg +0 -0
  150. data/test/samples/blank5.jpg +0 -0
  151. data/test/samples/blank6.jpg +0 -0
  152. data/test/samples/blank7.jpg +0 -0
  153. data/test/samples/blank8.jpg +0 -0
  154. data/test/samples/blank9.jpg +0 -0
  155. data/test/samples/cat.jpg +0 -0
  156. data/test/samples/chessboard.jpg +0 -0
  157. data/test/samples/contours.jpg +0 -0
  158. data/test/samples/fruits.jpg +0 -0
  159. data/test/samples/haarcascade_frontalface_alt.xml.gz +0 -0
  160. data/test/samples/inpaint-mask.bmp +0 -0
  161. data/test/samples/lena-256x256.jpg +0 -0
  162. data/test/samples/lena-32x32.jpg +0 -0
  163. data/test/samples/lena-eyes.jpg +0 -0
  164. data/test/samples/lena-inpaint.jpg +0 -0
  165. data/test/samples/lena.jpg +0 -0
  166. data/test/samples/lines.jpg +0 -0
  167. data/test/samples/messy0.jpg +0 -0
  168. data/test/samples/messy1.jpg +0 -0
  169. data/test/samples/movie_sample.avi +0 -0
  170. data/test/samples/one_way_train_0000.jpg +0 -0
  171. data/test/samples/one_way_train_0001.jpg +0 -0
  172. data/test/samples/partially_blank0.jpg +0 -0
  173. data/test/samples/partially_blank1.jpg +0 -0
  174. data/test/samples/smooth0.jpg +0 -0
  175. data/test/samples/smooth1.jpg +0 -0
  176. data/test/samples/smooth2.jpg +0 -0
  177. data/test/samples/smooth3.jpg +0 -0
  178. data/test/samples/smooth4.jpg +0 -0
  179. data/test/samples/smooth5.jpg +0 -0
  180. data/test/samples/smooth6.jpg +0 -0
  181. data/test/samples/str-cv-rotated.jpg +0 -0
  182. data/test/samples/str-cv.jpg +0 -0
  183. data/test/samples/str-ov.jpg +0 -0
  184. data/test/samples/stuff.jpg +0 -0
  185. data/test/test_curve.rb +43 -0
  186. data/test/test_cvavgcomp.rb +24 -0
  187. data/test/test_cvbox2d.rb +76 -0
  188. data/test/test_cvcapture.rb +183 -0
  189. data/test/test_cvchain.rb +108 -0
  190. data/test/test_cvcircle32f.rb +41 -0
  191. data/test/test_cvconnectedcomp.rb +61 -0
  192. data/test/test_cvcontour.rb +150 -0
  193. data/test/test_cvcontourtree.rb +43 -0
  194. data/test/test_cverror.rb +50 -0
  195. data/test/test_cvfeaturetree.rb +65 -0
  196. data/test/test_cvfont.rb +58 -0
  197. data/test/test_cvhaarclassifiercascade.rb +63 -0
  198. data/test/test_cvhistogram.rb +271 -0
  199. data/test/test_cvhumoments.rb +83 -0
  200. data/test/test_cvline.rb +50 -0
  201. data/test/test_cvmat.rb +2947 -0
  202. data/test/test_cvmat_drawing.rb +349 -0
  203. data/test/test_cvmat_dxt.rb +150 -0
  204. data/test/test_cvmat_imageprocessing.rb +2025 -0
  205. data/test/test_cvmat_matching.rb +57 -0
  206. data/test/test_cvmoments.rb +180 -0
  207. data/test/test_cvpoint.rb +75 -0
  208. data/test/test_cvpoint2d32f.rb +75 -0
  209. data/test/test_cvpoint3d32f.rb +93 -0
  210. data/test/test_cvrect.rb +144 -0
  211. data/test/test_cvscalar.rb +113 -0
  212. data/test/test_cvseq.rb +295 -0
  213. data/test/test_cvsize.rb +75 -0
  214. data/test/test_cvsize2d32f.rb +75 -0
  215. data/test/test_cvslice.rb +31 -0
  216. data/test/test_cvsurfparams.rb +57 -0
  217. data/test/test_cvsurfpoint.rb +66 -0
  218. data/test/test_cvtermcriteria.rb +56 -0
  219. data/test/test_cvtwopoints.rb +40 -0
  220. data/test/test_cvvideowriter.rb +58 -0
  221. data/test/test_iplconvkernel.rb +54 -0
  222. data/test/test_iplimage.rb +236 -0
  223. data/test/test_mouseevent.rb +17 -0
  224. data/test/test_opencv.rb +324 -0
  225. data/test/test_pointset.rb +126 -0
  226. data/test/test_preliminary.rb +130 -0
  227. data/test/test_trackbar.rb +47 -0
  228. data/test/test_window.rb +115 -0
  229. metadata +386 -0
@@ -0,0 +1,66 @@
1
+ /************************************************************
2
+
3
+ window.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2006 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_GUI_H
11
+ #include "gui.h"
12
+ #endif
13
+
14
+ #ifndef RUBY_OPENCV_GUI_WINDOW_H
15
+ #define RUBY_OPENCV_GUI_WINDOW_H
16
+
17
+ #include "opencv.h"
18
+ #define __NAMESPACE_BEGIN_WINDOW namespace cWindow {
19
+ #define __NAMESPACE_END_WINDOW }
20
+
21
+ __NAMESPACE_BEGIN_OPENCV
22
+ __NAMESPACE_BEGIN_GUI
23
+
24
+ typedef struct Window {
25
+ VALUE name;
26
+ VALUE image;
27
+ VALUE trackbars;
28
+ VALUE blocks;
29
+ } Window;
30
+
31
+ __NAMESPACE_BEGIN_WINDOW
32
+
33
+ void define_ruby_class();
34
+
35
+ VALUE rb_allocate(VALUE klass);
36
+
37
+ void window_mark(void *ptr);
38
+ void window_free(void *ptr);
39
+ VALUE rb_alive_q(VALUE self);
40
+ VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
41
+ VALUE rb_destroy(VALUE self);
42
+ VALUE rb_destroy_all(VALUE klass);
43
+ VALUE rb_resize(int argc, VALUE *argv, VALUE self);
44
+ VALUE rb_move(int argc, VALUE *argv, VALUE self);
45
+ VALUE rb_show_image(VALUE self, VALUE img);
46
+ VALUE rb_set_trackbar(int argc, VALUE *argv, VALUE self);
47
+ VALUE rb_set_mouse_callback(int argc, VALUE* argv, VALUE self);
48
+
49
+ inline Window*
50
+ WINDOW(VALUE object) {
51
+ Window *ptr;
52
+ Data_Get_Struct(object, Window, ptr);
53
+ return ptr;
54
+ }
55
+
56
+ inline const char*
57
+ GET_WINDOW_NAME(VALUE object) {
58
+ return StringValueCStr(WINDOW(object)->name);
59
+ }
60
+
61
+ __NAMESPACE_END_WINDOW
62
+ __NAMESPACE_END_GUI
63
+ __NAMESPACE_END_OPENCV
64
+
65
+ #endif // RUBY_OPENCV_GUI_WINDOW_H
66
+
Binary file
Binary file
Binary file
Binary file
data/lib/opencv.rb ADDED
@@ -0,0 +1,12 @@
1
+ require (File.dirname(__FILE__) + '/opencv/version')
2
+
3
+ if RUBY_PLATFORM =~ /mingw|mswin/
4
+ major, minor, subminor = RUBY_VERSION.split('.')
5
+ begin
6
+ require "#{major}.#{minor}/opencv.so"
7
+ rescue LoadError
8
+ require 'opencv.so'
9
+ end
10
+ else
11
+ require 'opencv.so'
12
+ end
@@ -0,0 +1,22 @@
1
+ # -*- mode: ruby; coding: utf-8 -*-
2
+ # Psych loader for avoiding loading problem
3
+ # (borrowed from Bundler 1.1.rc.7 https://github.com/carlhuda/bundler/blob/v1.1.rc.7/lib/bundler/psyched_yaml.rb )
4
+ #
5
+ # See: https://github.com/ruby-opencv/ruby-opencv/pull/6
6
+
7
+ # Psych could be a gem
8
+ begin
9
+ gem 'psych'
10
+ rescue Gem::LoadError
11
+ end if defined?(Gem)
12
+
13
+ # Psych could be a stdlib
14
+ begin
15
+ # it's too late if Syck is already loaded
16
+ require 'psych' unless defined?(Syck)
17
+ rescue LoadError
18
+ end
19
+
20
+ # Psych might NOT EXIST AT ALL
21
+ require 'yaml'
22
+
@@ -0,0 +1,3 @@
1
+ module OpenCV
2
+ VERSION = '0.0.9'
3
+ end
@@ -0,0 +1,44 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "ruby-opencv"
5
+ s.version = "0.0.9.20130505072136"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["lsxi", "ser1zw", "pcting"]
9
+ s.date = "2013-05-04"
10
+ s.description = "ruby-opencv is a wrapper of OpenCV for Ruby. It helps you to write computer vision programs (e.g. detecting faces from pictures) with Ruby."
11
+ s.email = ["masakazu.yonekura@gmail.com", "azariahsawtikes@gmail.com", "pcting@gmail.com"]
12
+ s.extensions = ["ext/opencv/extconf.rb"]
13
+ s.extra_rdoc_files = ["DEVELOPERS_NOTE.md", "History.txt", "License.txt", "Manifest.txt", "README.md", "examples/matching_to_many_images/train/trainImages.txt"]
14
+ s.files = [".gitignore", "DEVELOPERS_NOTE.md", "Gemfile", "History.txt", "License.txt", "Manifest.txt", "README.md", "Rakefile", "config.yml", "examples/alpha_blend.rb", "examples/box.png", "examples/box_in_scene.png", "examples/contours/bitmap-contours-with-labels.png", "examples/contours/bitmap-contours.png", "examples/contours/bounding-box-detect-canny.rb", "examples/contours/contour_retrieval_modes.rb", "examples/contours/rotated-boxes.jpg", "examples/convexhull.rb", "examples/face_detect.rb", "examples/find_obj.rb", "examples/houghcircle.rb", "examples/inpaint.png", "examples/inpaint.rb", "examples/lenna-rotated.jpg", "examples/lenna.jpg", "examples/match_kdtree.rb", "examples/matching_to_many_images.rb", "examples/matching_to_many_images/query.png", "examples/matching_to_many_images/train/1.png", "examples/matching_to_many_images/train/2.png", "examples/matching_to_many_images/train/3.png", "examples/matching_to_many_images/train/trainImages.txt", "examples/paint.rb", "examples/snake.rb", "examples/stuff.jpg", "examples/tiffany.jpg", "ext/opencv/curve.cpp", "ext/opencv/curve.h", "ext/opencv/cvavgcomp.cpp", "ext/opencv/cvavgcomp.h", "ext/opencv/cvbox2d.cpp", "ext/opencv/cvbox2d.h", "ext/opencv/cvcapture.cpp", "ext/opencv/cvcapture.h", "ext/opencv/cvchain.cpp", "ext/opencv/cvchain.h", "ext/opencv/cvcircle32f.cpp", "ext/opencv/cvcircle32f.h", "ext/opencv/cvcondensation.cpp", "ext/opencv/cvcondensation.h", "ext/opencv/cvconnectedcomp.cpp", "ext/opencv/cvconnectedcomp.h", "ext/opencv/cvcontour.cpp", "ext/opencv/cvcontour.h", "ext/opencv/cvcontourtree.cpp", "ext/opencv/cvcontourtree.h", "ext/opencv/cvconvexitydefect.cpp", "ext/opencv/cvconvexitydefect.h", "ext/opencv/cverror.cpp", "ext/opencv/cverror.h", "ext/opencv/cvfeaturetree.cpp", "ext/opencv/cvfeaturetree.h", "ext/opencv/cvfont.cpp", "ext/opencv/cvfont.h", "ext/opencv/cvhaarclassifiercascade.cpp", "ext/opencv/cvhaarclassifiercascade.h", "ext/opencv/cvhistogram.cpp", "ext/opencv/cvhistogram.h", "ext/opencv/cvhumoments.cpp", "ext/opencv/cvhumoments.h", "ext/opencv/cvline.cpp", "ext/opencv/cvline.h", "ext/opencv/cvmat.cpp", "ext/opencv/cvmat.h", "ext/opencv/cvmatnd.cpp", "ext/opencv/cvmatnd.h", "ext/opencv/cvmemstorage.cpp", "ext/opencv/cvmemstorage.h", "ext/opencv/cvmoments.cpp", "ext/opencv/cvmoments.h", "ext/opencv/cvpoint.cpp", "ext/opencv/cvpoint.h", "ext/opencv/cvpoint2d32f.cpp", "ext/opencv/cvpoint2d32f.h", "ext/opencv/cvpoint3d32f.cpp", "ext/opencv/cvpoint3d32f.h", "ext/opencv/cvrect.cpp", "ext/opencv/cvrect.h", "ext/opencv/cvscalar.cpp", "ext/opencv/cvscalar.h", "ext/opencv/cvseq.cpp", "ext/opencv/cvseq.h", "ext/opencv/cvsize.cpp", "ext/opencv/cvsize.h", "ext/opencv/cvsize2d32f.cpp", "ext/opencv/cvsize2d32f.h", "ext/opencv/cvslice.cpp", "ext/opencv/cvslice.h", "ext/opencv/cvsparsemat.cpp", "ext/opencv/cvsparsemat.h", "ext/opencv/cvsurfparams.cpp", "ext/opencv/cvsurfparams.h", "ext/opencv/cvsurfpoint.cpp", "ext/opencv/cvsurfpoint.h", "ext/opencv/cvtermcriteria.cpp", "ext/opencv/cvtermcriteria.h", "ext/opencv/cvtwopoints.cpp", "ext/opencv/cvtwopoints.h", "ext/opencv/cvutils.cpp", "ext/opencv/cvutils.h", "ext/opencv/cvvideowriter.cpp", "ext/opencv/cvvideowriter.h", "ext/opencv/extconf.rb", "ext/opencv/gui.cpp", "ext/opencv/gui.h", "ext/opencv/iplconvkernel.cpp", "ext/opencv/iplconvkernel.h", "ext/opencv/iplimage.cpp", "ext/opencv/iplimage.h", "ext/opencv/mouseevent.cpp", "ext/opencv/mouseevent.h", "ext/opencv/opencv.cpp", "ext/opencv/opencv.h", "ext/opencv/pointset.cpp", "ext/opencv/pointset.h", "ext/opencv/trackbar.cpp", "ext/opencv/trackbar.h", "ext/opencv/window.cpp", "ext/opencv/window.h", "images/CvMat_sobel.png", "images/CvMat_sub_rect.png", "images/CvSeq_relationmap.png", "images/face_detect_from_lena.jpg", "lib/opencv.rb", "lib/opencv/psyched_yaml.rb", "lib/opencv/version.rb", "ruby-opencv.gemspec", "test/helper.rb", "test/runner.rb", "test/samples/airplane.jpg", "test/samples/baboon.jpg", "test/samples/baboon200.jpg", "test/samples/baboon200_rotated.jpg", "test/samples/blank0.jpg", "test/samples/blank1.jpg", "test/samples/blank2.jpg", "test/samples/blank3.jpg", "test/samples/blank4.jpg", "test/samples/blank5.jpg", "test/samples/blank6.jpg", "test/samples/blank7.jpg", "test/samples/blank8.jpg", "test/samples/blank9.jpg", "test/samples/cat.jpg", "test/samples/chessboard.jpg", "test/samples/contours.jpg", "test/samples/fruits.jpg", "test/samples/haarcascade_frontalface_alt.xml.gz", "test/samples/inpaint-mask.bmp", "test/samples/lena-256x256.jpg", "test/samples/lena-32x32.jpg", "test/samples/lena-eyes.jpg", "test/samples/lena-inpaint.jpg", "test/samples/lena.jpg", "test/samples/lines.jpg", "test/samples/messy0.jpg", "test/samples/messy1.jpg", "test/samples/movie_sample.avi", "test/samples/one_way_train_0000.jpg", "test/samples/one_way_train_0001.jpg", "test/samples/partially_blank0.jpg", "test/samples/partially_blank1.jpg", "test/samples/smooth0.jpg", "test/samples/smooth1.jpg", "test/samples/smooth2.jpg", "test/samples/smooth3.jpg", "test/samples/smooth4.jpg", "test/samples/smooth5.jpg", "test/samples/smooth6.jpg", "test/samples/str-cv-rotated.jpg", "test/samples/str-cv.jpg", "test/samples/str-ov.jpg", "test/samples/stuff.jpg", "test/test_curve.rb", "test/test_cvavgcomp.rb", "test/test_cvbox2d.rb", "test/test_cvcapture.rb", "test/test_cvchain.rb", "test/test_cvcircle32f.rb", "test/test_cvconnectedcomp.rb", "test/test_cvcontour.rb", "test/test_cvcontourtree.rb", "test/test_cverror.rb", "test/test_cvfeaturetree.rb", "test/test_cvfont.rb", "test/test_cvhaarclassifiercascade.rb", "test/test_cvhistogram.rb", "test/test_cvhumoments.rb", "test/test_cvline.rb", "test/test_cvmat.rb", "test/test_cvmat_drawing.rb", "test/test_cvmat_dxt.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvmat_matching.rb", "test/test_cvmoments.rb", "test/test_cvpoint.rb", "test/test_cvpoint2d32f.rb", "test/test_cvpoint3d32f.rb", "test/test_cvrect.rb", "test/test_cvscalar.rb", "test/test_cvseq.rb", "test/test_cvsize.rb", "test/test_cvsize2d32f.rb", "test/test_cvslice.rb", "test/test_cvsurfparams.rb", "test/test_cvsurfpoint.rb", "test/test_cvtermcriteria.rb", "test/test_cvtwopoints.rb", "test/test_cvvideowriter.rb", "test/test_iplconvkernel.rb", "test/test_iplimage.rb", "test/test_mouseevent.rb", "test/test_opencv.rb", "test/test_pointset.rb", "test/test_preliminary.rb", "test/test_trackbar.rb", "test/test_window.rb"]
15
+ s.homepage = "https://github.com/ruby-opencv/ruby-opencv/"
16
+ s.licenses = ["The BSD License"]
17
+ s.rdoc_options = ["--main", "README.md"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = "ruby-opencv"
20
+ s.rubygems_version = "2.0.3"
21
+ s.summary = "OpenCV wrapper for Ruby"
22
+ s.test_files = ["test/test_cvhistogram.rb", "test/test_cvconnectedcomp.rb", "test/test_mouseevent.rb", "test/test_opencv.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvmat.rb", "test/test_cvfeaturetree.rb", "test/test_iplconvkernel.rb", "test/test_cvchain.rb", "test/test_cvmat_drawing.rb", "test/test_cvpoint.rb", "test/test_trackbar.rb", "test/test_cvsize2d32f.rb", "test/test_cvsurfparams.rb", "test/test_cvscalar.rb", "test/test_cverror.rb", "test/test_cvhumoments.rb", "test/test_iplimage.rb", "test/test_cvslice.rb", "test/test_cvtwopoints.rb", "test/test_cvfont.rb", "test/test_cvseq.rb", "test/test_cvcontour.rb", "test/test_curve.rb", "test/test_cvsize.rb", "test/test_window.rb", "test/test_cvbox2d.rb", "test/test_cvpoint2d32f.rb", "test/test_cvcapture.rb", "test/test_pointset.rb", "test/test_cvcontourtree.rb", "test/test_cvavgcomp.rb", "test/test_cvsurfpoint.rb", "test/test_cvrect.rb", "test/test_cvline.rb", "test/test_cvvideowriter.rb", "test/test_cvpoint3d32f.rb", "test/test_cvmat_matching.rb", "test/test_cvcircle32f.rb", "test/test_preliminary.rb", "test/test_cvmat_dxt.rb", "test/test_cvmoments.rb", "test/test_cvtermcriteria.rb", "test/test_cvhaarclassifiercascade.rb"]
23
+
24
+ if s.respond_to? :specification_version then
25
+ s.specification_version = 4
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
29
+ s.add_development_dependency(%q<rake-compiler>, [">= 0"])
30
+ s.add_development_dependency(%q<hoe-gemspec>, [">= 0"])
31
+ s.add_development_dependency(%q<hoe>, ["~> 3.6"])
32
+ else
33
+ s.add_dependency(%q<rdoc>, ["~> 4.0"])
34
+ s.add_dependency(%q<rake-compiler>, [">= 0"])
35
+ s.add_dependency(%q<hoe-gemspec>, [">= 0"])
36
+ s.add_dependency(%q<hoe>, ["~> 3.6"])
37
+ end
38
+ else
39
+ s.add_dependency(%q<rdoc>, ["~> 4.0"])
40
+ s.add_dependency(%q<rake-compiler>, [">= 0"])
41
+ s.add_dependency(%q<hoe-gemspec>, [">= 0"])
42
+ s.add_dependency(%q<hoe>, ["~> 3.6"])
43
+ end
44
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; coding: utf-8 -*-
3
+ require 'test/unit'
4
+ require 'digest/md5'
5
+ require 'opencv'
6
+ include OpenCV
7
+
8
+ class OpenCVTestCase < Test::Unit::TestCase
9
+ SAMPLE_DIR = File.expand_path(File.dirname(__FILE__)) + '/samples/'
10
+ FILENAME_CAT = SAMPLE_DIR + 'cat.jpg'
11
+ FILENAME_LENA256x256 = SAMPLE_DIR + 'lena-256x256.jpg'
12
+ FILENAME_LENA32x32 = SAMPLE_DIR + 'lena-32x32.jpg'
13
+ FILENAME_LENA_EYES = File.expand_path(File.dirname(__FILE__)) + '/samples/lena-eyes.jpg'
14
+ FILENAME_FRUITS = SAMPLE_DIR + 'fruits.jpg'
15
+ FILENAME_CONTOURS = File.expand_path(File.dirname(__FILE__)) + '/samples/contours.jpg'
16
+ FILENAME_CHESSBOARD = SAMPLE_DIR + 'chessboard.jpg'
17
+ HAARCASCADE_FRONTALFACE_ALT = SAMPLE_DIR + 'haarcascade_frontalface_alt.xml.gz'
18
+ AVI_SAMPLE = SAMPLE_DIR + 'movie_sample.avi'
19
+
20
+ DUMMY_OBJ = Digest::MD5.new # dummy object for argument type check test
21
+
22
+ def snap(*images)
23
+ n = -1
24
+ images.map! { |val|
25
+ n += 1
26
+ if val.is_a? Hash
27
+ val
28
+ elsif val.is_a? Array
29
+ {:title => val[0], :image => val[1] }
30
+ else
31
+ {:title => "snap-#{n}", :image => val }
32
+ end
33
+ }
34
+
35
+ pos = CvPoint.new(0, 0)
36
+ images.each { |img|
37
+ w = GUI::Window.new(img[:title])
38
+ w.show(img[:image])
39
+ w.move(pos)
40
+ pos.x += img[:image].width
41
+ if pos.x > 800
42
+ pos.y += img[:image].height
43
+ pos.x = 0
44
+ end
45
+ }
46
+
47
+ GUI::wait_key
48
+ GUI::Window::destroy_all
49
+ end
50
+
51
+ def hash_img(img)
52
+ # Compute a hash for an image, useful for image comparisons
53
+ Digest::MD5.hexdigest(img.data)
54
+ end
55
+
56
+ unless Test::Unit::TestCase.instance_methods.map {|m| m.to_sym }.include? :assert_false
57
+ def assert_false(actual, message = nil)
58
+ assert_equal(false, actual, message)
59
+ end
60
+ end
61
+
62
+ alias original_assert_in_delta assert_in_delta
63
+
64
+ def assert_cvscalar_equal(expected, actual, message = nil)
65
+ assert_equal(CvScalar, actual.class, message)
66
+ assert_array_equal(expected.to_ary, actual.to_ary, message)
67
+ end
68
+
69
+ def assert_array_equal(expected, actual, message = nil)
70
+ assert_equal(expected.size, actual.size, message)
71
+ expected.zip(actual) { |e, a|
72
+ assert_equal(e, a, message)
73
+ }
74
+ end
75
+
76
+ def assert_in_delta(expected, actual, delta)
77
+ if expected.is_a? CvScalar or actual.is_a? CvScalar
78
+ expected = expected.to_ary if expected.is_a? CvScalar
79
+ actual = actual.to_ary if actual.is_a? CvScalar
80
+ assert_in_delta(expected, actual ,delta)
81
+ elsif expected.is_a? Array and actual.is_a? Array
82
+ assert_equal(expected.size, actual.size)
83
+ expected.zip(actual) { |e, a|
84
+ original_assert_in_delta(e, a, delta)
85
+ }
86
+ else
87
+ original_assert_in_delta(expected, actual, delta)
88
+ end
89
+ end
90
+
91
+ def create_cvmat(height, width, depth = :cv8u, channel = 4, &block)
92
+ m = CvMat.new(height, width, depth, channel)
93
+ block = lambda { |j, i, c| CvScalar.new(*([c + 1] * channel)) } unless block_given?
94
+ count = 0
95
+ height.times { |j|
96
+ width.times { |i|
97
+ m[j, i] = block.call(j, i, count)
98
+ count += 1
99
+ }
100
+ }
101
+ m
102
+ end
103
+
104
+ def create_iplimage(width, height, depth = :cv8u, channel = 4, &block)
105
+ m = IplImage.new(width, height, depth, channel)
106
+ block = lambda { |j, i, c| CvScalar.new(*([c + 1] * channel)) } unless block_given?
107
+ count = 0
108
+ height.times { |j|
109
+ width.times { |i|
110
+ m[j, i] = block.call(j, i, count)
111
+ count += 1
112
+ }
113
+ }
114
+ m
115
+ end
116
+
117
+ def assert_each_cvscalar(actual, delta = 0, &block)
118
+ raise unless block_given?
119
+ count = 0
120
+ actual.height.times { |j|
121
+ actual.width.times { |i|
122
+ expected = block.call(j, i, count)
123
+ if delta == 0
124
+ expected = expected.to_ary if expected.is_a? CvScalar
125
+ assert_array_equal(expected, actual[j, i].to_ary)
126
+ else
127
+ assert_in_delta(expected, actual[j, i], delta)
128
+ end
129
+ count += 1
130
+ }
131
+ }
132
+ end
133
+
134
+ def print_cvmat(mat)
135
+ s = []
136
+ mat.height.times { |j|
137
+ a = []
138
+ mat.width.times { |i|
139
+ tmp = mat[j, i].to_ary.map {|m| m.to_f.round(2) }.join(',')
140
+ a << "[#{tmp}]"
141
+ }
142
+ s << a.join(' ')
143
+ }
144
+ puts s.join("\n")
145
+ end
146
+
147
+ def count_threshold(mat, threshold, &block)
148
+ n = 0
149
+ block = lambda { |a, b| a > b } unless block_given?
150
+ (mat.rows * mat.cols).times { |i|
151
+ n += 1 if block.call(mat[i][0], threshold)
152
+ }
153
+ n
154
+ end
155
+
156
+ def color_hists(mat)
157
+ hists = [0] * mat.channel
158
+ (mat.rows * mat.cols).times { |i|
159
+ hists.size.times { |c|
160
+ hists[c] += mat[i][c]
161
+ }
162
+ }
163
+ hists
164
+ end
165
+ end
166
+
data/test/runner.rb ADDED
@@ -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
Binary file
Binary file
Binary file
Binary file
Binary file