ruby-opencv 0.0.11 → 0.0.12.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.yardopts +3 -0
  4. data/Gemfile +1 -0
  5. data/Manifest.txt +2 -14
  6. data/README.md +1 -1
  7. data/Rakefile +10 -1
  8. data/examples/facerec/facerec_lbph.rb +1 -1
  9. data/ext/opencv/algorithm.cpp +6 -1
  10. data/ext/opencv/algorithm.h +1 -1
  11. data/ext/opencv/curve.cpp +48 -33
  12. data/ext/opencv/curve.h +1 -1
  13. data/ext/opencv/cvavgcomp.cpp +22 -25
  14. data/ext/opencv/cvavgcomp.h +1 -1
  15. data/ext/opencv/cvbox2d.cpp +56 -58
  16. data/ext/opencv/cvbox2d.h +1 -1
  17. data/ext/opencv/cvcapture.cpp +210 -109
  18. data/ext/opencv/cvcapture.h +1 -1
  19. data/ext/opencv/cvchain.cpp +71 -71
  20. data/ext/opencv/cvchain.h +1 -1
  21. data/ext/opencv/cvcircle32f.cpp +37 -27
  22. data/ext/opencv/cvcircle32f.h +1 -1
  23. data/ext/opencv/cvconnectedcomp.cpp +49 -36
  24. data/ext/opencv/cvconnectedcomp.h +1 -1
  25. data/ext/opencv/cvcontour.cpp +117 -81
  26. data/ext/opencv/cvcontour.h +1 -1
  27. data/ext/opencv/cvcontourtree.cpp +37 -32
  28. data/ext/opencv/cvcontourtree.h +1 -1
  29. data/ext/opencv/cvconvexitydefect.cpp +33 -44
  30. data/ext/opencv/cvconvexitydefect.h +1 -1
  31. data/ext/opencv/cverror.cpp +22 -66
  32. data/ext/opencv/cverror.h +1 -1
  33. data/ext/opencv/cvfeaturetree.cpp +31 -33
  34. data/ext/opencv/cvfeaturetree.h +1 -1
  35. data/ext/opencv/cvfont.cpp +98 -78
  36. data/ext/opencv/cvfont.h +1 -1
  37. data/ext/opencv/cvhaarclassifiercascade.cpp +39 -59
  38. data/ext/opencv/cvhaarclassifiercascade.h +1 -1
  39. data/ext/opencv/cvhistogram.cpp +259 -90
  40. data/ext/opencv/cvhistogram.h +1 -1
  41. data/ext/opencv/cvhumoments.cpp +99 -60
  42. data/ext/opencv/cvhumoments.h +1 -1
  43. data/ext/opencv/cvline.cpp +45 -40
  44. data/ext/opencv/cvline.h +1 -1
  45. data/ext/opencv/cvmat.cpp +1894 -1829
  46. data/ext/opencv/cvmat.h +2 -3
  47. data/ext/opencv/cvmemstorage.cpp +19 -14
  48. data/ext/opencv/cvmemstorage.h +1 -1
  49. data/ext/opencv/cvmoments.cpp +51 -45
  50. data/ext/opencv/cvmoments.h +1 -1
  51. data/ext/opencv/cvpoint.cpp +32 -26
  52. data/ext/opencv/cvpoint.h +1 -1
  53. data/ext/opencv/cvpoint2d32f.cpp +31 -26
  54. data/ext/opencv/cvpoint2d32f.h +1 -1
  55. data/ext/opencv/cvpoint3d32f.cpp +36 -29
  56. data/ext/opencv/cvpoint3d32f.h +1 -1
  57. data/ext/opencv/cvrect.cpp +38 -33
  58. data/ext/opencv/cvrect.h +1 -1
  59. data/ext/opencv/cvscalar.cpp +50 -45
  60. data/ext/opencv/cvscalar.h +1 -1
  61. data/ext/opencv/cvseq.cpp +53 -47
  62. data/ext/opencv/cvseq.h +1 -1
  63. data/ext/opencv/cvsize.cpp +32 -26
  64. data/ext/opencv/cvsize.h +1 -1
  65. data/ext/opencv/cvsize2d32f.cpp +31 -25
  66. data/ext/opencv/cvsize2d32f.h +1 -1
  67. data/ext/opencv/cvslice.cpp +28 -22
  68. data/ext/opencv/cvslice.h +1 -1
  69. data/ext/opencv/cvsurfparams.cpp +37 -28
  70. data/ext/opencv/cvsurfparams.h +1 -1
  71. data/ext/opencv/cvsurfpoint.cpp +76 -53
  72. data/ext/opencv/cvsurfpoint.h +1 -1
  73. data/ext/opencv/cvtermcriteria.cpp +32 -26
  74. data/ext/opencv/cvtermcriteria.h +1 -1
  75. data/ext/opencv/cvtwopoints.cpp +28 -22
  76. data/ext/opencv/cvtwopoints.h +1 -1
  77. data/ext/opencv/cvvideowriter.cpp +25 -20
  78. data/ext/opencv/cvvideowriter.h +1 -1
  79. data/ext/opencv/eigenfaces.cpp +10 -2
  80. data/ext/opencv/eigenfaces.h +1 -1
  81. data/ext/opencv/facerecognizer.cpp +15 -8
  82. data/ext/opencv/facerecognizer.h +2 -2
  83. data/ext/opencv/fisherfaces.cpp +10 -2
  84. data/ext/opencv/fisherfaces.h +1 -1
  85. data/ext/opencv/gui.cpp +26 -23
  86. data/ext/opencv/gui.h +1 -1
  87. data/ext/opencv/iplconvkernel.cpp +30 -24
  88. data/ext/opencv/iplconvkernel.h +1 -1
  89. data/ext/opencv/iplimage.cpp +49 -42
  90. data/ext/opencv/iplimage.h +1 -1
  91. data/ext/opencv/lbph.cpp +10 -2
  92. data/ext/opencv/lbph.h +1 -1
  93. data/ext/opencv/mouseevent.cpp +30 -25
  94. data/ext/opencv/mouseevent.h +1 -1
  95. data/ext/opencv/opencv.cpp +59 -60
  96. data/ext/opencv/opencv.h +1 -5
  97. data/ext/opencv/pointset.cpp +31 -25
  98. data/ext/opencv/pointset.h +1 -1
  99. data/ext/opencv/trackbar.cpp +27 -21
  100. data/ext/opencv/trackbar.h +1 -1
  101. data/ext/opencv/window.cpp +77 -57
  102. data/ext/opencv/window.h +1 -1
  103. data/lib/opencv/version.rb +2 -1
  104. data/ruby-opencv.gemspec +19 -18
  105. data/test/test_opencv.rb +5 -3
  106. data/yard_extension.rb +5 -0
  107. metadata +13 -27
  108. data/examples/matching_to_many_images/matching_to_many_images.rb +0 -16
  109. data/examples/matching_to_many_images/query.png +0 -0
  110. data/examples/matching_to_many_images/train/1.png +0 -0
  111. data/examples/matching_to_many_images/train/2.png +0 -0
  112. data/examples/matching_to_many_images/train/3.png +0 -0
  113. data/examples/matching_to_many_images/train/trainImages.txt +0 -3
  114. data/ext/opencv/cvcondensation.cpp +0 -282
  115. data/ext/opencv/cvcondensation.h +0 -49
  116. data/ext/opencv/cvmatnd.cpp +0 -44
  117. data/ext/opencv/cvmatnd.h +0 -28
  118. data/ext/opencv/cvsparsemat.cpp +0 -44
  119. data/ext/opencv/cvsparsemat.h +0 -28
  120. data/images/face_detect_from_lena.jpg +0 -0
  121. data/test/test_cvmat_matching.rb +0 -57
