bonanza-ruby-opencv 0.0.13.20140330211753

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) 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 +98 -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 +607 -0
  50. data/ext/opencv/cvcapture.h +72 -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 +332 -0
  58. data/ext/opencv/cvcontour.h +48 -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 +715 -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 +6829 -0
  78. data/ext/opencv/cvmat.h +323 -0
  79. data/ext/opencv/cvmemstorage.cpp +73 -0
  80. data/ext/opencv/cvmemstorage.h +53 -0
  81. data/ext/opencv/cvmoments.cpp +293 -0
  82. data/ext/opencv/cvmoments.h +75 -0
  83. data/ext/opencv/cvpoint.cpp +265 -0
  84. data/ext/opencv/cvpoint.h +67 -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 +441 -0
  90. data/ext/opencv/cvrect.h +88 -0
  91. data/ext/opencv/cvscalar.cpp +301 -0
  92. data/ext/opencv/cvscalar.h +76 -0
  93. data/ext/opencv/cvseq.cpp +605 -0
  94. data/ext/opencv/cvseq.h +74 -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 +279 -0
  104. data/ext/opencv/cvsurfpoint.h +54 -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 +221 -0
  110. data/ext/opencv/cvutils.h +31 -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 +82 -0
  116. data/ext/opencv/facerecognizer.cpp +181 -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 +666 -0
  125. data/ext/opencv/iplimage.h +75 -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 +833 -0
  131. data/ext/opencv/opencv.h +405 -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 +4 -0
  144. data/test/eigenfaces_save.xml +7524 -0
  145. data/test/fisherfaces_save.xml +7530 -0
  146. data/test/helper.rb +166 -0
  147. data/test/lbph_save.xml +4304 -0
  148. data/test/runner.rb +30 -0
  149. data/test/samples/airplane.jpg +0 -0
  150. data/test/samples/baboon.jpg +0 -0
  151. data/test/samples/baboon200.jpg +0 -0
  152. data/test/samples/baboon200_rotated.jpg +0 -0
  153. data/test/samples/blank0.jpg +0 -0
  154. data/test/samples/blank1.jpg +0 -0
  155. data/test/samples/blank2.jpg +0 -0
  156. data/test/samples/blank3.jpg +0 -0
  157. data/test/samples/blank4.jpg +0 -0
  158. data/test/samples/blank5.jpg +0 -0
  159. data/test/samples/blank6.jpg +0 -0
  160. data/test/samples/blank7.jpg +0 -0
  161. data/test/samples/blank8.jpg +0 -0
  162. data/test/samples/blank9.jpg +0 -0
  163. data/test/samples/cat.jpg +0 -0
  164. data/test/samples/chessboard.jpg +0 -0
  165. data/test/samples/contours.jpg +0 -0
  166. data/test/samples/fruits.jpg +0 -0
  167. data/test/samples/haarcascade_frontalface_alt.xml.gz +0 -0
  168. data/test/samples/inpaint-mask.bmp +0 -0
  169. data/test/samples/lena-256x256.jpg +0 -0
  170. data/test/samples/lena-32x32.jpg +0 -0
  171. data/test/samples/lena-eyes.jpg +0 -0
  172. data/test/samples/lena-inpaint.jpg +0 -0
  173. data/test/samples/lena.jpg +0 -0
  174. data/test/samples/lines.jpg +0 -0
  175. data/test/samples/messy0.jpg +0 -0
  176. data/test/samples/messy1.jpg +0 -0
  177. data/test/samples/movie_sample.avi +0 -0
  178. data/test/samples/one_way_train_0000.jpg +0 -0
  179. data/test/samples/one_way_train_0001.jpg +0 -0
  180. data/test/samples/partially_blank0.jpg +0 -0
  181. data/test/samples/partially_blank1.jpg +0 -0
  182. data/test/samples/smooth0.jpg +0 -0
  183. data/test/samples/smooth1.jpg +0 -0
  184. data/test/samples/smooth2.jpg +0 -0
  185. data/test/samples/smooth3.jpg +0 -0
  186. data/test/samples/smooth4.jpg +0 -0
  187. data/test/samples/smooth5.jpg +0 -0
  188. data/test/samples/smooth6.jpg +0 -0
  189. data/test/samples/str-cv-rotated.jpg +0 -0
  190. data/test/samples/str-cv.jpg +0 -0
  191. data/test/samples/str-ov.jpg +0 -0
  192. data/test/samples/stuff.jpg +0 -0
  193. data/test/test_curve.rb +43 -0
  194. data/test/test_cvavgcomp.rb +24 -0
  195. data/test/test_cvbox2d.rb +76 -0
  196. data/test/test_cvcapture.rb +183 -0
  197. data/test/test_cvchain.rb +108 -0
  198. data/test/test_cvcircle32f.rb +41 -0
  199. data/test/test_cvconnectedcomp.rb +61 -0
  200. data/test/test_cvcontour.rb +150 -0
  201. data/test/test_cvcontourtree.rb +43 -0
  202. data/test/test_cverror.rb +50 -0
  203. data/test/test_cvfeaturetree.rb +65 -0
  204. data/test/test_cvfont.rb +58 -0
  205. data/test/test_cvhaarclassifiercascade.rb +63 -0
  206. data/test/test_cvhistogram.rb +271 -0
  207. data/test/test_cvhumoments.rb +83 -0
  208. data/test/test_cvline.rb +50 -0
  209. data/test/test_cvmat.rb +3003 -0
  210. data/test/test_cvmat_drawing.rb +349 -0
  211. data/test/test_cvmat_dxt.rb +150 -0
  212. data/test/test_cvmat_imageprocessing.rb +2085 -0
  213. data/test/test_cvmoments.rb +180 -0
  214. data/test/test_cvpoint.rb +75 -0
  215. data/test/test_cvpoint2d32f.rb +75 -0
  216. data/test/test_cvpoint3d32f.rb +93 -0
  217. data/test/test_cvrect.rb +144 -0
  218. data/test/test_cvscalar.rb +113 -0
  219. data/test/test_cvseq.rb +295 -0
  220. data/test/test_cvsize.rb +75 -0
  221. data/test/test_cvsize2d32f.rb +75 -0
  222. data/test/test_cvslice.rb +31 -0
  223. data/test/test_cvsurfparams.rb +57 -0
  224. data/test/test_cvsurfpoint.rb +66 -0
  225. data/test/test_cvtermcriteria.rb +56 -0
  226. data/test/test_cvtwopoints.rb +40 -0
  227. data/test/test_cvvideowriter.rb +58 -0
  228. data/test/test_eigenfaces.rb +93 -0
  229. data/test/test_fisherfaces.rb +93 -0
  230. data/test/test_iplconvkernel.rb +54 -0
  231. data/test/test_iplimage.rb +232 -0
  232. data/test/test_lbph.rb +152 -0
  233. data/test/test_mouseevent.rb +17 -0
  234. data/test/test_opencv.rb +360 -0
  235. data/test/test_pointset.rb +128 -0
  236. data/test/test_preliminary.rb +130 -0
  237. data/test/test_trackbar.rb +47 -0
  238. data/test/test_window.rb +115 -0
  239. data/yard_extension.rb +5 -0
  240. metadata +399 -0
