opencv 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. data/History.txt +5 -0
  2. data/License.txt +30 -0
  3. data/Manifest.txt +115 -0
  4. data/README.txt +47 -0
  5. data/Rakefile +34 -0
  6. data/examples/convexhull.rb +41 -0
  7. data/examples/face_detect.rb +25 -0
  8. data/examples/houghcircle.rb +23 -0
  9. data/examples/inpaint.png +0 -0
  10. data/examples/inpaint.rb +43 -0
  11. data/examples/paint.rb +72 -0
  12. data/examples/snake.rb +43 -0
  13. data/examples/stuff.jpg +0 -0
  14. data/ext/curve.cpp +103 -0
  15. data/ext/curve.h +34 -0
  16. data/ext/cvavgcomp.cpp +67 -0
  17. data/ext/cvavgcomp.h +39 -0
  18. data/ext/cvbox2d.cpp +114 -0
  19. data/ext/cvbox2d.h +53 -0
  20. data/ext/cvcapture.cpp +276 -0
  21. data/ext/cvcapture.h +54 -0
  22. data/ext/cvchain.cpp +184 -0
  23. data/ext/cvchain.h +43 -0
  24. data/ext/cvchaincode.cpp +49 -0
  25. data/ext/cvchaincode.h +43 -0
  26. data/ext/cvcircle32f.cpp +90 -0
  27. data/ext/cvcircle32f.h +53 -0
  28. data/ext/cvcondensation.cpp +230 -0
  29. data/ext/cvcondensation.h +49 -0
  30. data/ext/cvconnectedcomp.cpp +115 -0
  31. data/ext/cvconnectedcomp.h +46 -0
  32. data/ext/cvcontour.cpp +219 -0
  33. data/ext/cvcontour.h +47 -0
  34. data/ext/cvcontourtree.cpp +86 -0
  35. data/ext/cvcontourtree.h +41 -0
  36. data/ext/cvconvexitydefect.cpp +103 -0
  37. data/ext/cvconvexitydefect.h +42 -0
  38. data/ext/cverror.cpp +140 -0
  39. data/ext/cverror.h +79 -0
  40. data/ext/cvfont.cpp +173 -0
  41. data/ext/cvfont.h +56 -0
  42. data/ext/cvhaarclassifiercascade.cpp +159 -0
  43. data/ext/cvhaarclassifiercascade.h +41 -0
  44. data/ext/cvhistogram.cpp +200 -0
  45. data/ext/cvhistogram.h +51 -0
  46. data/ext/cvindex.cpp +73 -0
  47. data/ext/cvindex.h +40 -0
  48. data/ext/cvline.cpp +106 -0
  49. data/ext/cvline.h +52 -0
  50. data/ext/cvmat.cpp +4809 -0
  51. data/ext/cvmat.h +286 -0
  52. data/ext/cvmatnd.cpp +44 -0
  53. data/ext/cvmatnd.h +28 -0
  54. data/ext/cvmemstorage.cpp +64 -0
  55. data/ext/cvmemstorage.h +53 -0
  56. data/ext/cvmoments.cpp +204 -0
  57. data/ext/cvmoments.h +48 -0
  58. data/ext/cvpoint.cpp +229 -0
  59. data/ext/cvpoint.h +59 -0
  60. data/ext/cvpoint2d32f.cpp +213 -0
  61. data/ext/cvpoint2d32f.h +61 -0
  62. data/ext/cvpoint3d32f.cpp +245 -0
  63. data/ext/cvpoint3d32f.h +64 -0
  64. data/ext/cvrect.cpp +340 -0
  65. data/ext/cvrect.h +79 -0
  66. data/ext/cvscalar.cpp +227 -0
  67. data/ext/cvscalar.h +63 -0
  68. data/ext/cvseq.cpp +583 -0
  69. data/ext/cvseq.h +71 -0
  70. data/ext/cvset.cpp +63 -0
  71. data/ext/cvset.h +39 -0
  72. data/ext/cvsize.cpp +223 -0
  73. data/ext/cvsize.h +63 -0
  74. data/ext/cvsize2d32f.cpp +180 -0
  75. data/ext/cvsize2d32f.h +59 -0
  76. data/ext/cvslice.cpp +82 -0
  77. data/ext/cvslice.h +53 -0
  78. data/ext/cvsparsemat.cpp +44 -0
  79. data/ext/cvsparsemat.h +28 -0
  80. data/ext/cvtermcriteria.cpp +183 -0
  81. data/ext/cvtermcriteria.h +71 -0
  82. data/ext/cvtwopoints.cpp +98 -0
  83. data/ext/cvtwopoints.h +50 -0
  84. data/ext/cvvector.cpp +206 -0
  85. data/ext/cvvector.h +54 -0
  86. data/ext/cvvideowriter.cpp +116 -0
  87. data/ext/cvvideowriter.h +41 -0
  88. data/ext/extconf.rb +61 -0
  89. data/ext/gui.cpp +65 -0
  90. data/ext/gui.h +33 -0
  91. data/ext/iplconvkernel.cpp +177 -0
  92. data/ext/iplconvkernel.h +52 -0
  93. data/ext/iplimage.cpp +238 -0
  94. data/ext/iplimage.h +54 -0
  95. data/ext/mouseevent.cpp +184 -0
  96. data/ext/mouseevent.h +59 -0
  97. data/ext/opencv.cpp +481 -0
  98. data/ext/opencv.h +356 -0
  99. data/ext/point3dset.cpp +41 -0
  100. data/ext/point3dset.h +31 -0
  101. data/ext/pointset.cpp +238 -0
  102. data/ext/pointset.h +69 -0
  103. data/ext/trackbar.cpp +122 -0
  104. data/ext/trackbar.h +65 -0
  105. data/ext/window.cpp +368 -0
  106. data/ext/window.h +56 -0
  107. data/images/CvMat_sobel.png +0 -0
  108. data/images/CvMat_sub_rect.png +0 -0
  109. data/images/CvSeq_relationmap.png +0 -0
  110. data/images/face_detect_from_lena.jpg +0 -0
  111. data/lib/opencv.rb +3 -0
  112. data/lib/version.rb +3 -0
  113. data/setup/setup.cygwin.rb +120 -0
  114. data/setup/setup.mingw.rb +99 -0
  115. data/setup/setup.mswin32.rb +103 -0
  116. data/test/test_opencv.rb +4 -0
  117. metadata +191 -0