@@ -21,7 +21,7 @@ __NAMESPACE_BEGIN_CVMAT
21
21
 
22
22
  VALUE rb_class();
23
23
 
24
- void define_ruby_class();
24
+ void init_ruby_class();
25
25
 
26
26
  VALUE rb_allocate(VALUE klass);
27
27
  VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
@@ -177,7 +177,7 @@ VALUE rb_warp_affine(int argc, VALUE *argv, VALUE self);
177
177
  VALUE rb_rotation_matrix2D(VALUE self, VALUE center, VALUE angle, VALUE scale);
178
178
  VALUE rb_get_perspective_transform(VALUE self, VALUE source, VALUE dest);
179
179
  VALUE rb_warp_perspective(int argc, VALUE *argv, VALUE self);
180
- VALUE rb_find_homograpy(int argc, VALUE *argv, VALUE self);
180
+ VALUE rb_find_homography(int argc, VALUE *argv, VALUE self);
181
181
  VALUE rb_remap(int argc, VALUE *argv, VALUE self);
182
182
  VALUE rb_log_polar(int argc, VALUE *argv, VALUE self);
183
183
 
@@ -221,7 +221,6 @@ VALUE rb_apply_color_map(VALUE self, VALUE colormap);
221
221
  /* Matching*/
222
222
  VALUE rb_match_template(int argc, VALUE *argv, VALUE self);