@@ -0,0 +1,323 @@
1
+ /************************************************************
2
+
3
+ cvmat.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVMAT_H
11
+ #define RUBY_OPENCV_CVMAT_H
12
+
13
+ #include "opencv.h"
14
+
15
+
16
+ #define __NAMESPACE_BEGIN_CVMAT namespace cCvMat {
17
+ #define __NAMESPACE_END_CVMAT }
18
+
19
+ __NAMESPACE_BEGIN_OPENCV
20
+ __NAMESPACE_BEGIN_CVMAT
21
+
22
+ VALUE rb_class();
23
+
24
+ void init_ruby_class();
25
+
26
+ VALUE rb_allocate(VALUE klass);
27
+ VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
28
+ VALUE rb_load_imageM(int argc, VALUE *argv, VALUE self);
29
+ VALUE rb_encode_imageM(int argc, VALUE *argv, VALUE self);
30
+ VALUE rb_decode_imageM(int argc, VALUE *argv, VALUE self);
31
+
32
+ VALUE rb_method_missing(int argc, VALUE *argv, VALUE self);
33
+ VALUE rb_to_s(VALUE self);
34
+ VALUE rb_inside_q(VALUE self, VALUE object);
35
+ VALUE rb_to_IplConvKernel(VALUE self, VALUE anchor);
36
+ VALUE rb_create_mask(VALUE self);
37
+
38
+ VALUE rb_width(VALUE self);
39
+ VALUE rb_height(VALUE self);
40
+ VALUE rb_depth(VALUE self);
41
+ VALUE rb_channel(VALUE self);
42
+ VALUE rb_data(VALUE self);
43
+
44
+ VALUE rb_rcv_clone(VALUE self);
45
+ VALUE rb_copy(int argc, VALUE *argv, VALUE self);
46
+ VALUE copy(VALUE mat);
47
+
48
+ VALUE rb_to_8u(VALUE self);
49
+ VALUE rb_to_8s(VALUE self);
50
+ VALUE rb_to_16u(VALUE self);
51
+ VALUE rb_to_16s(VALUE self);
52
+ VALUE rb_to_32s(VALUE self);
53
+ VALUE rb_to_32f(VALUE self);
54
+ VALUE rb_to_64f(VALUE self);
55
+ VALUE rb_vector_q(VALUE self);
56
+ VALUE rb_square_q(VALUE self);
57
+ // cxcore function
58
+ VALUE rb_to_CvMat(VALUE self);
59
+ VALUE rb_to_IplImage(VALUE self);
60
+ VALUE rb_sub_rect(VALUE self, VALUE args);
61
+ VALUE rb_get_rows(VALUE self, VALUE args);
62
+ VALUE rb_get_cols(VALUE self, VALUE args);
63
+ VALUE rb_each_row(VALUE self);
64
+ VALUE rb_each_col(VALUE self);
65
+ VALUE rb_diag(int argc, VALUE *argv, VALUE self);
66
+ VALUE rb_size(VALUE self);
67
+ VALUE rb_dims(VALUE self);
68
+ VALUE rb_dim_size(VALUE self, VALUE index);
69
+ VALUE rb_aref(VALUE self, VALUE args);
70
+ VALUE rb_pixel_value(VALUE self, VALUE index);
71
+ VALUE rb_vector_magnitude(VALUE self);
72
+ VALUE rb_aset(VALUE self, VALUE args);
73
+ VALUE rb_set_data(VALUE self, VALUE data);
74
+ VALUE rb_set(int argc, VALUE *argv, VALUE self);
75
+ VALUE rb_set_bang(int argc, VALUE *argv, VALUE self);
76
+ VALUE rb_set_zero(VALUE self);
77
+ VALUE rb_set_zero_bang(VALUE self);
78
+ VALUE rb_set_identity(int argc, VALUE *argv, VALUE self);
79
+ VALUE rb_set_identity_bang(int argc, VALUE *argv, VALUE self);
80
+ VALUE rb_range(VALUE self, VALUE start, VALUE end);
81
+ VALUE rb_range_bang(VALUE self, VALUE start, VALUE end);
82
+ /* Transforms and Permutations */
83
+ VALUE rb_reshape(VALUE self, VALUE hash);
84
+ VALUE rb_repeat(VALUE self, VALUE object);
85
+ VALUE rb_flip(int argc, VALUE *argv, VALUE self);
86
+ VALUE rb_flip_bang(int argc, VALUE *argv, VALUE self);
87
+ VALUE rb_split(VALUE self);
88
+ VALUE rb_merge(VALUE klass, VALUE args);
89
+ VALUE rb_rand_shuffle(int argc, VALUE *argv, VALUE klass);
90
+ VALUE rb_rand_shuffle_bang(int argc, VALUE *argv, VALUE klass);
91
+
92
+ VALUE rb_lut(VALUE self, VALUE lut);
93
+ VALUE rb_convert_scale(VALUE self, VALUE hash);
94
+ VALUE rb_convert_scale_abs(VALUE self, VALUE hash);
95
+ VALUE rb_add(int argc, VALUE *argv, VALUE self);
96
+ VALUE rb_sub(int argc, VALUE *argv, VALUE self);
97
+ VALUE rb_mul(int argc, VALUE *argv, VALUE self);
98
+ VALUE rb_sqrt(VALUE self);
99
+ VALUE rb_sqrt(VALUE self);
100
+ VALUE rb_mat_mul(int argc, VALUE *argv, VALUE self);
101
+ VALUE rb_div(int argc, VALUE *argv, VALUE self);
102
+ VALUE rb_and(int argc, VALUE *argv, VALUE self);
103
+ VALUE rb_or(int argc, VALUE *argv, VALUE self);
104
+ VALUE rb_xor(int argc, VALUE *argv, VALUE self);
105
+ VALUE rb_not(VALUE self);
106
+ VALUE rb_not_bang(VALUE self);
107
+ VALUE rb_cmp_internal(VALUE self, VALUE val, int operand);
108
+ VALUE rb_eq(VALUE self, VALUE val);
109
+ VALUE rb_gt(VALUE self, VALUE val);
110
+ VALUE rb_ge(VALUE self, VALUE val);
111
+ VALUE rb_lt(VALUE self, VALUE val);
112
+ VALUE rb_le(VALUE self, VALUE val);
113
+ VALUE rb_ne(VALUE self, VALUE val);
114
+ VALUE rb_in_range(VALUE self, VALUE min, VALUE max);
115
+ VALUE rb_abs_diff(VALUE self, VALUE val);
116
+ VALUE rb_log(VALUE self);
117
+ VALUE rb_normalize(int argc, VALUE *argv, VALUE self);
118
+ VALUE rb_add_weighted(VALUE klass, VALUE src1, VALUE alpha, VALUE src2, VALUE beta, VALUE gamma);
119
+ VALUE rb_magnitude(VALUE self, VALUE y);
120
+
121
+ /* Statistics */
122
+ VALUE rb_count_non_zero(VALUE self);
123
+ VALUE rb_sum(VALUE self);
124
+ VALUE rb_avg(int argc, VALUE *argv, VALUE self);
125
+ VALUE rb_avg_sdv(int argc, VALUE *argv, VALUE self);
126
+ VALUE rb_sdv(int argc, VALUE *argv, VALUE self);
127
+ VALUE rb_min_max_loc(int argc, VALUE *argv, VALUE self);
128
+ VALUE rb_min(int argc, VALUE *argv, VALUE self);
129
+ VALUE rb_max(int argc, VALUE *argv, VALUE self);
130
+
131
+ /* Hacked */
132
+ //VALUE rb_set_roi(VALUE self, VALUE args);
133
+
134
+ //VALUE rb_norm();
135
+ VALUE rb_dot_product(VALUE self, VALUE mat);
136
+ VALUE rb_cross_product(VALUE self, VALUE mat);
137
+ // VALUE rb_gemm();
138
+ VALUE rb_transform(int argc, VALUE *argv, VALUE self);
139
+ VALUE rb_perspective_transform(VALUE self, VALUE mat);
140
+ VALUE rb_mul_transposed(int argc, VALUE *argv, VALUE self);
141
+ VALUE rb_trace(VALUE self);
142
+ VALUE rb_transpose(VALUE self);
143
+ VALUE rb_det(VALUE self);
144
+ VALUE rb_invert(int argc, VALUE *argv, VALUE self);
145
+ VALUE rb_solve(int argc, VALUE *argv, VALUE self);
146
+ VALUE rb_svd(int argc, VALUE *argv, VALUE self);
147
+ VALUE rb_svbksb(int argc, VALUE *argv, VALUE self);
148
+ VALUE rb_eigenvv(int argc, VALUE *argv, VALUE self);
149
+ VALUE rb_eigenvv_bang(int argc, VALUE *argv, VALUE self);
150
+ VALUE rb_calc_covar_matrix(int argc, VALUE *argv, VALUE self);
151
+ VALUE rb_mahalonobis(int argc, VALUE *argv, VALUE self);
152
+
153
+ VALUE rb_dft(int argc, VALUE *argv, VALUE self);
154
+ VALUE rb_dct(int argc, VALUE *argv, VALUE self);
155
+
156
+ /* drawing function*/
157
+ VALUE rb_line(int argc, VALUE *argv, VALUE self);
158
+ VALUE rb_line_bang(int argc, VALUE *argv, VALUE self);
159
+ VALUE rb_rectangle(int argc, VALUE *argv, VALUE self);
160
+ VALUE rb_rectangle_bang(int argc, VALUE *argv, VALUE self);
161
+ VALUE rb_circle(int argc, VALUE *argv, VALUE self);
162
+ VALUE rb_circle_bang(int argc, VALUE *argv, VALUE self);
163
+ VALUE rb_ellipse(int argc, VALUE *argv, VALUE self);
164
+ VALUE rb_ellipse_bang(int argc, VALUE *argv, VALUE self);
165
+ VALUE rb_ellipse_box(int argc, VALUE *argv, VALUE self);
166
+ VALUE rb_ellipse_box_bang(int argc, VALUE *argv, VALUE self);
167
+ VALUE rb_fill_poly(int argc, VALUE *argv, VALUE self);
168
+ VALUE rb_fill_poly_bang(int argc, VALUE *argv, VALUE self);
169
+ VALUE rb_fill_convex_poly(int argc, VALUE *argv, VALUE self);
170
+ VALUE rb_fill_convex_poly_bang(int argc, VALUE *argv, VALUE self);
171
+ VALUE rb_poly_line(int argc, VALUE *argv, VALUE self);
172
+ VALUE rb_poly_line_bang(int argc, VALUE *argv, VALUE self);
173
+ VALUE rb_put_text(int argc, VALUE *argv, VALUE self);
174
+ VALUE rb_put_text_bang(int argc, VALUE *argv, VALUE self);
175
+
176
+ /* cv function */
177
+ VALUE rb_sobel(int argc, VALUE *argv, VALUE self);
178
+ VALUE rb_scharr(int argc, VALUE *argv, VALUE self);
179
+ VALUE rb_laplace(int argc, VALUE *argv, VALUE self);
180
+ VALUE rb_laplace2(int argc, VALUE *argv, VALUE self);
181
+ VALUE rb_canny(int argc, VALUE *argv, VALUE self);
182
+ VALUE rb_pre_corner_detect(int argc, VALUE *argv, VALUE self);
183
+ VALUE rb_corner_eigenvv(int argc, VALUE *argv, VALUE self);
184
+ VALUE rb_corner_min_eigen_val(int argc, VALUE *argv, VALUE self);
185
+ VALUE rb_corner_harris(int argc, VALUE *argv, VALUE self);
186
+ VALUE rb_find_chessboard_corners(int argc, VALUE *argv, VALUE self);
187
+ VALUE rb_find_corner_sub_pix(VALUE self, VALUE corners, VALUE win_size, VALUE zero_zone, VALUE criteria);
188
+ VALUE rbi_find_corner_sub_pix(int argc, VALUE *argv, VALUE self);
189
+ VALUE rb_good_features_to_track(int argc, VALUE *argv, VALUE self);
190
+
191
+ VALUE rb_sample_line(int argc, VALUE *argv, VALUE self);
192
+ VALUE rb_rect_sub_pix(int argc, VALUE *argv, VALUE self);
193
+ VALUE rb_quadrangle_sub_pix(int argc, VALUE *argv, VALUE self);
194
+ VALUE rb_resize(int argc, VALUE *argv, VALUE self);
195
+ VALUE rb_warp_affine(int argc, VALUE *argv, VALUE self);
196
+ VALUE rb_rotation_matrix2D(VALUE self, VALUE center, VALUE angle, VALUE scale);
197
+ VALUE rb_get_perspective_transform(VALUE self, VALUE source, VALUE dest);
198
+ VALUE rb_warp_perspective(int argc, VALUE *argv, VALUE self);
199
+ VALUE rb_find_homography(int argc, VALUE *argv, VALUE self);
200
+ VALUE rb_remap(int argc, VALUE *argv, VALUE self);
201
+ VALUE rb_log_polar(int argc, VALUE *argv, VALUE self);
202
+
203
+ VALUE rb_erode(int argc, VALUE *argv, VALUE self);
204
+ VALUE rb_erode_bang(int argc, VALUE *argv, VALUE self);
205
+ VALUE rb_dilate(int argc, VALUE *argv, VALUE self);
206
+ VALUE rb_dilate_bang(int argc, VALUE *argv, VALUE self);
207
+ VALUE rb_morphology(int argc, VALUE *argv, VALUE self);
208
+
209
+ VALUE rb_smooth(int argc, VALUE *argv, VALUE self);
210
+ VALUE rb_copy_make_border(int argc, VALUE *argv, VALUE self);
211
+ VALUE rb_filter2d(int argc, VALUE *argv, VALUE self);
212
+ VALUE rb_integral(int argc, VALUE *argv, VALUE self);
213
+ VALUE rb_threshold(int argc, VALUE *argv, VALUE self);
214
+ VALUE rb_adaptive_threshold(int argc, VALUE *argv, VALUE self);
215
+ VALUE rb_distance_transform(VALUE self, VALUE labels, VALUE distance_type, VALUE mask_size);
216
+
217
+ VALUE rb_pyr_down(int argc, VALUE *argv, VALUE self);
218
+ VALUE rb_pyr_up(int argc, VALUE *argv, VALUE self);
219
+
220
+ VALUE rb_flood_fill(int argc, VALUE *argv, VALUE self);
221
+ VALUE rb_flood_fill_bang(int argc, VALUE *argv, VALUE self);
222
+ VALUE rb_find_contours(int argc, VALUE *argv, VALUE self);
223
+ VALUE rb_find_contours_bang(int argc, VALUE *argv, VALUE self);
224
+ VALUE rb_draw_contours(int argc, VALUE *argv, VALUE self);
225
+ VALUE rb_draw_contours_bang(int argc, VALUE *argv, VALUE self);
226
+ VALUE rb_draw_chessboard_corners(VALUE self, VALUE pattern_size, VALUE corners, VALUE pattern_was_found);
227
+ VALUE rb_draw_chessboard_corners_bang(VALUE self, VALUE pattern_size, VALUE corners, VALUE pattern_was_found);
228
+ VALUE rb_pyr_segmentation(VALUE self, VALUE level, VALUE threshold1, VALUE threshold2);
229
+ VALUE rb_pyr_mean_shift_filtering(int argc, VALUE *argv, VALUE self);
230
+ VALUE rb_watershed(VALUE self, VALUE markers);
231
+
232
+ VALUE rb_grab_cut(VALUE self, VALUE mask, VALUE rect, VALUE bgdModel, VALUE fgdModel, VALUE iterCount, VALUE mode);
233
+ VALUE rb_grab_cut2(VALUE self, VALUE mask, VALUE rect, VALUE bgdModel, VALUE fgdModel, VALUE iterCount, VALUE mode, VALUE bgdLabels, VALUE fgdLabels, VALUE bgdCenters, VALUE fgdCenters);
234
+
235
+ VALUE rb_moments(int argc, VALUE *argv, VALUE self);
236
+
237
+ VALUE rb_hough_lines(int argc, VALUE *argv, VALUE self);
238
+ VALUE rb_hough_circles(int argc, VALUE *argv, VALUE self);
239
+ VALUE rb_dist_transform(int argc, VALUE *argv, VALUE self);
240
+ VALUE rb_inpaint(VALUE self, VALUE inpaint_method, VALUE mask, VALUE radius);
241
+
242
+ /* Histograms */
243
+ VALUE rb_equalize_hist(VALUE self);
244
+ VALUE rb_calc_hist(int argc, VALUE *argv, VALUE self);
245
+ VALUE rb_apply_color_map(VALUE self, VALUE colormap);
246
+
247
+ /* Matching */
248
+ VALUE rb_match_template(int argc, VALUE *argv, VALUE self);
249
+ VALUE rb_match_shapes(int argc, VALUE *argv, VALUE self);
250
+
251
+ /* Object Tracking */
252
+ VALUE rb_mean_shift(VALUE self, VALUE window, VALUE criteria);
253
+ VALUE rb_cam_shift(VALUE self, VALUE window, VALUE criteria);
254
+ VALUE rb_snake_image(int argc, VALUE *argv, VALUE self);
255
+ /* Optical Flow */
256
+ VALUE rb_optical_flow_hs(int argc, VALUE *argv, VALUE self);
257
+ VALUE rb_optical_flow_lk(VALUE self, VALUE prev, VALUE win_size);
258
+ VALUE rb_optical_flow_bm(int argc, VALUE *argv, VALUE self);
259
+ VALUE rb_optical_flow_pyr_lk(int argc, VALUE *argv, VALUE self);
260
+
261
+ /* Epipolar Geometory */
262
+ VALUE rb_find_fundamental_mat(int argc, VALUE *argv, VALUE klass);
263
+ VALUE rb_compute_correspond_epilines(VALUE klass, VALUE points, VALUE which_image, VALUE fundamental_matrix);
264
+
265
+ /* Feature detection and description */
266
+ VALUE rb_extract_surf(int argc, VALUE *argv, VALUE self);
267
+
268
+ VALUE rb_subspace_project(VALUE self, VALUE w, VALUE mean);
269
+ VALUE rb_subspace_reconstruct(VALUE self, VALUE w, VALUE mean);
270
+
271
+ VALUE rb_extract_orb(int argc, VALUE *argv, VALUE self);
272
+
273
+ // HighGUI function
274
+ VALUE rb_save_image(int argc, VALUE *argv, VALUE self);
275
+
276
+ VALUE rb_fit_line(VALUE self, VALUE distType, VALUE param, VALUE reps, VALUE aeps);
277
+ VALUE rb_fit_ellipse(VALUE self);
278
+
279
+ VALUE rb_connected_components(int argc, VALUE *argv, VALUE self);
280
+
281
+ VALUE new_object(int rows, int cols, int type);
282
+ VALUE new_object(CvSize size, int type);
283
+ VALUE new_mat_kind_object(CvSize size, VALUE ref_obj);
284
+ VALUE new_mat_kind_object(CvSize size, VALUE ref_obj, int cvmat_depth, int channel);
285
+
286
+ CvMat* prepare_decoding(int argc, VALUE *argv, int* iscolor, int* need_release);
287
+
288
+ __NAMESPACE_END_CVMAT
289
+
290
+ inline CvMat*
291
+ CVMAT(VALUE object)
292
+ {
293
+ CvMat *ptr, stub;
294
+ Data_Get_Struct(object, CvMat, ptr);
295
+ return cvGetMat(ptr, &stub);
296
+ }
297
+
298
+ inline CvMat*
299
+ CVMAT_WITH_CHECK(VALUE object)
300
+ {
301
+ if (!rb_obj_is_kind_of(object, cCvMat::rb_class()))
302
+ raise_typeerror(object, cCvMat::rb_class());
303
+ return CVMAT(object);
304
+ }
305
+
306
+ inline CvMat*
307
+ MASK(VALUE object)
308
+ {
309
+ if (NIL_P(object))
310
+ return NULL;
311
+ else {
312
+ CvMat* obj_ptr = CVMAT_WITH_CHECK(object);
313
+ if (CV_MAT_DEPTH(obj_ptr->type) == CV_8UC1 &&
314
+ CV_MAT_CN(obj_ptr->type) == 1)
315
+ return obj_ptr;
316
+ else
317
+ rb_raise(rb_eTypeError, "Mask should be 8bit 1-channel matrix.");
318
+ }
319
+ }
320
+
321
+ __NAMESPACE_END_OPENCV
322
+
323
+ #endif // RUBY_OPENCV_CVMAT_H
@@ -0,0 +1,73 @@
1
+ /************************************************************
2
+
3
+ cvmemstorage.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvmemstorage.h"
11
+ /*
12
+ * Document-class: OpenCV::CvMemStorage
13
+ *
14
+ * Internal memory management class used by CvSeq.
15
+ */
16
+ __NAMESPACE_BEGIN_OPENCV
17
+ __NAMESPACE_BEGIN_CVMEMSTORAGE
18
+
19
+ VALUE rb_klass;
20
+
21
+ VALUE
22
+ rb_class()
23
+ {
24
+ return rb_klass;
25
+ }
26
+
27
+ VALUE
28
+ rb_allocate(VALUE klass)
29
+ {
30
+ CvMemStorage *storage = rb_cvCreateMemStorage(0);
31
+ return Data_Wrap_Struct(klass, 0, cvmemstorage_free, storage);
32
+ }
33
+
34
+ void
35
+ cvmemstorage_free(void *ptr)
36
+ {
37
+ try {
38
+ cvReleaseMemStorage((CvMemStorage**)&ptr);
39
+ }
40
+ catch (cv::Exception& e) {
41
+ raise_cverror(e);
42
+ }
43
+ }
44
+
45
+ VALUE
46
+ new_object(int blocksize)
47
+ {
48
+ CvMemStorage *storage = rb_cvCreateMemStorage(blocksize);
49
+ return Data_Wrap_Struct(rb_klass, 0, cvmemstorage_free, storage);
50
+ }
51
+
52
+ void
53
+ init_ruby_class()
54
+ {
55
+ #if 0
56
+ // For documentation using YARD
57
+ VALUE opencv = rb_define_module("OpenCV");
58
+ #endif
59
+
60
+ if (rb_klass)
61
+ return;
62
+ /*
63
+ * opencv = rb_define_module("OpenCV");
64
+ *
65
+ * note: this comment is used by rdoc.
66
+ */
67
+ VALUE opencv = rb_module_opencv();
68
+ rb_klass = rb_define_class_under(opencv, "CvMemStorage", rb_cObject);
69
+ }
70
+
71
+ __NAMESPACE_END_CVMEMSTORAGE
72
+ __NAMESPACE_END_OPENCV
73
+
@@ -0,0 +1,53 @@
1
+ /************************************************************
2
+
3
+ cvmemstorage.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVMEMSTORAGE_H
11
+ #define RUBY_OPENCV_CVMEMSTORAGE_H
12
+
13
+ #include "opencv.h"
14
+
15
+ #define __NAMESPACE_BEGIN_CVMEMSTORAGE namespace cCvMemStorage {
16
+ #define __NAMESPACE_END_CVMEMSTORAGE }
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVMEMSTORAGE
20
+
21
+ void init_ruby_class();
22
+
23
+ VALUE rb_class();
24
+ VALUE rb_allocate(VALUE klass);
25
+ void cvmemstorage_free(void *ptr);
26
+
27
+ VALUE new_object(int blocksize = 0);
28
+
29
+ __NAMESPACE_END_CVMEMSTORAGE
30
+
31
+ inline CvMemStorage*
32
+ CVMEMSTORAGE(VALUE object)
33
+ {
34
+ CvMemStorage *ptr;
35
+ Data_Get_Struct(object, CvMemStorage, ptr);
36
+ return ptr;
37
+ }
38
+
39
+ inline VALUE
40
+ CHECK_CVMEMSTORAGE(VALUE object)
41
+ {
42
+ if (rb_obj_is_kind_of(object, cCvMemStorage::rb_class()))
43
+ return object;
44
+ else {
45
+ if (!NIL_P(object))
46
+ rb_warn("invalid CvMemStorage object given. allocate new memory storage automatically.");
47
+ return cCvMemStorage::new_object();
48
+ }
49
+ }
50
+
51
+ __NAMESPACE_END_OPENCV
52
+
53
+ #endif // RUBY_OPENCV_CVMEMSTORAGE_H