opencv 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
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,64 @@
1
+ /************************************************************
2
+
3
+ cvpoint3d32f.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2008 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVPOINT3D32F_H
11
+ #define RUBY_OPENCV_CVPOINT3D32F_H
12
+
13
+ #define __NAMESPACE_BEGIN_CVPOINT3D32F namespace cCvPoint3D32f{
14
+ #define __NAMESPACE_END_CVPOINT3D32F }
15
+
16
+ #include"opencv.h"
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVPOINT3D32F
20
+
21
+ VALUE rb_class();
22
+
23
+ void define_ruby_class();
24
+
25
+ VALUE rb_compatible_q(VALUE klass, VALUE object);
26
+
27
+ VALUE rb_allocate(VALUE klass);
28
+ VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
29
+ VALUE rb_x(VALUE self);
30
+ VALUE rb_set_x(VALUE self, VALUE x);
31
+ VALUE rb_y(VALUE self);
32
+ VALUE rb_set_y(VALUE self, VALUE y);
33
+ VALUE rb_z(VALUE self);
34
+ VALUE rb_set_z(VALUE self, VALUE z);
35
+
36
+ VALUE rb_to_s(VALUE self);
37
+ VALUE rb_to_ary(VALUE self);
38
+
39
+ VALUE new_object(CvPoint3D32f point);
40
+
41
+ __NAMESPACE_END_CVPOINT3D32F
42
+
43
+ inline CvPoint3D32f*
44
+ CVPOINT3D32F(VALUE object)
45
+ {
46
+ CvPoint3D32f *ptr;
47
+ Data_Get_Struct(object, CvPoint3D32f, ptr);
48
+ return ptr;
49
+ }
50
+
51
+ inline CvPoint3D32f
52
+ VALUE_TO_CVPOINT3D32F(VALUE object)
53
+ {
54
+ if(cCvPoint3D32f::rb_compatible_q(cCvPoint3D32f::rb_class(), object)){
55
+ return cvPoint3D32f(NUM2DBL(rb_funcall(object, rb_intern("x"), 0)),
56
+ NUM2DBL(rb_funcall(object, rb_intern("y"), 0)),
57
+ NUM2DBL(rb_funcall(object, rb_intern("z"), 0)));
58
+ }else{
59
+ rb_raise(rb_eTypeError, "require %s or compatible object.", rb_class2name(cCvPoint3D32f::rb_class()));
60
+ }
61
+ }
62
+
63
+ __NAMESPACE_END_OPENCV
64
+ #endif // RUBY_OPENCV_CVPOINT3D32F_H
@@ -0,0 +1,340 @@
1
+ /************************************************************
2
+
3
+ cvrect.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2006 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvrect.h"
11
+ /*
12
+ * Document-class: OpenCV::CvRect
13
+ *
14
+ * This class have coordinate of top-left point(x, y) and size, width and height.
15
+ *
16
+ *
17
+ * C stracture is here, very simple.
18
+ * typdef struct CvRect{
19
+ * int x;
20
+ * int y;
21
+ * int width;
22
+ * int height;
23
+ * }
24
+ *
25
+ */
26
+ __NAMESPACE_BEGIN_OPENCV
27
+ __NAMESPACE_BEGIN_CVRECT
28
+
29
+ VALUE rb_klass;
30
+
31
+ VALUE
32
+ rb_class()
33
+ {
34
+ return rb_klass;
35
+ }
36
+
37
+ void
38
+ define_ruby_class()
39
+ {
40
+ if(rb_klass)
41
+ return;
42
+ /*
43
+ * opencv = rb_define_module("OpenCV");
44
+ *
45
+ * note: this comment is used by rdoc.
46
+ */
47
+ VALUE opencv = rb_module_opencv();
48
+ rb_klass = rb_define_class_under(opencv, "CvRect", rb_cObject);
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
+
53
+ rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
54
+ rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
55
+ rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
56
+ rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
57
+ rb_define_method(rb_klass, "width", RUBY_METHOD_FUNC(rb_width), 0);
58
+ rb_define_method(rb_klass, "width=", RUBY_METHOD_FUNC(rb_set_width), 1);
59
+ rb_define_method(rb_klass, "height", RUBY_METHOD_FUNC(rb_height), 0);
60
+ rb_define_method(rb_klass, "height=", RUBY_METHOD_FUNC(rb_set_height), 1);
61
+ rb_define_method(rb_klass, "center", RUBY_METHOD_FUNC(rb_center), 0);
62
+ rb_define_method(rb_klass, "points", RUBY_METHOD_FUNC(rb_points), 0);
63
+ rb_define_method(rb_klass, "top_left", RUBY_METHOD_FUNC(rb_top_left), 0);
64
+ rb_define_method(rb_klass, "top_right", RUBY_METHOD_FUNC(rb_top_right), 0);
65
+ rb_define_method(rb_klass, "bottom_left", RUBY_METHOD_FUNC(rb_bottom_left), 0);
66
+ rb_define_method(rb_klass, "bottom_right", RUBY_METHOD_FUNC(rb_bottom_right), 0);
67
+ rb_define_method(rb_klass, "or", RUBY_METHOD_FUNC(rb_or), 1);
68
+ rb_define_alias(rb_klass, "|", "or");
69
+ }
70
+
71
+ /*
72
+ * call-seq:
73
+ * combatible?(obj)
74
+ *
75
+ * Return compatibility to CvRect. Return true if object have method #x and #y and #width and #height.
76
+ *
77
+ * For example.
78
+ * class MyRect
79
+ * def x
80
+ * 1
81
+ * end
82
+ * def y
83
+ * 2
84
+ * end
85
+ * def width
86
+ * 10
87
+ * end
88
+ * def height
89
+ * 20
90
+ * end
91
+ * end
92
+ * mr = MyRect.new
93
+ * CvRect.compatible?(mp) #=> true
94
+ * CvRect.new(mp) #=> same as CvRect(1, 2, 10, 20)
95
+ */
96
+ VALUE
97
+ rb_compatible_q(VALUE klass, VALUE object)
98
+ {
99
+ return (rb_respond_to(object, rb_intern("x")) && rb_respond_to(object, rb_intern("y")) && rb_respond_to(object, rb_intern("width")) && rb_respond_to(object, rb_intern("height"))) ? Qtrue : Qfalse;
100
+ }
101
+
102
+ /*
103
+ * call-seq:
104
+ * CvRect.bounding
105
+ *
106
+ */
107
+ VALUE
108
+ rb_bounding(VALUE klass, VALUE points)
109
+ {
110
+ /* not yet */
111
+ return Qnil;
112
+ }
113
+
114
+ VALUE
115
+ rb_allocate(VALUE klass)
116
+ {
117
+ CvRect *ptr;
118
+ return Data_Make_Struct(klass, CvRect, 0, -1, ptr);
119
+ }
120
+
121
+ /*
122
+ * call-seq:
123
+ * new -> CvRect.new(0, 0, 0, 0)
124
+ * new(obj) -> CvRect.new(obj.x.to_i, obj.y.to_i, obj.width.to_i, obj.height.to_i)
125
+ * new(x, y, width, height)
126
+ *
127
+ * Create new rectangle area. (x, y) is top-left point, and width, height is size of area.
128
+ * It is dropped below the decimal point.
129
+ *
130
+ * new() is same as new(0, 0, 0, 0)
131
+ *
132
+ * new(obj) is same as new(obj.x.to_i, obj.y.to_i, obj.width.to_i, obj.height.to_i)
133
+ */
134
+ VALUE
135
+ rb_initialize(int argc, VALUE *argv, VALUE self)
136
+ {
137
+ VALUE object, x, y, width, height;
138
+ switch (argc) {
139
+ case 0:
140
+ break;
141
+ case 1:
142
+ object = argv[0];
143
+ if(rb_compatible_q(rb_klass, object)) {
144
+ CVRECT(self)->x = NUM2INT(rb_funcall(rb_funcall(object, rb_intern("x"), 0), rb_intern("to_i"), 0));
145
+ CVRECT(self)->y = NUM2INT(rb_funcall(rb_funcall(object, rb_intern("y"), 0), rb_intern("to_i"), 0));
146
+ CVRECT(self)->width = NUM2INT(rb_funcall(rb_funcall(object, rb_intern("width"), 0), rb_intern("to_i"), 0));
147
+ CVRECT(self)->height = NUM2INT(rb_funcall(rb_funcall(object, rb_intern("height"), 0), rb_intern("to_i"), 0));
148
+ }else{
149
+ rb_raise(rb_eArgError, "object is not compatible %s.", rb_class2name(rb_klass));
150
+ }
151
+ break;
152
+ case 4:
153
+ x = argv[0], y = argv[1], width = argv[2], height = argv[3];
154
+ CVRECT(self)->x = NUM2INT(x);
155
+ CVRECT(self)->y = NUM2INT(y);
156
+ CVRECT(self)->width = NUM2INT(width);
157
+ CVRECT(self)->height = NUM2INT(height);
158
+ break;
159
+ default:
160
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..2)", argc);
161
+ }
162
+ return Qnil;
163
+ }
164
+
165
+ /*
166
+ * Return parameter on x-axis of top-left point.
167
+ */
168
+ VALUE
169
+ rb_x(VALUE self)
170
+ {
171
+ return INT2FIX(CVRECT(self)->x);
172
+ }
173
+
174
+ /*
175
+ * call-seq:
176
+ * x = val
177
+ *
178
+ * Set x-axis parameter of top-left point, return self.
179
+ * It is dropped below the decimal point.
180
+ */
181
+ VALUE
182
+ rb_set_x(VALUE self, VALUE x)
183
+ {
184
+ CVRECT(self)->x = NUM2INT(x);
185
+ return self;
186
+ }
187
+
188
+ /*
189
+ * Return parameter on y-axis of top-left point.
190
+ */
191
+ VALUE
192
+ rb_y(VALUE self)
193
+ {
194
+ return INT2FIX(CVRECT(self)->y);
195
+ }
196
+
197
+ /*
198
+ * call-seq:
199
+ * y = val
200
+ *
201
+ * Set y-axis parameter of top-left point, return self.
202
+ * It is dropped below the decimal point.
203
+ */
204
+ VALUE
205
+ rb_set_y(VALUE self, VALUE y)
206
+ {
207
+ CVRECT(self)->y = NUM2INT(y);
208
+ return self;
209
+ }
210
+
211
+ /*
212
+ * Return size of x-axis.
213
+ */
214
+ VALUE
215
+ rb_width(VALUE self)
216
+ {
217
+ return INT2FIX(CVRECT(self)->width);
218
+ }
219
+
220
+ /*
221
+ * call-seq:
222
+ * width = val
223
+ *
224
+ * Set x-axis size, return self.
225
+ * It is dropped below the decimal point.
226
+ */
227
+ VALUE
228
+ rb_set_width(VALUE self, VALUE x)
229
+ {
230
+ CVRECT(self)->width = NUM2INT(x);
231
+ return self;
232
+ }
233
+
234
+ /*
235
+ * Return size of y-axis.
236
+ */
237
+ VALUE
238
+ rb_height(VALUE self)
239
+ {
240
+ return INT2FIX(CVRECT(self)->height);
241
+ }
242
+
243
+ /*
244
+ * call-seq:
245
+ * height = val
246
+ *
247
+ * Set y-axis size, return self.
248
+ * It is dropped below the decimal point.
249
+ */
250
+ VALUE
251
+ rb_set_height(VALUE self, VALUE y)
252
+ {
253
+ CVRECT(self)->height = NUM2INT(y);
254
+ return self;
255
+ }
256
+
257
+ /*
258
+ * Return center point of rectangle.
259
+ */
260
+ VALUE
261
+ rb_center(VALUE self)
262
+ {
263
+ CvRect *rect = CVRECT(self);
264
+ return cCvPoint2D32f::new_object(cvPoint2D32f((float)rect->x + (float)rect->width / 2.0,
265
+ (float)rect->y + (float)rect->height / 2.0));
266
+ }
267
+
268
+ /*
269
+ * Return 4 points (top-left, bottom-left, bottom-right, top-right)
270
+ */
271
+ VALUE
272
+ rb_points(VALUE self)
273
+ {
274
+ CvRect *rect = CVRECT(self);
275
+ return rb_ary_new3(4,
276
+ cCvPoint::new_object(cvPoint(rect->x, rect->y)),
277
+ cCvPoint::new_object(cvPoint(rect->x, rect->y + rect->height)),
278
+ cCvPoint::new_object(cvPoint(rect->x + rect->width, rect->y + rect->height)),
279
+ cCvPoint::new_object(cvPoint(rect->x + rect->width, rect->y))
280
+ );
281
+ }
282
+
283
+ /*
284
+ * Return top-left point of rectangle.
285
+ */
286
+ VALUE
287
+ rb_top_left(VALUE self)
288
+ {
289
+ return cCvPoint::new_object(cvPoint(CVRECT(self)->x, CVRECT(self)->y));
290
+ }
291
+
292
+ /*
293
+ * Return top-right point of rectangle.
294
+ */
295
+ VALUE
296
+ rb_top_right(VALUE self)
297
+ {
298
+ return cCvPoint::new_object(cvPoint(CVRECT(self)->x + CVRECT(self)->width, CVRECT(self)->y));
299
+ }
300
+
301
+ /*
302
+ * Return bottom-left point of rectangle.
303
+ */
304
+ VALUE
305
+ rb_bottom_left(VALUE self)
306
+ {
307
+ return cCvPoint::new_object(cvPoint(CVRECT(self)->x, CVRECT(self)->y + CVRECT(self)->height));
308
+ }
309
+
310
+ /*
311
+ * Return bottom-right point of rectangle.
312
+ */
313
+ VALUE
314
+ rb_bottom_right(VALUE self)
315
+ {
316
+ return cCvPoint::new_object(cvPoint(CVRECT(self)->x + CVRECT(self)->width, CVRECT(self)->y + CVRECT(self)->height));
317
+ }
318
+
319
+ /*
320
+ * call-seq:
321
+ * or(rect) -> cvrect
322
+ *
323
+ * Finds bounding rectangle for self and given rectangles.
324
+ */
325
+ VALUE
326
+ rb_or(VALUE self, VALUE rect)
327
+ {
328
+ return cCvRect::new_object(cvMaxRect(CVRECT(self), CVRECT(rect)));
329
+ }
330
+
331
+ VALUE
332
+ new_object(CvRect rect)
333
+ {
334
+ VALUE object = rb_allocate(rb_klass);
335
+ *CVRECT(object) = rect;
336
+ return object;
337
+ }
338
+
339
+ __NAMESPACE_END_CVRECT
340
+ __NAMESPACE_END_OPENCV
@@ -0,0 +1,79 @@
1
+ /************************************************************
2
+
3
+ cvrect.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2006 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVRECT_H
11
+ #define RUBY_OPENCV_CVRECT_H
12
+
13
+ #include"opencv.h"
14
+
15
+ #define __NAMESPACE_BEGIN_CVRECT namespace cCvRect{
16
+ #define __NAMESPACE_END_CVRECT }
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVRECT
20
+
21
+ VALUE rb_class();
22
+
23
+ void define_ruby_class();
24
+
25
+ VALUE rb_compatible_q(VALUE klass, VALUE object);
26
+ VALUE rb_bounding(VALUE klass, VALUE points);
27
+
28
+ VALUE rb_allocate(VALUE klass);
29
+ VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
30
+ VALUE rb_x(VALUE self);
31
+ VALUE rb_set_x(VALUE self, VALUE x);
32
+ VALUE rb_y(VALUE self);
33
+ VALUE rb_set_y(VALUE self, VALUE y);
34
+ VALUE rb_width(VALUE self);
35
+ VALUE rb_set_width(VALUE self, VALUE width);
36
+ VALUE rb_height(VALUE self);
37
+ VALUE rb_set_height(VALUE self, VALUE height);
38
+
39
+ VALUE rb_center(VALUE self);
40
+ VALUE rb_points(VALUE self);
41
+ VALUE rb_top_left(VALUE self);
42
+ VALUE rb_set_top_left(VALUE self, VALUE point);
43
+ VALUE rb_top_right(VALUE self);
44
+ VALUE rb_set_top_right(VALUE self, VALUE point);
45
+ VALUE rb_bottom_left(VALUE self);
46
+ VALUE rb_set_bottom_left(VALUE self, VALUE point);
47
+ VALUE rb_bottom_right(VALUE self);
48
+ VALUE rb_set_bottom_right(VALUE self, VALUE point);
49
+
50
+ VALUE rb_or(VALUE self, VALUE rect);
51
+
52
+ VALUE new_object(CvRect rect);
53
+
54
+ __NAMESPACE_END_CVRECT
55
+
56
+ inline CvRect*
57
+ CVRECT(VALUE object)
58
+ {
59
+ CvRect *ptr;
60
+ Data_Get_Struct(object, CvRect, ptr);
61
+ return ptr;
62
+ }
63
+
64
+ inline CvRect
65
+ VALUE_TO_CVRECT(VALUE object)
66
+ {
67
+ if(cCvRect::rb_compatible_q(cCvRect::rb_class(), object)){
68
+ return cvRect(NUM2INT(rb_funcall(object, rb_intern("x"), 0)),
69
+ NUM2INT(rb_funcall(object, rb_intern("y"), 0)),
70
+ NUM2INT(rb_funcall(object, rb_intern("width"), 0)),
71
+ NUM2INT(rb_funcall(object, rb_intern("height"), 0)));
72
+ }else{
73
+ rb_raise(rb_eTypeError, "require %s or compatible object.", rb_class2name(cCvRect::rb_class()));
74
+ }
75
+ }
76
+
77
+ __NAMESPACE_END_OPENCV
78
+
79
+ #endif // RUBY_OPENCV_CVRECT_H