223
223
  VALUE rb_match_shapes(int argc, VALUE *argv, VALUE self);
224
- VALUE rb_match_descriptors(int argc, VALUE *argv, VALUE self);
225
224
 
226
225
  /* Object Tracking */
227
226
  VALUE rb_mean_shift(VALUE self, VALUE window, VALUE criteria);
@@ -24,20 +24,6 @@ rb_class()
24
24
  return rb_klass;
25
25
  }
26
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
27
  VALUE
42
28
  rb_allocate(VALUE klass)
43
29
  {
@@ -63,6 +49,25 @@ new_object(int blocksize)
63
49
  return Data_Wrap_Struct(rb_klass, 0, cvmemstorage_free, storage);
64
50
  }
65
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
+ }
66
70
 
67
71
  __NAMESPACE_END_CVMEMSTORAGE
68
72
  __NAMESPACE_END_OPENCV
73
+
@@ -18,7 +18,7 @@
18
18
  __NAMESPACE_BEGIN_OPENCV
19
19
  __NAMESPACE_BEGIN_CVMEMSTORAGE
20
20
 
21
- void define_ruby_class();
21
+ void init_ruby_class();
22
22
 
23
23
  VALUE rb_class();
24
24
  VALUE rb_allocate(VALUE klass);
@@ -30,50 +30,6 @@ rb_class()
30
30
  return rb_klass;
31
31
  }
32
32
 
33
- void
34
- define_ruby_class()
35
- {
36
- if (rb_klass)
37
- return;
38
- /*
39
- * opencv = rb_define_module("OpenCV");
40
- *
41
- * note: this comment is used by rdoc.
42
- */
43
- VALUE opencv = rb_module_opencv();
44
-
45
- rb_klass = rb_define_class_under(opencv, "CvMoments", rb_cObject);
46
- rb_define_alloc_func(rb_klass, rb_allocate);
47
- rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
48
- rb_define_method(rb_klass, "spatial", RUBY_METHOD_FUNC(rb_spatial), 2);
49
- rb_define_method(rb_klass, "central", RUBY_METHOD_FUNC(rb_central), 2);
50
- rb_define_method(rb_klass, "normalized_central", RUBY_METHOD_FUNC(rb_normalized_central), 2);
51
- rb_define_method(rb_klass, "hu", RUBY_METHOD_FUNC(rb_hu), 0);
52
- rb_define_method(rb_klass, "gravity_center", RUBY_METHOD_FUNC(rb_gravity_center), 0);
53
- rb_define_method(rb_klass, "angle", RUBY_METHOD_FUNC(rb_angle), 0);
54
-
55
- DEFINE_CVMOMENTS_ACCESSOR(m00);
56
- DEFINE_CVMOMENTS_ACCESSOR(m10);
57
- DEFINE_CVMOMENTS_ACCESSOR(m01);
58
- DEFINE_CVMOMENTS_ACCESSOR(m20);
59
- DEFINE_CVMOMENTS_ACCESSOR(m11);
60
- DEFINE_CVMOMENTS_ACCESSOR(m02);
61
- DEFINE_CVMOMENTS_ACCESSOR(m30);
62
- DEFINE_CVMOMENTS_ACCESSOR(m21);
63
- DEFINE_CVMOMENTS_ACCESSOR(m12);
64
- DEFINE_CVMOMENTS_ACCESSOR(m03);
65
-
66
- DEFINE_CVMOMENTS_ACCESSOR(mu20);
67
- DEFINE_CVMOMENTS_ACCESSOR(mu11);
68
- DEFINE_CVMOMENTS_ACCESSOR(mu02);
69
- DEFINE_CVMOMENTS_ACCESSOR(mu30);
70
- DEFINE_CVMOMENTS_ACCESSOR(mu21);
71
- DEFINE_CVMOMENTS_ACCESSOR(mu12);
72
- DEFINE_CVMOMENTS_ACCESSOR(mu03);
73
-
74
- DEFINE_CVMOMENTS_ACCESSOR(inv_sqrt_m00);
75
- }
76
-
77
33
  VALUE