@@ -0,0 +1,204 @@
1
+ /************************************************************
2
+
3
+ cvmoments.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvmoments.h"
11
+ /*
12
+ * Document-class: OpenCV::CvMoments
13
+ *
14
+ * moments
15
+ */
16
+ __NAMESPACE_BEGIN_OPENCV
17
+ __NAMESPACE_BEGIN_CVMOMENTS
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
+
39
+ rb_klass = rb_define_class_under(opencv, "CvMoments", rb_cObject);
40
+ rb_define_alloc_func(rb_klass, rb_allocate);
41
+ rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
42
+ rb_define_method(rb_klass, "spatial", RUBY_METHOD_FUNC(rb_spatial), 2);
43
+ rb_define_method(rb_klass, "central", RUBY_METHOD_FUNC(rb_central), 2);
44
+ rb_define_method(rb_klass, "normalized_central", RUBY_METHOD_FUNC(rb_normalized_central), 2);
45
+ rb_define_method(rb_klass, "hu", RUBY_METHOD_FUNC(rb_hu), 0);
46
+ rb_define_method(rb_klass, "gravity_center", RUBY_METHOD_FUNC(rb_gravity_center), 0);
47
+ rb_define_alias(rb_klass, "center", "gravity_center");
48
+ rb_define_method(rb_klass, "angle", RUBY_METHOD_FUNC(rb_angle), 0);
49
+ }
50
+
51
+ VALUE
52
+ rb_allocate(VALUE klass)
53
+ {
54
+ CvMoments *ptr;
55
+ return Data_Make_Struct(klass, CvMoments, 0, -1, ptr);
56
+ }
57
+ /*
58
+ * call-seq:
59
+ * CvMoments.new(<i>src[,is_binary = nil]</i>)
60
+ *
61
+ * Calculates all moments up to third order of a polygon or rasterized shape.
62
+ * <i>src</i> should be CvMat or CvPolygon.
63
+ *
64
+ * If is_binary = true, all the zero pixel values are treated as zeroes, all the others are treated as 1's.
65
+ */
66
+ VALUE
67
+ rb_initialize(int argc, VALUE *argv, VALUE self)
68
+ {
69
+ VALUE src, is_binary;
70
+ rb_scan_args(argc, argv, "02", &src, &is_binary);
71
+ if (NIL_P(src))
72
+ ;
73
+ else if (rb_obj_is_kind_of(src, cCvMat::rb_class()) || rb_obj_is_kind_of(src, cCvSeq::rb_class()))
74
+ cvMoments(CVARR(src), CVMOMENTS(self), TRUE_OR_FALSE(is_binary, 0));
75
+ else
76
+ rb_raise(rb_eTypeError, "argument 1 (src) should be %s or %s.", rb_class2name(cCvMat::rb_class()), rb_class2name(cCvSeq::rb_class()));
77
+ return self;
78
+ }
79
+
80
+ /*
81
+ * call-seq:
82
+ * spatial -> float
83
+ *
84
+ * Retrieves spatial moment.
85
+ *
86
+ * which in case of image moments is defined as:
87
+ * Mx_order,y_order=sumx,y(I(x,y)*xx_order*yy_order)
88
+ * where I(x,y) is the intensity of the pixel (x, y).
89
+ */
90
+ VALUE
91
+ rb_spatial(VALUE self, VALUE x_order, VALUE y_order)
92
+ {
93
+ return rb_float_new(cvGetSpatialMoment(CVMOMENTS(self), NUM2INT(x_order), NUM2INT(y_order)));
94
+ }
95
+
96
+ /*
97
+ * call-seq:
98
+ * central -> float
99
+ *
100
+ * Retrieves central moment.
101
+ *
102
+ * which in case of image moments is defined as:
103
+ * μx_order,y_order=sumx,y(I(x,y)*(x-xc)x_order*(y-yc)y_order),
104
+ * where xc=M10/M00, yc=M01/M00 - coordinates of the gravity center
105
+ */
106
+ VALUE
107
+ rb_central(VALUE self, VALUE x_order, VALUE y_order)
108
+ {
109
+ return rb_float_new(cvGetCentralMoment(CVMOMENTS(self), NUM2INT(x_order), NUM2INT(y_order)));
110
+ }
111
+
112
+ /*
113
+ * call-seq:
114
+ * normalized_central -> float
115
+ *
116
+ * Retrieves normalized central moment.
117
+ *
118
+ * ηx_order,y_order= μx_order,y_order/M00((y_order+x_order)/2+1)
119
+ */
120
+ VALUE
121
+ rb_normalized_central(VALUE self, VALUE x_order, VALUE y_order)
122
+ {
123
+ return rb_float_new(cvGetNormalizedCentralMoment(CVMOMENTS(self), NUM2INT(x_order), NUM2INT(y_order)));
124
+ }
125
+
126
+ /*
127
+ * call-seq:
128
+ * hu -> [hu1, hu2, ... ,hu7]
129
+ *
130
+ * Calculates seven Hu invariants.
131
+ *
132
+ * seven Hu invariants that are defined as:
133
+ * h1=η20+η02
134
+ * h2=(η20-η02)²+4η11²
135
+ * h3=(η30-3η12)²+ (3η21-η03)²
136
+ * h4=(η30+η12)²+ (η21+η03)²
137
+ * h5=(η30-3η12)(η30+η12)[(η30+η12)²-3(η21+η03)²]+(3η21-η03)(η21+η03)[3(η30+η12)²-(η21+η03)²]
138
+ * h6=(η20-η02)[(η30+η12)²- (η21+η03)²]+4η11(η30+η12)(η21+η03)
139
+ * h7=(3η21-η03)(η21+η03)[3(η30+η12)²-(η21+η03)²]-(η30-3η12)(η21+η03)[3(η30+η12)²-(η21+η03)²]
140
+ * where ηi,j are normalized central moments of 2-nd and 3-rd orders. The computed values are proved to be invariant to the image scaling, rotation, and reflection except the seventh one, whose sign is changed by reflection.
141
+ */
142
+ VALUE
143
+ rb_hu(VALUE self)
144
+ {
145
+ CvHuMoments hu_moments;
146
+ cvGetHuMoments(CVMOMENTS(self), &hu_moments);
147
+ return rb_ary_new3(7,
148
+ rb_float_new(hu_moments.hu1),
149
+ rb_float_new(hu_moments.hu2),
150
+ rb_float_new(hu_moments.hu3),
151
+ rb_float_new(hu_moments.hu4),
152
+ rb_float_new(hu_moments.hu5),
153
+ rb_float_new(hu_moments.hu6),
154
+ rb_float_new(hu_moments.hu7));
155
+ }
156
+
157
+ /*
158
+ * call-seq:
159
+ * gravity_center -> cvpoint2d32f
160
+ *
161
+ * Return gravity center.
162
+ */
163
+ VALUE
164
+ rb_gravity_center(VALUE self)
165
+ {
166
+ CvMoments *moments = CVMOMENTS(self);
167
+ double
168
+ m00 = cvGetSpatialMoment(moments, 0, 0),
169
+ m10 = cvGetSpatialMoment(moments, 1, 0),
170
+ m01 = cvGetSpatialMoment(moments, 0, 1);
171
+ return cCvPoint2D32f::new_object(cvPoint2D32f(m10 / m00, m01 / m00));
172
+ }
173
+
174
+ /*
175
+ * call-seq:
176
+ * angle -> float
177
+ *
178
+ * Return angle.
179
+ */
180
+ VALUE
181
+ rb_angle(VALUE self)
182
+ {
183
+ CvMoments *moments = CVMOMENTS(self);
184
+ double
185
+ m11 = cvGetCentralMoment(moments, 1, 1),
186
+ m20 = cvGetCentralMoment(moments, 2, 0),
187
+ m02 = cvGetCentralMoment(moments, 0, 2),
188
+ mangle = 0.5 * atan(2 * m11 / (m20 - m02));
189
+ if(!cvIsNaN(mangle) && !cvIsInf(mangle))
190
+ return rb_float_new(mangle);
191
+ else
192
+ return Qnil;
193
+ }
194
+
195
+ VALUE
196
+ new_object(CvArr *arr, int is_binary = 0)
197
+ {
198
+ VALUE object = rb_allocate(rb_class());
199
+ cvMoments(arr, CVMOMENTS(object), TRUE_OR_FALSE(is_binary, 0));
200
+ return object;
201
+ }
202
+
203
+ __NAMESPACE_END_CVMOMENTS
204
+ __NAMESPACE_END_OPENCV
@@ -0,0 +1,48 @@
1
+ /************************************************************
2
+
3
+ cvmoments.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVMOMENTS_H
11
+ #define RUBY_OPENCV_CVMOMENTS_H
12
+
13
+ #include "opencv.h"
14
+
15
+ #define __NAMESPACE_BEGIN_CVMOMENTS namespace cCvMoments{
16
+ #define __NAMESPACE_END_CVMOMENTS }
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVMOMENTS
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
+ VALUE rb_spatial(VALUE self, VALUE x_order, VALUE y_order);
28
+ VALUE rb_central(VALUE self, VALUE x_order, VALUE y_order);
29
+ VALUE rb_normalized_central(VALUE self, VALUE x_order, VALUE y_order);
30
+ VALUE rb_hu(VALUE self);
31
+ VALUE rb_gravity_center(VALUE self);
32
+ VALUE rb_angle(VALUE self);
33
+
34
+ VALUE new_object(CvArr *arr, int is_binary);
35
+
36
+ __NAMESPACE_END_CVMOMENTS
37
+
38
+ inline CvMoments*
39
+ CVMOMENTS(VALUE object)
40
+ {
41
+ CvMoments *ptr;
42
+ Data_Get_Struct(object, CvMoments, ptr);
43
+ return ptr;
44
+ }
45
+
46
+ __NAMESPACE_END_OPENCV
47
+
48
+ #endif // RUBY_OPENCV_CVMOMENTS_H
@@ -0,0 +1,229 @@
1
+ /************************************************************
2
+
3
+ cvpoint.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2006 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvpoint.h"
11
+ /*
12
+ * Document-class: OpenCV::CvPoint
13
+ *
14
+ * This class means one point on X axis Y axis.
15
+ * X and Y takes the value of the Fixnum. see also CvPoint2D32F
16
+ *
17
+ * C structure is here, very simple.
18
+ * typdef struct CvPoint{
19
+ * int x;
20
+ * int y;
21
+ * }
22
+ */
23
+ __NAMESPACE_BEGIN_OPENCV
24
+ __NAMESPACE_BEGIN_CVPOINT
25
+
26
+ VALUE rb_klass;
27
+
28
+ VALUE
29
+ rb_class()
30
+ {
31
+ return rb_klass;
32
+ }
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
+ }
58
+
59
+ /*
60
+ * call-seq:
61
+ * combatible?(obj)
62
+ *
63
+ * Return compatibility to CvPoint. Return true if object have method #x and #y.
64
+ *
65
+ * For example.
66
+ * class MyPoint
67
+ * def x
68
+ * 1
69
+ * end
70
+ * def y
71
+ * 2
72
+ * end
73
+ * end
74
+ * mp = MyPoint.new
75
+ * CvPoint.compatible?(mp) #=> true
76
+ * CvPoint.new(mp) #=> same as CvPoint(1, 2)
77
+ */
78
+ VALUE
79
+ rb_compatible_q(VALUE klass, VALUE object)
80
+ {
81
+ return (rb_respond_to(object, rb_intern("x")) && rb_respond_to(object, rb_intern("y"))) ? Qtrue : Qfalse;
82
+ }
83
+
84
+ VALUE
85
+ rb_allocate(VALUE klass)
86
+ {
87
+ CvPoint *ptr;
88
+ return Data_Make_Struct(klass, CvPoint, 0, -1, ptr);
89
+ }
90
+
91
+ /*
92
+ * call-seq:
93
+ * new -> CvPoint.new(0, 0)
94
+ * new(obj) -> CvPoint.new(obj.x.to_i, obj.y.to_i)
95
+ * new(x, y)
96
+ *
97
+ * Create new 2D-coordinate, (x, y). It is dropped below the decimal point.
98
+ *
99
+ * new() is same as new(0, 0)
100
+ *
101
+ * new(obj) is same as new(obj.x.to_i, obj.y.to_i)
102
+ */
103
+ VALUE
104
+ rb_initialize(int argc, VALUE *argv, VALUE self)
105
+ {
106
+ VALUE obj, x, y;
107
+ switch (argc) {
108
+ case 0:
109
+ break;
110
+ case 1:
111
+ obj = argv[0];
112
+ if (rb_compatible_q(rb_klass, obj)) {
113
+ CVPOINT(self)->x = NUM2INT(rb_funcall(rb_funcall(obj, rb_intern("x"), 0), rb_intern("to_i"), 0));
114
+ CVPOINT(self)->y = NUM2INT(rb_funcall(rb_funcall(obj, rb_intern("y"), 0), rb_intern("to_i"), 0));
115
+ }else{
116
+ rb_raise(rb_eArgError, "object is not compatible %s.", rb_class2name(rb_klass));
117
+ }
118
+ break;
119
+ case 2:
120
+ x = argv[0], y = argv[1];
121
+ CVPOINT(self)->x = NUM2INT(x);
122
+ CVPOINT(self)->y = NUM2INT(y);
123
+ break;
124
+ default:
125
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..2)", argc);
126
+ }
127
+ return Qnil;
128
+ }
129
+
130
+ /*
131
+ * Return parameter on x-axis.
132
+ */
133
+ VALUE
134
+ rb_x(VALUE self)
135
+ {
136
+ return INT2FIX(CVPOINT(self)->x);
137
+ }
138
+
139
+ /*
140
+ * call-seq:
141
+ * x = val
142
+ *
143
+ * Set x-axis parameter, return self.
144
+ * It is dropped below the decimal point.
145
+ * pt = CvPoint.new
146
+ * pt.x = 1.1
147
+ * pt.x #=> 1
148
+ * pt.x = 100.9
149
+ * pt.x #=> 100
150
+ */
151
+ VALUE
152
+ rb_set_x(VALUE self, VALUE x)
153
+ {
154
+ CVPOINT(self)->x = NUM2INT(x);
155
+ return self;
156
+ }
157
+
158
+ /*
159
+ * Return parameter on y-axis.
160
+ */
161
+ VALUE
162
+ rb_y(VALUE self)
163
+ {
164
+ return INT2FIX(CVPOINT(self)->y);
165
+ }
166
+
167
+ /*
168
+ * call-seq:
169
+ * y = val
170
+ *
171
+ * Set y-axis parameter, return self.
172
+ * It is dropped below the decimal point.
173
+ */
174
+ VALUE
175
+ rb_set_y(VALUE self, VALUE y)
176
+ {
177
+ CVPOINT(self)->y = NUM2INT(y);
178
+ return self;
179
+ }
180
+
181
+ /*
182
+ * call-seq:
183
+ * to_s -> "<OpenCV::CvPoint:(self.x,self.y)>"
184
+ *
185
+ * Return x and y by String.
186
+ */
187
+ VALUE
188
+ rb_to_s(VALUE self)
189
+ {
190
+ const int i = 4;
191
+ VALUE str[i];
192
+ str[0] = rb_str_new2("<%s:(%d,%d)>");
193
+ str[1] = rb_str_new2(rb_class2name(CLASS_OF(self)));
194
+ str[2] = rb_x(self);
195
+ str[3] = rb_y(self);
196
+ return rb_f_sprintf(i, str);
197
+ }
198
+
199
+ /*
200
+ * call-seq:
201
+ * to_ary -> [x, y]
202
+ *
203
+ * Return x and y by Array.
204
+ */
205
+ VALUE
206
+ rb_to_ary(VALUE self)
207
+ {
208
+ return rb_ary_new3(2, rb_x(self), rb_y(self));
209
+ }
210
+
211
+ VALUE
212
+ new_object()
213
+ {
214
+ VALUE object = rb_allocate(rb_klass);
215
+ *CVPOINT(object) = cvPoint(0, 0);
216
+ return object;
217
+ }
218
+
219
+
220
+ VALUE
221
+ new_object(CvPoint point)
222
+ {
223
+ VALUE object = rb_allocate(rb_klass);
224
+ *CVPOINT(object) = point;
225
+ return object;
226
+ }
227
+
228
+ __NAMESPACE_END_CVPOINT
229
+ __NAMESPACE_END_OPENCV