opencv 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/License.txt +30 -0
- data/Manifest.txt +115 -0
- data/README.txt +47 -0
- data/Rakefile +34 -0
- data/examples/convexhull.rb +41 -0
- data/examples/face_detect.rb +25 -0
- data/examples/houghcircle.rb +23 -0
- data/examples/inpaint.png +0 -0
- data/examples/inpaint.rb +43 -0
- data/examples/paint.rb +72 -0
- data/examples/snake.rb +43 -0
- data/examples/stuff.jpg +0 -0
- data/ext/curve.cpp +103 -0
- data/ext/curve.h +34 -0
- data/ext/cvavgcomp.cpp +67 -0
- data/ext/cvavgcomp.h +39 -0
- data/ext/cvbox2d.cpp +114 -0
- data/ext/cvbox2d.h +53 -0
- data/ext/cvcapture.cpp +276 -0
- data/ext/cvcapture.h +54 -0
- data/ext/cvchain.cpp +184 -0
- data/ext/cvchain.h +43 -0
- data/ext/cvchaincode.cpp +49 -0
- data/ext/cvchaincode.h +43 -0
- data/ext/cvcircle32f.cpp +90 -0
- data/ext/cvcircle32f.h +53 -0
- data/ext/cvcondensation.cpp +230 -0
- data/ext/cvcondensation.h +49 -0
- data/ext/cvconnectedcomp.cpp +115 -0
- data/ext/cvconnectedcomp.h +46 -0
- data/ext/cvcontour.cpp +219 -0
- data/ext/cvcontour.h +47 -0
- data/ext/cvcontourtree.cpp +86 -0
- data/ext/cvcontourtree.h +41 -0
- data/ext/cvconvexitydefect.cpp +103 -0
- data/ext/cvconvexitydefect.h +42 -0
- data/ext/cverror.cpp +140 -0
- data/ext/cverror.h +79 -0
- data/ext/cvfont.cpp +173 -0
- data/ext/cvfont.h +56 -0
- data/ext/cvhaarclassifiercascade.cpp +159 -0
- data/ext/cvhaarclassifiercascade.h +41 -0
- data/ext/cvhistogram.cpp +200 -0
- data/ext/cvhistogram.h +51 -0
- data/ext/cvindex.cpp +73 -0
- data/ext/cvindex.h +40 -0
- data/ext/cvline.cpp +106 -0
- data/ext/cvline.h +52 -0
- data/ext/cvmat.cpp +4809 -0
- data/ext/cvmat.h +286 -0
- data/ext/cvmatnd.cpp +44 -0
- data/ext/cvmatnd.h +28 -0
- data/ext/cvmemstorage.cpp +64 -0
- data/ext/cvmemstorage.h +53 -0
- data/ext/cvmoments.cpp +204 -0
- data/ext/cvmoments.h +48 -0
- data/ext/cvpoint.cpp +229 -0
- data/ext/cvpoint.h +59 -0
- data/ext/cvpoint2d32f.cpp +213 -0
- data/ext/cvpoint2d32f.h +61 -0
- data/ext/cvpoint3d32f.cpp +245 -0
- data/ext/cvpoint3d32f.h +64 -0
- data/ext/cvrect.cpp +340 -0
- data/ext/cvrect.h +79 -0
- data/ext/cvscalar.cpp +227 -0
- data/ext/cvscalar.h +63 -0
- data/ext/cvseq.cpp +583 -0
- data/ext/cvseq.h +71 -0
- data/ext/cvset.cpp +63 -0
- data/ext/cvset.h +39 -0
- data/ext/cvsize.cpp +223 -0
- data/ext/cvsize.h +63 -0
- data/ext/cvsize2d32f.cpp +180 -0
- data/ext/cvsize2d32f.h +59 -0
- data/ext/cvslice.cpp +82 -0
- data/ext/cvslice.h +53 -0
- data/ext/cvsparsemat.cpp +44 -0
- data/ext/cvsparsemat.h +28 -0
- data/ext/cvtermcriteria.cpp +183 -0
- data/ext/cvtermcriteria.h +71 -0
- data/ext/cvtwopoints.cpp +98 -0
- data/ext/cvtwopoints.h +50 -0
- data/ext/cvvector.cpp +206 -0
- data/ext/cvvector.h +54 -0
- data/ext/cvvideowriter.cpp +116 -0
- data/ext/cvvideowriter.h +41 -0
- data/ext/extconf.rb +61 -0
- data/ext/gui.cpp +65 -0
- data/ext/gui.h +33 -0
- data/ext/iplconvkernel.cpp +177 -0
- data/ext/iplconvkernel.h +52 -0
- data/ext/iplimage.cpp +238 -0
- data/ext/iplimage.h +54 -0
- data/ext/mouseevent.cpp +184 -0
- data/ext/mouseevent.h +59 -0
- data/ext/opencv.cpp +481 -0
- data/ext/opencv.h +356 -0
- data/ext/point3dset.cpp +41 -0
- data/ext/point3dset.h +31 -0
- data/ext/pointset.cpp +238 -0
- data/ext/pointset.h +69 -0
- data/ext/trackbar.cpp +122 -0
- data/ext/trackbar.h +65 -0
- data/ext/window.cpp +368 -0
- data/ext/window.h +56 -0
- data/images/CvMat_sobel.png +0 -0
- data/images/CvMat_sub_rect.png +0 -0
- data/images/CvSeq_relationmap.png +0 -0
- data/images/face_detect_from_lena.jpg +0 -0
- data/lib/opencv.rb +3 -0
- data/lib/version.rb +3 -0
- data/setup/setup.cygwin.rb +120 -0
- data/setup/setup.mingw.rb +99 -0
- data/setup/setup.mswin32.rb +103 -0
- data/test/test_opencv.rb +4 -0
- metadata +191 -0
data/ext/cvmat.h
ADDED
@@ -0,0 +1,286 @@
|
|
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
|
+
#define __NAMESPACE_BEGIN_CVMAT namespace cCvMat{
|
16
|
+
#define __NAMESPACE_END_CVMAT }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVMAT
|
20
|
+
|
21
|
+
VALUE rb_class();
|
22
|
+
|
23
|
+
void define_ruby_class();
|
24
|
+
|
25
|
+
VALUE rb_allocate(VALUE klass);
|
26
|
+
VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
|
27
|
+
|
28
|
+
VALUE rb_method_missing(int argc, VALUE *argv, VALUE self);
|
29
|
+
VALUE rb_to_s(VALUE self);
|
30
|
+
VALUE rb_has_parent_q(VALUE self);
|
31
|
+
VALUE rb_parent(VALUE self);
|
32
|
+
VALUE rb_inside_q(VALUE self, VALUE object);
|
33
|
+
VALUE rb_to_IplConvKernel(VALUE self, VALUE anchor);
|
34
|
+
VALUE rb_create_mask(VALUE self);
|
35
|
+
|
36
|
+
VALUE rb_width(VALUE self);
|
37
|
+
VALUE rb_height(VALUE self);
|
38
|
+
VALUE rb_depth(VALUE self);
|
39
|
+
VALUE rb_channel(VALUE self);
|
40
|
+
VALUE rb_data(VALUE self);
|
41
|
+
|
42
|
+
VALUE rb_clone(VALUE self);
|
43
|
+
VALUE rb_copy(int argc, VALUE *argv, VALUE self);
|
44
|
+
VALUE copy(VALUE mat);
|
45
|
+
|
46
|
+
VALUE rb_to_8u(VALUE self);
|
47
|
+
VALUE rb_to_8s(VALUE self);
|
48
|
+
VALUE rb_to_16u(VALUE self);
|
49
|
+
VALUE rb_to_16s(VALUE self);
|
50
|
+
VALUE rb_to_32s(VALUE self);
|
51
|
+
VALUE rb_to_32f(VALUE self);
|
52
|
+
VALUE rb_to_64f(VALUE self);
|
53
|
+
VALUE rb_vector_q(VALUE self);
|
54
|
+
VALUE rb_square_q(VALUE self);
|
55
|
+
// cxcore function
|
56
|
+
VALUE rb_to_CvMat(VALUE self);
|
57
|
+
VALUE rb_to_IplImage(VALUE self);
|
58
|
+
VALUE rb_sub_rect(VALUE self, VALUE args);
|
59
|
+
VALUE rb_slice_width(VALUE self, VALUE num);
|
60
|
+
VALUE rb_slice_height(VALUE self, VALUE num);
|
61
|
+
VALUE rb_row(VALUE self, VALUE args);
|
62
|
+
VALUE rb_col(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_aset(VALUE self, VALUE args);
|
71
|
+
VALUE rb_fill(int argc, VALUE *argv, VALUE self);
|
72
|
+
VALUE rb_fill_bang(int argc, VALUE *argv, VALUE self);
|
73
|
+
VALUE rb_clear(VALUE self);
|
74
|
+
VALUE rb_clear_bang(VALUE self);
|
75
|
+
VALUE rb_set_identity(int argc, VALUE *argv, VALUE self);
|
76
|
+
VALUE rb_set_identity_bang(int argc, VALUE *argv, VALUE self);
|
77
|
+
VALUE rb_range(int argc, VALUE *argv, VALUE self);
|
78
|
+
VALUE rb_range_bang(int argc, VALUE *argv, VALUE self);
|
79
|
+
/* Transforms and Permutations */
|
80
|
+
VALUE rb_reshape(VALUE self, VALUE hash);
|
81
|
+
VALUE rb_repeat(VALUE self, VALUE object);
|
82
|
+
VALUE rb_flip(int argc, VALUE *argv, VALUE self);
|
83
|
+
VALUE rb_flip_bang(int argc, VALUE *argv, VALUE self);
|
84
|
+
VALUE rb_split(VALUE self);
|
85
|
+
VALUE rb_merge(VALUE klass, VALUE args);
|
86
|
+
VALUE rb_mix_channels(int argc, VALUE *argv, VALUE klass);
|
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_div(int argc, VALUE *argv, VALUE self);
|
97
|
+
VALUE rb_and(int argc, VALUE *argv, VALUE self);
|
98
|
+
VALUE rb_or(int argc, VALUE *argv, VALUE self);
|
99
|
+
VALUE rb_xor(int argc, VALUE *argv, VALUE self);
|
100
|
+
VALUE rb_not(VALUE self);
|
101
|
+
VALUE rb_not_bang(VALUE self);
|
102
|
+
VALUE rb_cmp_internal(VALUE self, VALUE val, int operand);
|
103
|
+
VALUE rb_eq(VALUE self, VALUE val);
|
104
|
+
VALUE rb_gt(VALUE self, VALUE val);
|
105
|
+
VALUE rb_ge(VALUE self, VALUE val);
|
106
|
+
VALUE rb_lt(VALUE self, VALUE val);
|
107
|
+
VALUE rb_le(VALUE self, VALUE val);
|
108
|
+
VALUE rb_ne(VALUE self, VALUE val);
|
109
|
+
VALUE rb_in_range(VALUE self, VALUE min, VALUE max);
|
110
|
+
VALUE rb_abs_diff(VALUE self, VALUE val);
|
111
|
+
/* Statistics */
|
112
|
+
VALUE rb_count_non_zero(VALUE self);
|
113
|
+
VALUE rb_sum(VALUE self);
|
114
|
+
VALUE rb_avg(int argc, VALUE *argv, VALUE self);
|
115
|
+
VALUE rb_avg_sdv(int argc, VALUE *argv, VALUE self);
|
116
|
+
VALUE rb_sdv(int argc, VALUE *argv, VALUE self);
|
117
|
+
VALUE rb_min_max_loc(int argc, VALUE *argv, VALUE self);
|
118
|
+
|
119
|
+
//VALUE rb_norm();
|
120
|
+
VALUE rb_dot_product(VALUE self, VALUE mat);
|
121
|
+
VALUE rb_cross_product(VALUE self, VALUE mat);
|
122
|
+
// VALUE rb_gemm();
|
123
|
+
VALUE rb_transform(int argc, VALUE *argv, VALUE self);
|
124
|
+
VALUE rb_perspective_transform(VALUE self, VALUE mat);
|
125
|
+
VALUE rb_mul_transposed(VALUE self, VALUE args);
|
126
|
+
VALUE rb_trace(VALUE self);
|
127
|
+
VALUE rb_transpose(VALUE self);
|
128
|
+
VALUE rb_transpose_bang(VALUE self);
|
129
|
+
VALUE rb_det(VALUE self);
|
130
|
+
VALUE rb_invert(int argc, VALUE *argv, VALUE self);
|
131
|
+
VALUE rb_solve(int argc, VALUE *argv, VALUE self);
|
132
|
+
VALUE rb_svd(int argc, VALUE *argv, VALUE self);
|
133
|
+
VALUE rb_svbksb(int argc, VALUE *argv, VALUE self);
|
134
|
+
VALUE rb_eigenvv(int argc, VALUE *argv, VALUE self);
|
135
|
+
VALUE rb_eigenvv_bang(int argc, VALUE *argv, VALUE self);
|
136
|
+
VALUE rb_calc_covar_matrix(int argc, VALUE *argv, VALUE self);
|
137
|
+
VALUE rb_mahalonobis(int argc, VALUE *argv, VALUE self);
|
138
|
+
|
139
|
+
VALUE rb_dft(int argc, VALUE *argv, VALUE self);
|
140
|
+
//VALUE rb_optimal_dft_size(VALUE self);
|
141
|
+
//VALUE rb_mul_spectrums(int argc, VALUE *argv, VALUE self);
|
142
|
+
VALUE rb_dct(int argc, VALUE *argv, VALUE self);
|
143
|
+
|
144
|
+
/* drawing function*/
|
145
|
+
VALUE rb_line(int argc, VALUE *argv, VALUE self);
|
146
|
+
VALUE rb_line_bang(int argc, VALUE *argv, VALUE self);
|
147
|
+
VALUE rb_rectangle(int argc, VALUE *argv, VALUE self);
|
148
|
+
VALUE rb_rectangle_bang(int argc, VALUE *argv, VALUE self);
|
149
|
+
VALUE rb_circle(int argc, VALUE *argv, VALUE self);
|
150
|
+
VALUE rb_circle_bang(int argc, VALUE *argv, VALUE self);
|
151
|
+
VALUE rb_ellipse(int argc, VALUE *argv, VALUE self);
|
152
|
+
VALUE rb_ellipse_bang(int argc, VALUE *argv, VALUE self);
|
153
|
+
VALUE rb_ellipse_box(int argc, VALUE *argv, VALUE self);
|
154
|
+
VALUE rb_ellipse_box_bang(int argc, VALUE *argv, VALUE self);
|
155
|
+
VALUE rb_fill_poly(int argc, VALUE *argv, VALUE self);
|
156
|
+
VALUE rb_fill_poly_bang(int argc, VALUE *argv, VALUE self);
|
157
|
+
VALUE rb_fill_convex_poly(int argc, VALUE *argv, VALUE self);
|
158
|
+
VALUE rb_fill_convex_poly_bang(int argc, VALUE *argv, VALUE self);
|
159
|
+
VALUE rb_poly_line(int argc, VALUE *argv, VALUE self);
|
160
|
+
VALUE rb_poly_line_bang(int argc, VALUE *argv, VALUE self);
|
161
|
+
|
162
|
+
VALUE rb_put_text(int argc, VALUE *argv, VALUE self);
|
163
|
+
VALUE rb_put_text_bang(int argc, VALUE *argv, VALUE self);
|
164
|
+
/* cv function */
|
165
|
+
VALUE rb_sobel(int argc, VALUE *argv, VALUE self);
|
166
|
+
VALUE rb_laplace(int argc, VALUE *argv, VALUE self);
|
167
|
+
VALUE rb_canny(int argc, VALUE *argv, VALUE self);
|
168
|
+
VALUE rb_pre_corner_detect(int argc, VALUE *argv, VALUE self);
|
169
|
+
VALUE rb_corner_eigenvv(int argc, VALUE *argv, VALUE self);
|
170
|
+
VALUE rb_corner_min_eigen_val(int argc, VALUE *argv, VALUE self);
|
171
|
+
VALUE rb_corner_harris(int argc, VALUE *argv, VALUE self);
|
172
|
+
VALUE rbi_find_corner_sub_pix(int argc, VALUE *argv, VALUE self);
|
173
|
+
VALUE rb_good_features_to_track(int argc, VALUE *argv, VALUE self);
|
174
|
+
|
175
|
+
VALUE rb_sample_line(int argc, VALUE *argv, VALUE self);
|
176
|
+
VALUE rb_rect_sub_pix(VALUE self, VALUE center, VALUE size);
|
177
|
+
VALUE rb_quadrangle_sub_pix(VALUE self, VALUE map_matrix, VALUE size);
|
178
|
+
VALUE rb_resize(int argc, VALUE *argv, VALUE self);
|
179
|
+
VALUE rb_warp_affine(int argc, VALUE *argv, VALUE self);
|
180
|
+
VALUE rb_rotation(VALUE self, VALUE center, VALUE angle, VALUE scale);
|
181
|
+
VALUE rb_warp_perspective(int argc, VALUE *argv, VALUE self);
|
182
|
+
//VALUE rb_perspective_transform();
|
183
|
+
VALUE rb_remap(int argc, VALUE *argv, VALUE self);
|
184
|
+
VALUE rb_log_polar(int argc, VALUE *argv);
|
185
|
+
|
186
|
+
VALUE rb_erode(int argc, VALUE *argv, VALUE self);
|
187
|
+
VALUE rb_erode_bang(int argc, VALUE *argv, VALUE self);
|
188
|
+
VALUE rb_dilate(int argc, VALUE *argv, VALUE self);
|
189
|
+
VALUE rb_dilate_bang(int argc, VALUE *argv, VALUE self);
|
190
|
+
VALUE rb_morphology_open(int argc, VALUE *argv, VALUE self);
|
191
|
+
VALUE rb_morphology_close(int argc, VALUE *argv, VALUE self);
|
192
|
+
VALUE rb_morphology_gradient(int argc, VALUE *argv, VALUE self);
|
193
|
+
VALUE rb_morphology_tophat(int argc, VALUE *argv, VALUE self);
|
194
|
+
VALUE rb_morphology_blackhat(int argc, VALUE *argv, VALUE self);
|
195
|
+
|
196
|
+
VALUE rb_smooth_blur_no_scale(int argc, VALUE *argv, VALUE self);
|
197
|
+
VALUE rb_smooth_blur(int argc, VALUE *argv, VALUE self);
|
198
|
+
VALUE rb_smooth_gaussian(int argc, VALUE *argv, VALUE self);
|
199
|
+
VALUE rb_smooth_median(int argc, VALUE *argv, VALUE self);
|
200
|
+
VALUE rb_smooth_bilateral(int argc, VALUE *argv, VALUE self);
|
201
|
+
VALUE rb_filter2d(int argc, VALUE *argv, VALUE self);
|
202
|
+
VALUE rb_copy_make_border_constant(int argc, VALUE *argv, VALUE self);
|
203
|
+
VALUE rb_copy_make_border_replicate(int argc, VALUE *argv, VALUE self);
|
204
|
+
VALUE rb_integral(int argc, VALUE *argv, VALUE self);
|
205
|
+
VALUE rb_threshold_binary(int argc, VALUE *argv, VALUE self);
|
206
|
+
VALUE rb_threshold_binary_inverse(int argc, VALUE *argv, VALUE self);
|
207
|
+
VALUE rb_threshold_trunc(int argc, VALUE *argv, VALUE self);
|
208
|
+
VALUE rb_threshold_to_zero(int argc, VALUE *argv, VALUE self);
|
209
|
+
VALUE rb_threshold_to_zero_inverse(int argc, VALUE *argv, VALUE self);
|
210
|
+
VALUE rb_adaptive_threshold(int argc, VALUE *argv, VALUE self);
|
211
|
+
|
212
|
+
VALUE rb_pyr_down(int argc, VALUE *argv, VALUE self);
|
213
|
+
VALUE rb_pyr_up(int argc, VALUE *argv, VALUE self);
|
214
|
+
|
215
|
+
VALUE rb_flood_fill(int argc, VALUE *argv, VALUE self);
|
216
|
+
VALUE rb_flood_fill_bang(int argc, VALUE *argv, VALUE self);
|
217
|
+
VALUE rb_find_contours(int argc, VALUE *argv, VALUE self);
|
218
|
+
VALUE rb_find_contours_bang(int argc, VALUE *argv, VALUE self);
|
219
|
+
VALUE rb_pyr_segmentation(int argc, VALUE *argv, VALUE self);
|
220
|
+
VALUE rb_pyr_mean_shift_filtering(int argc, VALUE *argv, VALUE self);
|
221
|
+
VALUE rb_watershed(VALUE self);
|
222
|
+
|
223
|
+
VALUE rb_moments(int argc, VALUE *argv, VALUE self);
|
224
|
+
|
225
|
+
VALUE rb_hough_lines_standard(int argc, VALUE *argv, VALUE self);
|
226
|
+
VALUE rb_hough_lines_probabilistic(int argc, VALUE *argv, VALUE self);
|
227
|
+
VALUE rb_hough_lines_multi_scale(int argc, VALUE *argv, VALUE self);
|
228
|
+
VALUE rb_hough_circles_gradient(int argc, VALUE *argv, VALUE self);
|
229
|
+
VALUE rb_dist_transform(int argc, VALUE *argv, VALUE self);
|
230
|
+
VALUE rb_inpaint_ns(VALUE self, VALUE mask, VALUE radius);
|
231
|
+
VALUE rb_inpaint_telea(VALUE self, VALUE mask, VALUE radius);
|
232
|
+
|
233
|
+
VALUE rb_equalize_hist(VALUE self);
|
234
|
+
/* Matching*/
|
235
|
+
VALUE rb_match_template(int argc, VALUE *argv, VALUE self);
|
236
|
+
VALUE rb_match_shapes_i1(int argc, VALUE *argv, VALUE self);
|
237
|
+
VALUE rb_match_shapes_i2(int argc, VALUE *argv, VALUE self);
|
238
|
+
VALUE rb_match_shapes_i3(int argc, VALUE *argv, VALUE self);
|
239
|
+
// VALUE rb_calc_emd(int argc, VALUE *argv, VALUE self);
|
240
|
+
/* Object Tracking */
|
241
|
+
VALUE rb_mean_shift(VALUE self, VALUE window, VALUE criteria);
|
242
|
+
VALUE rb_cam_shift(VALUE self, VALUE window, VALUE criteria);
|
243
|
+
VALUE rb_snake_image(int argc, VALUE *argv, VALUE self);
|
244
|
+
/* Optical Flow */
|
245
|
+
VALUE rb_optical_flow_hs(int argc, VALUE *argv, VALUE self);
|
246
|
+
VALUE rb_optical_flow_lk(int argc, VALUE *argv, VALUE self);
|
247
|
+
VALUE rb_optical_flow_bm(int argc, VALUE *argv, VALUE self);
|
248
|
+
VALUE rb_optical_flow_pyr_lk(int argc, VALUE *argv, VALUE self);
|
249
|
+
|
250
|
+
/* Epipolar Geometory */
|
251
|
+
VALUE rb_find_fundamental_mat_7point(int argc, VALUE *argv, VALUE klass);
|
252
|
+
VALUE rb_find_fundamental_mat_8point(int argc, VALUE *argv, VALUE klass);
|
253
|
+
VALUE rb_find_fundamental_mat_ransac(int argc, VALUE *argv, VALUE klass);
|
254
|
+
VALUE rb_find_fundamental_mat_lmeds(int argc, VALUE *argv, VALUE klass);
|
255
|
+
VALUE rb_compute_correspond_epilines(VALUE klass, VALUE points, VALUE which_image, VALUE fundamental_matrix);
|
256
|
+
|
257
|
+
// HighGUI function
|
258
|
+
VALUE rb_save_image(VALUE self, VALUE filename);
|
259
|
+
|
260
|
+
VALUE new_object(int rows, int cols, int type);
|
261
|
+
VALUE new_object(CvSize size, int type);
|
262
|
+
|
263
|
+
__NAMESPACE_END_CVMAT
|
264
|
+
|
265
|
+
inline CvMat*
|
266
|
+
CVMAT(VALUE object)
|
267
|
+
{
|
268
|
+
CvMat *ptr, stub;
|
269
|
+
Data_Get_Struct(object, CvMat, ptr);
|
270
|
+
return cvGetMat(ptr, &stub);
|
271
|
+
}
|
272
|
+
|
273
|
+
inline CvMat*
|
274
|
+
MASK(VALUE object)
|
275
|
+
{
|
276
|
+
if(NIL_P(object))
|
277
|
+
return NULL;
|
278
|
+
else if(rb_obj_is_kind_of(object, cCvMat::rb_class()) && CV_MAT_CN(CVMAT(object)->type) == CV_8UC1)
|
279
|
+
return CVMAT(object);
|
280
|
+
else
|
281
|
+
rb_raise(rb_eTypeError, "object is not mask.");
|
282
|
+
}
|
283
|
+
|
284
|
+
__NAMESPACE_END_OPENCV
|
285
|
+
|
286
|
+
#endif // RUBY_OPENCV_CVMAT_H
|
data/ext/cvmatnd.cpp
ADDED
@@ -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
|
+
|
data/ext/cvmatnd.h
ADDED
@@ -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,64 @@
|
|
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
|
+
//rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
40
|
+
}
|
41
|
+
|
42
|
+
VALUE
|
43
|
+
rb_allocate(VALUE klass)
|
44
|
+
{
|
45
|
+
CvMemStorage *storage = cvCreateMemStorage();
|
46
|
+
return Data_Wrap_Struct(klass, 0, free, storage);
|
47
|
+
}
|
48
|
+
|
49
|
+
void
|
50
|
+
free(void *ptr)
|
51
|
+
{
|
52
|
+
cvReleaseMemStorage((CvMemStorage**)&ptr);
|
53
|
+
}
|
54
|
+
|
55
|
+
VALUE
|
56
|
+
new_object(int blocksize)
|
57
|
+
{
|
58
|
+
CvMemStorage *storage = cvCreateMemStorage(blocksize);
|
59
|
+
return Data_Wrap_Struct(rb_klass, 0, free, storage);
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
__NAMESPACE_END_CVMEMSTORAGE
|
64
|
+
__NAMESPACE_END_OPENCV
|
data/ext/cvmemstorage.h
ADDED
@@ -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 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
|