78
34
  rb_allocate(VALUE klass)
79
35
  {
@@ -82,7 +38,7 @@ rb_allocate(VALUE klass)
82
38
  }
83
39
  /*
84
40
  * call-seq:
85
- * CvMoments.new(<i>src[,is_binary = nil]</i>)
41
+ * CvMoments.new(src[,is_binary = nil])
86
42
  *
87
43
  * Calculates all moments up to third order of a polygon or rasterized shape.
88
44
  * <i>src</i> should be CvMat or CvPolygon.
@@ -283,5 +239,55 @@ new_object(CvArr *arr, int is_binary = 0)
283
239
  return object;
284
240
  }
285
241
 
242
+ void
243
+ init_ruby_class()
244
+ {
245
+ #if 0
246
+ // For documentation using YARD
247
+ VALUE opencv = rb_define_module("OpenCV");
248
+ #endif
249
+
250
+ if (rb_klass)
251
+ return;
252
+ /*
253
+ * opencv = rb_define_module("OpenCV");
254
+ *
255
+ * note: this comment is used by rdoc.
256
+ */
257
+ VALUE opencv = rb_module_opencv();
258
+
259
+ rb_klass = rb_define_class_under(opencv, "CvMoments", rb_cObject);
260
+ rb_define_alloc_func(rb_klass, rb_allocate);
261
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
262
+ rb_define_method(rb_klass, "spatial", RUBY_METHOD_FUNC(rb_spatial), 2);
263
+ rb_define_method(rb_klass, "central", RUBY_METHOD_FUNC(rb_central), 2);
264
+ rb_define_method(rb_klass, "normalized_central", RUBY_METHOD_FUNC(rb_normalized_central), 2);
265
+ rb_define_method(rb_klass, "hu", RUBY_METHOD_FUNC(rb_hu), 0);
266
+ rb_define_method(rb_klass, "gravity_center", RUBY_METHOD_FUNC(rb_gravity_center), 0);
267
+ rb_define_method(rb_klass, "angle", RUBY_METHOD_FUNC(rb_angle), 0);
268
+
269
+ DEFINE_CVMOMENTS_ACCESSOR(m00);
270
+ DEFINE_CVMOMENTS_ACCESSOR(m10);
271
+ DEFINE_CVMOMENTS_ACCESSOR(m01);
272
+ DEFINE_CVMOMENTS_ACCESSOR(m20);
273
+ DEFINE_CVMOMENTS_ACCESSOR(m11);
274
+ DEFINE_CVMOMENTS_ACCESSOR(m02);
275
+ DEFINE_CVMOMENTS_ACCESSOR(m30);
276
+ DEFINE_CVMOMENTS_ACCESSOR(m21);
277
+ DEFINE_CVMOMENTS_ACCESSOR(m12);
278
+ DEFINE_CVMOMENTS_ACCESSOR(m03);
279
+
280
+ DEFINE_CVMOMENTS_ACCESSOR(mu20);
281
+ DEFINE_CVMOMENTS_ACCESSOR(mu11);
282
+ DEFINE_CVMOMENTS_ACCESSOR(mu02);
283
+ DEFINE_CVMOMENTS_ACCESSOR(mu30);
284
+ DEFINE_CVMOMENTS_ACCESSOR(mu21);
285
+ DEFINE_CVMOMENTS_ACCESSOR(mu12);
286
+ DEFINE_CVMOMENTS_ACCESSOR(mu03);
287
+
288
+ DEFINE_CVMOMENTS_ACCESSOR(inv_sqrt_m00);
289
+ }
290
+
286
291
  __NAMESPACE_END_CVMOMENTS
