ruby-opencv 0.0.8.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. data/Gemfile +8 -0
  2. data/History.txt +5 -0
  3. data/License.txt +30 -0
  4. data/Manifest.txt +229 -0
  5. data/README.rdoc +149 -0
  6. data/Rakefile +32 -0
  7. data/examples/alpha_blend.rb +21 -0
  8. data/examples/box.png +0 -0
  9. data/examples/box_in_scene.png +0 -0
  10. data/examples/contours/bitmap-contours-with-labels.png +0 -0
  11. data/examples/contours/bitmap-contours.png +0 -0
  12. data/examples/contours/bounding-box-detect-canny.rb +62 -0
  13. data/examples/contours/contour_retrieval_modes.rb +139 -0
  14. data/examples/contours/rotated-boxes-with-detected-bounding-rectangles.jpg +0 -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/matching_to_many_images.rb +16 -0
  26. data/examples/matching_to_many_images/query.png +0 -0
  27. data/examples/matching_to_many_images/train/1.png +0 -0
  28. data/examples/matching_to_many_images/train/2.png +0 -0
  29. data/examples/matching_to_many_images/train/3.png +0 -0
  30. data/examples/matching_to_many_images/train/trainImages.txt +3 -0
  31. data/examples/paint.rb +70 -0
  32. data/examples/snake.rb +43 -0
  33. data/examples/stuff.jpg +0 -0
  34. data/examples/tiffany.jpg +0 -0
  35. data/ext/opencv/GPATH +0 -0
  36. data/ext/opencv/GSYMS +0 -0
  37. data/ext/opencv/curve.cpp +112 -0
  38. data/ext/opencv/curve.h +34 -0
  39. data/ext/opencv/cvavgcomp.cpp +67 -0
  40. data/ext/opencv/cvavgcomp.h +39 -0
  41. data/ext/opencv/cvbox2d.cpp +197 -0
  42. data/ext/opencv/cvbox2d.h +61 -0
  43. data/ext/opencv/cvcapture.cpp +499 -0
  44. data/ext/opencv/cvcapture.h +72 -0
  45. data/ext/opencv/cvchain.cpp +233 -0
  46. data/ext/opencv/cvchain.h +46 -0
  47. data/ext/opencv/cvcircle32f.cpp +116 -0
  48. data/ext/opencv/cvcircle32f.h +52 -0
  49. data/ext/opencv/cvcondensation.cpp +282 -0
  50. data/ext/opencv/cvcondensation.h +49 -0
  51. data/ext/opencv/cvconnectedcomp.cpp +143 -0
  52. data/ext/opencv/cvconnectedcomp.h +49 -0
  53. data/ext/opencv/cvcontour.cpp +296 -0
  54. data/ext/opencv/cvcontour.h +48 -0
  55. data/ext/opencv/cvcontourtree.cpp +91 -0
  56. data/ext/opencv/cvcontourtree.h +41 -0
  57. data/ext/opencv/cvconvexitydefect.cpp +103 -0
  58. data/ext/opencv/cvconvexitydefect.h +42 -0
  59. data/ext/opencv/cverror.cpp +159 -0
  60. data/ext/opencv/cverror.h +28 -0
  61. data/ext/opencv/cvfeaturetree.cpp +125 -0
  62. data/ext/opencv/cvfeaturetree.h +55 -0
  63. data/ext/opencv/cvfont.cpp +208 -0
  64. data/ext/opencv/cvfont.h +64 -0
  65. data/ext/opencv/cvhaarclassifiercascade.cpp +168 -0
  66. data/ext/opencv/cvhaarclassifiercascade.h +39 -0
  67. data/ext/opencv/cvhistogram.cpp +546 -0
  68. data/ext/opencv/cvhistogram.h +73 -0
  69. data/ext/opencv/cvhumoments.cpp +139 -0
  70. data/ext/opencv/cvhumoments.h +51 -0
  71. data/ext/opencv/cvline.cpp +154 -0
  72. data/ext/opencv/cvline.h +54 -0
  73. data/ext/opencv/cvmat.cpp +5848 -0
  74. data/ext/opencv/cvmat.h +284 -0
  75. data/ext/opencv/cvmatnd.cpp +44 -0
  76. data/ext/opencv/cvmatnd.h +28 -0
  77. data/ext/opencv/cvmemstorage.cpp +68 -0
  78. data/ext/opencv/cvmemstorage.h +53 -0
  79. data/ext/opencv/cvmoments.cpp +287 -0
  80. data/ext/opencv/cvmoments.h +75 -0
  81. data/ext/opencv/cvpoint.cpp +228 -0
  82. data/ext/opencv/cvpoint.h +64 -0
  83. data/ext/opencv/cvpoint2d32f.cpp +211 -0
  84. data/ext/opencv/cvpoint2d32f.h +63 -0
  85. data/ext/opencv/cvpoint3d32f.cpp +245 -0
  86. data/ext/opencv/cvpoint3d32f.h +66 -0
  87. data/ext/opencv/cvrect.cpp +333 -0
  88. data/ext/opencv/cvrect.h +79 -0
  89. data/ext/opencv/cvscalar.cpp +236 -0
  90. data/ext/opencv/cvscalar.h +71 -0
  91. data/ext/opencv/cvseq.cpp +599 -0
  92. data/ext/opencv/cvseq.h +74 -0
  93. data/ext/opencv/cvsize.cpp +221 -0
  94. data/ext/opencv/cvsize.h +65 -0
  95. data/ext/opencv/cvsize2d32f.cpp +209 -0
  96. data/ext/opencv/cvsize2d32f.h +64 -0
  97. data/ext/opencv/cvslice.cpp +120 -0
  98. data/ext/opencv/cvslice.h +61 -0
  99. data/ext/opencv/cvsparsemat.cpp +44 -0
  100. data/ext/opencv/cvsparsemat.h +28 -0
  101. data/ext/opencv/cvsurfparams.cpp +199 -0
  102. data/ext/opencv/cvsurfparams.h +58 -0
  103. data/ext/opencv/cvsurfpoint.cpp +223 -0
  104. data/ext/opencv/cvsurfpoint.h +52 -0
  105. data/ext/opencv/cvtermcriteria.cpp +192 -0
  106. data/ext/opencv/cvtermcriteria.h +71 -0
  107. data/ext/opencv/cvtwopoints.cpp +116 -0
  108. data/ext/opencv/cvtwopoints.h +51 -0
  109. data/ext/opencv/cvutils.cpp +194 -0
  110. data/ext/opencv/cvutils.h +29 -0
  111. data/ext/opencv/cvvideowriter.cpp +137 -0
  112. data/ext/opencv/cvvideowriter.h +43 -0
  113. data/ext/opencv/gui.cpp +68 -0
  114. data/ext/opencv/gui.h +30 -0
  115. data/ext/opencv/iplconvkernel.cpp +192 -0
  116. data/ext/opencv/iplconvkernel.h +71 -0
  117. data/ext/opencv/iplimage.cpp +644 -0
  118. data/ext/opencv/iplimage.h +73 -0
  119. data/ext/opencv/lib/opencv.rb +3 -0
  120. data/ext/opencv/lib/opencv/psyched_yaml.rb +22 -0
  121. data/ext/opencv/lib/opencv/version.rb +3 -0
  122. data/ext/opencv/mouseevent.cpp +181 -0
  123. data/ext/opencv/mouseevent.h +56 -0
  124. data/ext/opencv/opencv.cpp +722 -0
  125. data/ext/opencv/opencv.h +400 -0
  126. data/ext/opencv/pointset.cpp +274 -0
  127. data/ext/opencv/pointset.h +68 -0
  128. data/ext/opencv/trackbar.cpp +121 -0
  129. data/ext/opencv/trackbar.h +69 -0
  130. data/ext/opencv/window.cpp +357 -0
  131. data/ext/opencv/window.h +66 -0
  132. data/extconf.rb +75 -0
  133. data/images/CvMat_sobel.png +0 -0
  134. data/images/CvMat_sub_rect.png +0 -0
  135. data/images/CvSeq_relationmap.png +0 -0
  136. data/images/face_detect_from_lena.jpg +0 -0
  137. data/ruby-opencv.gemspec +43 -0
  138. data/test/helper.rb +166 -0
  139. data/test/log.txt +55 -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. data/test/videowriter_result.avi +0 -0
  230. metadata +394 -0