287
292
  __NAMESPACE_END_OPENCV
293
+
@@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVMOMENTS
20
20
 
21
21
  VALUE rb_class();
22
22
 
23
- void define_ruby_class();
23
+ void init_ruby_class();
24
24
 
25
25
  VALUE rb_allocate(VALUE klass);
26
26
  VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
@@ -31,32 +31,6 @@ rb_class()
31
31
  return rb_klass;
32
32
  }
33
33
 
34
- void
35
- define_ruby_class()
36
- {
37
- if (rb_klass)
38
- return;
39
- /*
40
- * opencv = rb_define_module("OpenCV");
41
- *
42
- * note: this comment is used by rdoc.
43
- */
44
- VALUE opencv = rb_module_opencv();
45
-
46
- rb_klass = rb_define_class_under(opencv, "CvPoint", rb_cObject);
47
- rb_define_alloc_func(rb_klass, rb_allocate);
48
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
49
- rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
50
- rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
51
- rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
52
- rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
53
- rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
54
-
55
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
56
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
57
- rb_define_alias(rb_klass, "to_a", "to_ary");
58
- }
59
-
60
34
  /*
61
35
  * call-seq:
62
36
  * combatible?(obj)
@@ -224,5 +198,37 @@ new_object(CvPoint point)
224
198
  return object;
225
199
  }
226
200
 
201
+ void
202
+ init_ruby_class()
203
+ {
204
+ #if 0
205
+ // For documentation using YARD
206
+ VALUE opencv = rb_define_module("OpenCV");
207
+ #endif
208
+
209
+ if (rb_klass)
210
+ return;
211
+ /*
212
+ * opencv = rb_define_module("OpenCV");
213
+ *
214
+ * note: this comment is used by rdoc.
215
+ */
216
+ VALUE opencv = rb_module_opencv();
217
+
218
+ rb_klass = rb_define_class_under(opencv, "CvPoint", rb_cObject);
219
+ rb_define_alloc_func(rb_klass, rb_allocate);
220
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
221
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
222
+ rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
223
+ rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
224
+ rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
225
+ rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
226
+
227
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
228
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
229
+ rb_define_alias(rb_klass, "to_a", "to_ary");
230
+ }
231
+
227
232
  __NAMESPACE_END_CVPOINT
228
233
  __NAMESPACE_END_OPENCV
234
+
@@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVPOINT
20
20
 
21
21
  VALUE rb_class();
22
22
 
23
- void define_ruby_class();
23
+ void init_ruby_class();
24
24
 
25
25
  VALUE rb_compatible_q(VALUE klass, VALUE object);
26
26
 
@@ -31,32 +31,6 @@ rb_class()
31
31
  return rb_klass;
32
32
  }
33
33
 
34
- void
35
- define_ruby_class()
36
- {
37
- if (rb_klass)
38
- return;
39
- /*
40
- * opencv = rb_define_module("OpenCV");
41
- *
42
- * note: this comment is used by rdoc.
43
- */
44
- VALUE opencv = rb_module_opencv();
45
-
46
- rb_klass = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
47
- rb_define_alloc_func(rb_klass, rb_allocate);
48
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
49
- rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
50
- rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
51
- rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
52
- rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
53
- rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
54
-
55
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
56
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
57
- rb_define_alias(rb_klass, "to_a", "to_ary");
58
- }
59
-
60
34
  /*
61
35
  * call-seq:
62
36
  * combatible?(obj)
@@ -207,5 +181,36 @@ new_object(CvPoint2D32f point)
207
181
  return object;
208
182
  }
209
183
 
184
+ void
185
+ init_ruby_class()
186
+ {
187
+ #if 0
188
+ // For documentation using YARD
189
+ VALUE opencv = rb_define_module("OpenCV");
190
+ #endif
191
+
192
+ if (rb_klass)
193
+ return;
194
+ /*
195
+ * opencv = rb_define_module("OpenCV");
196
+ *
197
+ * note: this comment is used by rdoc.
198
+ */
199
+ VALUE opencv = rb_module_opencv();
200
+
201
+ rb_klass = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
202
+ rb_define_alloc_func(rb_klass, rb_allocate);
203
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
204
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
205
+ rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
206
+ rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
207
+ rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
208
+ rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
209
+
210
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
211
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
212
+ rb_define_alias(rb_klass, "to_a", "to_ary");
213
+ }
214
+
210
215
  __NAMESPACE_END_CVPOINT2D32F
211
216
  __NAMESPACE_END_OPENCV
@@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVPOINT2D32F
20
20
 
21
21
  VALUE rb_class();
22
22
 
23
- void define_ruby_class();
23
+ void init_ruby_class();
24
24
 
25
25
  VALUE rb_compatible_q(VALUE klass, VALUE object);
26
26
 
@@ -32,35 +32,6 @@ rb_class()
32
32
  return rb_klass;
33
33
  }
34
34
 
35
- void
36
- define_ruby_class()
37
- {
38
- if (rb_klass)
39
- return;
40
- /*
41
- * opencv = rb_define_module("OpenCV");
42
- * cvpoint2d32f = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
43
- *
44
- * note: this comment is used by rdoc.
45
- */
46
- VALUE opencv = rb_module_opencv();
47
- VALUE cvpoint2d32f = cCvPoint2D32f::rb_class();
48
- rb_klass = rb_define_class_under(opencv, "CvPoint3D32f", cvpoint2d32f);
49
- rb_define_alloc_func(rb_klass, rb_allocate);
50
- rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
51
- rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
52
- rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
53
- rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
54
- rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
55
- rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
56
- rb_define_method(rb_klass, "z", RUBY_METHOD_FUNC(rb_z), 0);
57
- rb_define_method(rb_klass, "z=", RUBY_METHOD_FUNC(rb_set_z), 1);
58
-
59
- rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
60
- rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
61
- rb_define_alias(rb_klass, "to_a", "to_ary");
62
- }
63
-
64
35
  /*
65
36
  * call-seq:
66
37
  * combatible?(obj)
@@ -241,5 +212,41 @@ new_object(CvPoint3D32f point)
241
212
  return object;
242
213
  }
243
214
 
215
+ void
216
+ init_ruby_class()
217
+ {
218
+ #if 0
219
+ // For documentation using YARD
220
+ VALUE opencv = rb_define_module("OpenCV");
221
+ VALUE cvpoint2d32f = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
222
+ #endif
223
+
224
+ if (rb_klass)
225
+ return;
226
+ /*
227
+ * opencv = rb_define_module("OpenCV");
228
+ * cvpoint2d32f = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject);
229
+ *
230
+ * note: this comment is used by rdoc.
231
+ */
232
+ VALUE opencv = rb_module_opencv();
233
+ VALUE cvpoint2d32f = cCvPoint2D32f::rb_class();
234
+ rb_klass = rb_define_class_under(opencv, "CvPoint3D32f", cvpoint2d32f);
235
+ rb_define_alloc_func(rb_klass, rb_allocate);
236
+ rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
237
+ rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
238
+ rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
239
+ rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
240
+ rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
241
+ rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
242
+ rb_define_method(rb_klass, "z", RUBY_METHOD_FUNC(rb_z), 0);
243
+ rb_define_method(rb_klass, "z=", RUBY_METHOD_FUNC(rb_set_z), 1);
244
+
245
+ rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
246
+ rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
247
+ rb_define_alias(rb_klass, "to_a", "to_ary");
248
+ }
249
+
244
250
  __NAMESPACE_END_CVPOINT3D32F
245
251
  __NAMESPACE_END_OPENCV
252
+
@@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVPOINT3D32F
20
20
 
21
21
  VALUE rb_class();
22
22
 
23
- void define_ruby_class();
23
+ void init_ruby_class();
24
24
 
25
25
  VALUE rb_compatible_q(VALUE klass, VALUE object);
26
26