@@ -0,0 +1,284 @@
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 define_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_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(int argc, VALUE* argv, VALUE self);
62
+ VALUE rb_get_cols(VALUE self, VALUE col);
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_aset(VALUE self, VALUE args);
71
+ VALUE rb_set_data(VALUE self, VALUE data);
72
+ VALUE rb_set(int argc, VALUE *argv, VALUE self);
73
+ VALUE rb_set_bang(int argc, VALUE *argv, VALUE self);
74
+ VALUE rb_set_zero(VALUE self);
75
+ VALUE rb_set_zero_bang(VALUE self);
76
+ VALUE rb_set_identity(int argc, VALUE *argv, VALUE self);
77
+ VALUE rb_set_identity_bang(int argc, VALUE *argv, VALUE self);
78
+ VALUE rb_range(VALUE self, VALUE start, VALUE end);
79
+ VALUE rb_range_bang(VALUE self, VALUE start, VALUE end);
80
+ /* Transforms and Permutations */
81
+ VALUE rb_reshape(VALUE self, VALUE hash);
82
+ VALUE rb_repeat(VALUE self, VALUE object);
83
+ VALUE rb_flip(int argc, VALUE *argv, VALUE self);
84
+ VALUE rb_flip_bang(int argc, VALUE *argv, VALUE self);
85
+ VALUE rb_split(VALUE self);
86
+ VALUE rb_merge(VALUE klass, VALUE args);
87
+ VALUE rb_rand_shuffle(int argc, VALUE *argv, VALUE klass);
88
+ VALUE rb_rand_shuffle_bang(int argc, VALUE *argv, VALUE klass);
89
+
90
+ VALUE rb_lut(VALUE self, VALUE lut);
91
+ VALUE rb_convert_scale(VALUE self, VALUE hash);
92
+ VALUE rb_convert_scale_abs(VALUE self, VALUE hash);
93
+ VALUE rb_add(int argc, VALUE *argv, VALUE self);
94
+ VALUE rb_sub(int argc, VALUE *argv, VALUE self);
95
+ VALUE rb_mul(int argc, VALUE *argv, VALUE self);
96
+ VALUE rb_mat_mul(int argc, VALUE *argv, VALUE self);
97
+ VALUE rb_div(int argc, VALUE *argv, VALUE self);
98
+ VALUE rb_and(int argc, VALUE *argv, VALUE self);
99
+ VALUE rb_or(int argc, VALUE *argv, VALUE self);
100
+ VALUE rb_xor(int argc, VALUE *argv, VALUE self);
101
+ VALUE rb_not(VALUE self);
102
+ VALUE rb_not_bang(VALUE self);
103
+ VALUE rb_cmp_internal(VALUE self, VALUE val, int operand);
104
+ VALUE rb_eq(VALUE self, VALUE val);
105
+ VALUE rb_gt(VALUE self, VALUE val);
106
+ VALUE rb_ge(VALUE self, VALUE val);
107
+ VALUE rb_lt(VALUE self, VALUE val);
108
+ VALUE rb_le(VALUE self, VALUE val);
109
+ VALUE rb_ne(VALUE self, VALUE val);
110
+ VALUE rb_in_range(VALUE self, VALUE min, VALUE max);
111
+ VALUE rb_abs_diff(VALUE self, VALUE val);
112
+ VALUE rb_normalize(int argc, VALUE *argv, VALUE self);
113
+ VALUE rb_add_weighted(VALUE klass, VALUE src1, VALUE alpha, VALUE src2, VALUE beta, VALUE gamma);
114
+ /* Statistics */
115
+ VALUE rb_count_non_zero(VALUE self);
116
+ VALUE rb_sum(VALUE self);
117
+ VALUE rb_avg(int argc, VALUE *argv, VALUE self);
118
+ VALUE rb_avg_sdv(int argc, VALUE *argv, VALUE self);
119
+ VALUE rb_sdv(int argc, VALUE *argv, VALUE self);
120
+ VALUE rb_min_max_loc(int argc, VALUE *argv, VALUE self);
121
+
122
+ //VALUE rb_norm();
123
+ VALUE rb_dot_product(VALUE self, VALUE mat);
124
+ VALUE rb_cross_product(VALUE self, VALUE mat);
125
+ // VALUE rb_gemm();
126
+ VALUE rb_transform(int argc, VALUE *argv, VALUE self);
127
+ VALUE rb_perspective_transform(VALUE self, VALUE mat);
128
+ VALUE rb_mul_transposed(int argc, VALUE *argv, VALUE self);
129
+ VALUE rb_trace(VALUE self);
130
+ VALUE rb_transpose(VALUE self);
131
+ VALUE rb_det(VALUE self);
132
+ VALUE rb_invert(int argc, VALUE *argv, VALUE self);
133
+ VALUE rb_solve(int argc, VALUE *argv, VALUE self);
134
+ VALUE rb_svd(int argc, VALUE *argv, VALUE self);
135
+ VALUE rb_eigenvv(int argc, VALUE *argv, VALUE self);
136
+ VALUE rb_eigenvv_bang(int argc, VALUE *argv, VALUE self);
137
+
138
+ VALUE rb_dft(int argc, VALUE *argv, VALUE self);
139
+ VALUE rb_dct(int argc, VALUE *argv, VALUE self);
140
+
141
+ /* drawing function*/
142
+ VALUE rb_line(int argc, VALUE *argv, VALUE self);
143
+ VALUE rb_line_bang(int argc, VALUE *argv, VALUE self);
144
+ VALUE rb_rectangle(int argc, VALUE *argv, VALUE self);
145
+ VALUE rb_rectangle_bang(int argc, VALUE *argv, VALUE self);
146
+ VALUE rb_circle(int argc, VALUE *argv, VALUE self);
147
+ VALUE rb_circle_bang(int argc, VALUE *argv, VALUE self);
148
+ VALUE rb_ellipse(int argc, VALUE *argv, VALUE self);
149
+ VALUE rb_ellipse_bang(int argc, VALUE *argv, VALUE self);
150
+ VALUE rb_ellipse_box(int argc, VALUE *argv, VALUE self);
151
+ VALUE rb_ellipse_box_bang(int argc, VALUE *argv, VALUE self);
152
+ VALUE rb_fill_poly(int argc, VALUE *argv, VALUE self);
153
+ VALUE rb_fill_poly_bang(int argc, VALUE *argv, VALUE self);
154
+ VALUE rb_fill_convex_poly(int argc, VALUE *argv, VALUE self);
155
+ VALUE rb_fill_convex_poly_bang(int argc, VALUE *argv, VALUE self);
156
+ VALUE rb_poly_line(int argc, VALUE *argv, VALUE self);
157
+ VALUE rb_poly_line_bang(int argc, VALUE *argv, VALUE self);
158
+ VALUE rb_put_text(int argc, VALUE *argv, VALUE self);
159
+ VALUE rb_put_text_bang(int argc, VALUE *argv, VALUE self);
160
+
161
+ /* cv function */
162
+ VALUE rb_sobel(int argc, VALUE *argv, VALUE self);
163
+ VALUE rb_laplace(int argc, VALUE *argv, VALUE self);
164
+ VALUE rb_canny(int argc, VALUE *argv, VALUE self);
165
+ VALUE rb_pre_corner_detect(int argc, VALUE *argv, VALUE self);
166
+ VALUE rb_corner_eigenvv(int argc, VALUE *argv, VALUE self);
167
+ VALUE rb_corner_min_eigen_val(int argc, VALUE *argv, VALUE self);
168
+ VALUE rb_corner_harris(int argc, VALUE *argv, VALUE self);
169
+ VALUE rb_find_chessboard_corners(int argc, VALUE *argv, VALUE self);
170
+ VALUE rb_find_corner_sub_pix(VALUE self, VALUE corners, VALUE win_size, VALUE zero_zone, VALUE criteria);
171
+ VALUE rb_good_features_to_track(int argc, VALUE *argv, VALUE self);
172
+
173
+ VALUE rb_rect_sub_pix(int argc, VALUE *argv, VALUE self);
174
+ VALUE rb_quadrangle_sub_pix(int argc, VALUE *argv, VALUE self);
175
+ VALUE rb_resize(int argc, VALUE *argv, VALUE self);
176
+ VALUE rb_warp_affine(int argc, VALUE *argv, VALUE self);
177
+ VALUE rb_rotation_matrix2D(VALUE self, VALUE center, VALUE angle, VALUE scale);
178
+ VALUE rb_warp_perspective(int argc, VALUE *argv, VALUE self);
179
+ VALUE rb_find_homograpy(int argc, VALUE *argv, VALUE self);
180
+ VALUE rb_remap(int argc, VALUE *argv, VALUE self);
181
+ VALUE rb_log_polar(int argc, VALUE *argv, VALUE self);
182
+
183
+ VALUE rb_erode(int argc, VALUE *argv, VALUE self);
184
+ VALUE rb_erode_bang(int argc, VALUE *argv, VALUE self);
185
+ VALUE rb_dilate(int argc, VALUE *argv, VALUE self);
186
+ VALUE rb_dilate_bang(int argc, VALUE *argv, VALUE self);
187
+ VALUE rb_morphology(int argc, VALUE *argv, VALUE self);
188
+
189
+ VALUE rb_smooth(int argc, VALUE *argv, VALUE self);
190
+ VALUE rb_copy_make_border(int argc, VALUE *argv, VALUE self);
191
+ VALUE rb_filter2d(int argc, VALUE *argv, VALUE self);
192
+ VALUE rb_integral(int argc, VALUE *argv, VALUE self);
193
+ VALUE rb_threshold(int argc, VALUE *argv, VALUE self);
194
+ VALUE rb_adaptive_threshold(int argc, VALUE *argv, VALUE self);
195
+
196
+ VALUE rb_pyr_down(int argc, VALUE *argv, VALUE self);
197
+ VALUE rb_pyr_up(int argc, VALUE *argv, VALUE self);
198
+
199
+ VALUE rb_flood_fill(int argc, VALUE *argv, VALUE self);
200
+ VALUE rb_flood_fill_bang(int argc, VALUE *argv, VALUE self);
201
+ VALUE rb_find_contours(int argc, VALUE *argv, VALUE self);
202
+ VALUE rb_find_contours_bang(int argc, VALUE *argv, VALUE self);
203
+ VALUE rb_draw_contours(int argc, VALUE *argv, VALUE self);
204
+ VALUE rb_draw_contours_bang(int argc, VALUE *argv, VALUE self);
205
+ VALUE rb_draw_chessboard_corners(VALUE self, VALUE pattern_size, VALUE corners, VALUE pattern_was_found);
206
+ VALUE rb_draw_chessboard_corners_bang(VALUE self, VALUE pattern_size, VALUE corners, VALUE pattern_was_found);
207
+ VALUE rb_pyr_mean_shift_filtering(int argc, VALUE *argv, VALUE self);
208
+ VALUE rb_watershed(VALUE self, VALUE markers);
209
+ VALUE rb_moments(int argc, VALUE *argv, VALUE self);
210
+
211
+ VALUE rb_hough_lines(int argc, VALUE *argv, VALUE self);
212
+ VALUE rb_hough_circles(int argc, VALUE *argv, VALUE self);
213
+ VALUE rb_dist_transform(int argc, VALUE *argv, VALUE self);
214
+ VALUE rb_inpaint(VALUE self, VALUE inpaint_method, VALUE mask, VALUE radius);
215
+
216
+ VALUE rb_equalize_hist(VALUE self);
217
+ /* Matching*/
218
+ VALUE rb_match_template(int argc, VALUE *argv, VALUE self);
219
+ VALUE rb_match_shapes(int argc, VALUE *argv, VALUE self);
220
+ VALUE rb_match_descriptors(int argc, VALUE *argv, VALUE self);
221
+
222
+ /* Object Tracking */
223
+ VALUE rb_mean_shift(VALUE self, VALUE window, VALUE criteria);
224
+ VALUE rb_cam_shift(VALUE self, VALUE window, VALUE criteria);
225
+ VALUE rb_snake_image(int argc, VALUE *argv, VALUE self);
226
+ /* Optical Flow */
227
+ VALUE rb_optical_flow_hs(int argc, VALUE *argv, VALUE self);
228
+ VALUE rb_optical_flow_lk(VALUE self, VALUE prev, VALUE win_size);
229
+ VALUE rb_optical_flow_bm(int argc, VALUE *argv, VALUE self);
230
+ VALUE rb_optical_flow_pyr_lk(int argc, VALUE *argv, VALUE self);
231
+
232
+ /* Epipolar Geometory */
233
+ VALUE rb_find_fundamental_mat(int argc, VALUE *argv, VALUE klass);
234
+ VALUE rb_compute_correspond_epilines(VALUE klass, VALUE points, VALUE which_image, VALUE fundamental_matrix);
235
+
236
+ /* Feature detection and description */
237
+ VALUE rb_extract_surf(int argc, VALUE *argv, VALUE self);
238
+
239
+ // HighGUI function
240
+ VALUE rb_save_image(int argc, VALUE *argv, VALUE self);
241
+
242
+ VALUE new_object(int rows, int cols, int type);
243
+ VALUE new_object(CvSize size, int type);
244
+ VALUE new_mat_kind_object(CvSize size, VALUE ref_obj);
245
+ VALUE new_mat_kind_object(CvSize size, VALUE ref_obj, int cvmat_depth, int channel);
246
+
247
+ CvMat* prepare_decoding(int argc, VALUE *argv, int* iscolor, int* need_release);
248
+
249
+ __NAMESPACE_END_CVMAT
250
+
251
+ inline CvMat*
252
+ CVMAT(VALUE object)
253
+ {
254
+ CvMat *ptr, stub;
255
+ Data_Get_Struct(object, CvMat, ptr);
256
+ return cvGetMat(ptr, &stub);
257
+ }
258
+
259
+ inline CvMat*
260
+ CVMAT_WITH_CHECK(VALUE object)
261
+ {
262
+ if (!rb_obj_is_kind_of(object, cCvMat::rb_class()))
263
+ raise_typeerror(object, cCvMat::rb_class());
264
+ return CVMAT(object);
265
+ }
266
+
267
+ inline CvMat*
268
+ MASK(VALUE object)
269
+ {
270
+ if (NIL_P(object))
271
+ return NULL;
272
+ else {
273
+ CvMat* obj_ptr = CVMAT_WITH_CHECK(object);
274
+ if (CV_MAT_DEPTH(obj_ptr->type) == CV_8UC1 &&
275
+ CV_MAT_CN(obj_ptr->type) == 1)
276
+ return obj_ptr;
277
+ else
278
+ rb_raise(rb_eTypeError, "Mask should be 8bit 1-channel matrix.");
279
+ }
280
+ }
281
+
282
+ __NAMESPACE_END_OPENCV
283
+
284
+ #endif // RUBY_OPENCV_CVMAT_H
@@ -0,0 +1,44 @@
1
+ /***********************************************************
2
+
3
+ cvmatnd.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvmatnd.h"
11
+ /*
12
+ * Document-class: OpenCV::CvMatND
13
+ *
14
+ */
15
+ __NAMESPACE_BEGIN_OPENCV
16
+ __NAMESPACE_BEGIN_CVMATND
17
+
18
+ VALUE rb_klass;
19
+
20
+ VALUE
21
+ rb_class()
22
+ {
23
+ return rb_klass;
24
+ }
25
+
26
+ void
27
+ define_ruby_class()
28
+ {
29
+ if (rb_klass)
30
+ return;
31
+ /*
32
+ * opencv = rb_define_module("OpenCV");
33
+ * cvmat = rb_define_class_under(opencv, "CvMat", rb_cObject);
34
+ *
35
+ * note: this comment is used by rdoc.
36
+ */
37
+ VALUE opencv = rb_module_opencv(), cvmat = cCvMat::rb_class();
38
+
39
+ rb_klass = rb_define_class_under(opencv, "CvMatND", cvmat);
40
+ }
41
+
42
+ __NAMESPACE_END_CVMATND
43
+ __NAMESPACE_END_OPENCV
44
+
@@ -0,0 +1,28 @@
1
+ /************************************************************
2
+
3
+ cvmatnd.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVMATND_H
11
+ #define RUBY_OPENCV_CVMATND_H
12
+
13
+ #include "opencv.h"
14
+
15
+ #define __NAMESPACE_BEGIN_CVMATND namespace cCvMatND {
16
+ #define __NAMESPACE_END_CVMATND }
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVMATND
20
+
21
+ VALUE rb_class();
22
+
23
+ void define_ruby_class();
24
+
25
+ __NAMESPACE_END_CVMATND
26
+ __NAMESPACE_END_OPENCV
27
+
28
+ #endif // RUBY_OPENCV_CVMATND_H
@@ -0,0 +1,68 @@
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
+ void
28
+ define_ruby_class()
29
+ {
30
+ if (rb_klass)
31
+ return;
32
+ /*
33
+ * opencv = rb_define_module("OpenCV");
34
+ *
35
+ * note: this comment is used by rdoc.
36
+ */
37
+ VALUE opencv = rb_module_opencv();
38
+ rb_klass = rb_define_class_under(opencv, "CvMemStorage", rb_cObject);
39
+ }
40
+
41
+ VALUE
42
+ rb_allocate(VALUE klass)
43
+ {
44
+ CvMemStorage *storage = rb_cvCreateMemStorage(0);
45
+ return Data_Wrap_Struct(klass, 0, cvmemstorage_free, storage);
46
+ }
47
+
48
+ void
49
+ cvmemstorage_free(void *ptr)
50
+ {
51
+ try {
52
+ cvReleaseMemStorage((CvMemStorage**)&ptr);
53
+ }
54
+ catch (cv::Exception& e) {
55
+ raise_cverror(e);
56
+ }
57
+ }
58
+
59
+ VALUE
60
+ new_object(int blocksize)
61
+ {
62
+ CvMemStorage *storage = rb_cvCreateMemStorage(blocksize);
63
+ return Data_Wrap_Struct(rb_klass, 0, cvmemstorage_free, storage);
64
+ }
65
+
66
+
67
+ __NAMESPACE_END_CVMEMSTORAGE
68
+ __NAMESPACE_END_OPENCV
@@ -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 define_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