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,49 @@
1
+ /************************************************************
2
+
3
+ cvcondensation.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2006 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVCONDENSATION_H
11
+ #define RUBY_OPENCV_CVCONDENSATION_H
12
+
13
+ #include "opencv.h"
14
+
15
+ #define __NAMESPACE_BEGIN_CVCONDENSATION namespace cCvConDensation{
16
+ #define __NAMESPACE_END_CVCONDENSATION }
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVCONDENSATION
20
+
21
+ VALUE rb_class();
22
+ void define_ruby_class();
23
+
24
+ VALUE rb_dp(VALUE self);
25
+ VALUE rb_mp(VALUE self);
26
+ VALUE rb_dynamic_matrix(VALUE self);
27
+ VALUE rb_state(VALUE self);
28
+ VALUE rb_confidence(VALUE self);
29
+ VALUE rb_cumulative(VALUE self);
30
+ VALUE rb_samples_num(VALUE self);
31
+
32
+ VALUE rb_init_sample_set(VALUE self, VALUE lower, VALUE upper);
33
+ VALUE rb_update_by_time(VALUE self);
34
+ VALUE rb_each_sample(VALUE self);
35
+ VALUE rb_calculate_confidence(VALUE self);
36
+
37
+ __NAMESPACE_END_CVCONDENSATION
38
+
39
+ inline CvConDensation*
40
+ CVCONDENSATION(VALUE object)
41
+ {
42
+ CvConDensation *ptr;
43
+ Data_Get_Struct(object, CvConDensation, ptr);
44
+ return ptr;
45
+ }
46
+
47
+ __NAMESPACE_END_OPENCV
48
+
49
+ #endif // RUBY_OPENCV_CVCONDENSATION_H
@@ -0,0 +1,115 @@
1
+ /************************************************************
2
+
3
+ cvconnectedcomp.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvconnectedcomp.h"
11
+ /*
12
+ * Document-class: OpenCV::CvConnectedComp
13
+ *
14
+ * see CvMat#flood_fill
15
+ *
16
+ * C structure is here.
17
+ * typedef struct CvConnectedComp
18
+ * {
19
+ * double area;
20
+ * CvScalar value;
21
+ * CvRect rect;
22
+ * CvSeq* contour;
23
+ * } CvConnectedComp;
24
+ */
25
+ __NAMESPACE_BEGIN_OPENCV
26
+ __NAMESPACE_BEGIN_CVCONNECTEDCOMP
27
+
28
+ VALUE rb_klass;
29
+
30
+ VALUE
31
+ rb_class()
32
+ {
33
+ return rb_klass;
34
+ }
35
+
36
+ void
37
+ define_ruby_class()
38
+ {
39
+ if (rb_klass)
40
+ return;
41
+ /*
42
+ * opencv = rb_define_module("OpenCV");
43
+ *
44
+ * note: this comment is used by rdoc.
45
+ */
46
+ VALUE opencv = rb_module_opencv();
47
+
48
+ rb_klass = rb_define_class_under(opencv, "CvConnectedComp", rb_cObject);
49
+ rb_define_alloc_func(rb_klass, rb_allocate);
50
+ rb_define_method(rb_klass, "area", RUBY_METHOD_FUNC(rb_area), 0);
51
+ rb_define_method(rb_klass, "value", RUBY_METHOD_FUNC(rb_value), 0);
52
+ rb_define_method(rb_klass, "rect", RUBY_METHOD_FUNC(rb_rect), 0);
53
+ rb_define_method(rb_klass, "rect=", RUBY_METHOD_FUNC(rb_set_rect), 0);
54
+ }
55
+
56
+ VALUE
57
+ rb_allocate(VALUE klass)
58
+ {
59
+ CvConnectedComp *ptr;
60
+ return Data_Make_Struct(klass, CvConnectedComp, 0, -1, ptr);
61
+ }
62
+
63
+ /*
64
+ * Return area of connected component.
65
+ */
66
+ VALUE
67
+ rb_area(VALUE self)
68
+ {
69
+ return rb_float_new(CVCONNECTEDCOMP(self)->area);
70
+ }
71
+
72
+ /*
73
+ * Return average color of the connected component.
74
+ */
75
+ VALUE
76
+ rb_value(VALUE self)
77
+ {
78
+ return REFER_OBJECT(cCvScalar::rb_class(), &CVCONNECTEDCOMP(self)->value, self);
79
+ }
80
+
81
+ /*
82
+ * Return ROI of the component.
83
+ */
84
+ VALUE
85
+ rb_rect(VALUE self)
86
+ {
87
+ return REFER_OBJECT(cCvRect::rb_class(), &CVCONNECTEDCOMP(self)->rect, self);
88
+ }
89
+
90
+ /*
91
+ * Set ROI of the component.
92
+ */
93
+ VALUE
94
+ rb_set_rect(VALUE self, VALUE rect)
95
+ {
96
+ CVCONNECTEDCOMP(self)->rect = VALUE_TO_CVRECT(rect);
97
+ return self;
98
+ }
99
+
100
+ VALUE
101
+ new_object()
102
+ {
103
+ return rb_allocate(rb_klass);
104
+ }
105
+
106
+ VALUE
107
+ new_object(CvConnectedComp comp)
108
+ {
109
+ VALUE object = rb_allocate(rb_klass);
110
+ *CVCONNECTEDCOMP(object) = comp;
111
+ return object;
112
+ }
113
+
114
+ __NAMESPACE_END_CVCONNECTEDCOMP
115
+ __NAMESPACE_END_OPENCV
@@ -0,0 +1,46 @@
1
+ /************************************************************
2
+
3
+ cvconnectedcomp.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVCONNECTEDCOMP_H
11
+ #define RUBY_OPENCV_CVCONNECTEDCOMP_H
12
+
13
+ #include "opencv.h"
14
+
15
+ #define __NAMESPACE_BEGIN_CVCONNECTEDCOMP namespace cCvConnectedComp{
16
+ #define __NAMESPACE_END_CVCONNECTEDCOMP }
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVCONNECTEDCOMP
20
+
21
+ VALUE rb_class();
22
+
23
+ void define_ruby_class();
24
+
25
+ VALUE rb_allocate(VALUE klass);
26
+
27
+ VALUE rb_area(VALUE self);
28
+ VALUE rb_value(VALUE self);
29
+ VALUE rb_rect(VALUE self);
30
+ VALUE rb_set_rect(VALUE self, VALUE rect);
31
+ VALUE rb_contour(VALUE self);
32
+
33
+ VALUE new_object();
34
+ VALUE new_object(CvConnectedComp comp);
35
+
36
+ __NAMESPACE_END_CVCONNECTEDCOMP
37
+
38
+ inline CvConnectedComp *CVCONNECTEDCOMP(VALUE object){
39
+ CvConnectedComp *ptr;
40
+ Data_Get_Struct(object, CvConnectedComp, ptr);
41
+ return ptr;
42
+ }
43
+
44
+ __NAMESPACE_END_OPENCV
45
+
46
+ #endif // RUBY_OPENCV_CVCONNECTEDCOMP_H
@@ -0,0 +1,219 @@
1
+ /************************************************************
2
+
3
+ cvcontour.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvcontour.h"
11
+ /*
12
+ * Document-class: OpenCV::CvContour
13
+ *
14
+ * Contour.
15
+ * CvMat#find_contours
16
+ */
17
+ __NAMESPACE_BEGIN_OPENCV
18
+ __NAMESPACE_BEGIN_CVCONTOUR
19
+
20
+ #define APPROX_POLY_OPTION(op) NIL_P(op) ? rb_const_get(rb_class(), rb_intern("APPROX_OPTION")) : rb_funcall(rb_const_get(rb_class(), rb_intern("APPROX_OPTION")), rb_intern("merge"), 1, op)
21
+ #define APPROX_POLY_METHOD(op) CVMETHOD("APPROX_POLY_METHOD", rb_hash_aref(op, ID2SYM(rb_intern("method"))), CV_POLY_APPROX_DP)
22
+ #define APPROX_POLY_ACCURACY(op) NUM2DBL(rb_hash_aref(op, ID2SYM(rb_intern("accuracy"))))
23
+ #define APPROX_POLY_RECURSIVE(op) ({VALUE _recursive = rb_hash_aref(op, ID2SYM(rb_intern("recursive"))); NIL_P(_recursive) ? 0 : _recursive == Qfalse ? 0 : 1;})
24
+
25
+ VALUE rb_klass;
26
+
27
+ VALUE
28
+ rb_class()
29
+ {
30
+ return rb_klass;
31
+ }
32
+
33
+ void
34
+ define_ruby_class()
35
+ {
36
+ if (rb_klass)
37
+ return;
38
+ /*
39
+ * opencv = rb_define_module("OpenCV");
40
+ * cvseq = rb_define_class_under(opencv, "CvSeq");
41
+ * curve = rb_define_module_under(opencv, "Curve");
42
+ * pointset = rb_define_module_under(opencv, "PointSet");
43
+ *
44
+ * note: this comment is used by rdoc.
45
+ */
46
+ VALUE opencv = rb_module_opencv();
47
+ VALUE cvseq = cCvSeq::rb_class();
48
+ VALUE curve = mCurve::rb_module();
49
+ VALUE pointset = mPointSet::rb_module();
50
+
51
+ rb_klass = rb_define_class_under(opencv, "CvContour", cvseq);
52
+ rb_include_module(rb_klass, curve);
53
+ rb_include_module(rb_klass, pointset);
54
+
55
+ VALUE approx_option = rb_hash_new();
56
+ rb_define_const(rb_klass, "APPROX_OPTION", approx_option);
57
+ rb_hash_aset(approx_option, ID2SYM(rb_intern("method")), INT2FIX(CV_POLY_APPROX_DP));
58
+ rb_hash_aset(approx_option, ID2SYM(rb_intern("accuracy")), rb_float_new(1.0));
59
+ rb_hash_aset(approx_option, ID2SYM(rb_intern("recursive")), Qfalse);
60
+
61
+ rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
62
+ rb_define_method(rb_klass, "rect", RUBY_METHOD_FUNC(rb_rect), 0);
63
+ rb_define_method(rb_klass, "color", RUBY_METHOD_FUNC(rb_color), 0);
64
+ rb_define_method(rb_klass, "color=", RUBY_METHOD_FUNC(rb_set_color), 1);
65
+ rb_define_method(rb_klass, "reserved", RUBY_METHOD_FUNC(rb_reserved), 0);
66
+ rb_define_method(rb_klass, "approx_poly", RUBY_METHOD_FUNC(rb_approx_poly), -1);
67
+ rb_define_alias(rb_klass, "approx", "approx_poly");
68
+ rb_define_method(rb_klass, "bounding_rect", RUBY_METHOD_FUNC(rb_bounding_rect), 0);
69
+ rb_define_method(rb_klass, "create_tree", RUBY_METHOD_FUNC(rb_create_tree), -1);
70
+ rb_define_method(rb_klass, "in?", RUBY_METHOD_FUNC(rb_in_q), 1);
71
+ rb_define_method(rb_klass, "measure_distance", RUBY_METHOD_FUNC(rb_measure_distance), 1);
72
+ }
73
+
74
+ VALUE
75
+ rb_initialize(int argc, VALUE *argv, VALUE self)
76
+ {
77
+ /*
78
+ VALUE storage;
79
+ CvSeq *seq = 0;
80
+ rb_scan_args(argc, argv, "01", &storage);
81
+
82
+ storage = CHECK_CVMEMSTORAGE(storage);
83
+ seq = cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvSeq), sizeof(CvPoint), CVMEMSTORAGE(storage));
84
+ DATA_PTR(self) = seq;
85
+ resist_root_object(seq, storage);
86
+ st_insert(cCvSeq::seqblock_klass, (st_data_t)seq, (st_data_t)klass);
87
+ */
88
+ return self;
89
+ }
90
+
91
+ VALUE
92
+ rb_rect(VALUE self)
93
+ {
94
+ return cCvRect::new_object(CVCONTOUR(self)->rect);
95
+ }
96
+
97
+ VALUE
98
+ rb_color(VALUE self)
99
+ {
100
+ return INT2NUM(CVCONTOUR(self)->color);
101
+ }
102
+
103
+ VALUE
104
+ rb_set_color(VALUE self, VALUE color)
105
+ {
106
+ CVCONTOUR(self)->color = NUM2INT(color);
107
+ return self;
108
+ }
109
+
110
+ VALUE
111
+ rb_reserved(VALUE self)
112
+ {
113
+ return rb_ary_new3(3,
114
+ INT2NUM(CVCONTOUR(self)->reserved[0]),
115
+ INT2NUM(CVCONTOUR(self)->reserved[1]),
116
+ INT2NUM(CVCONTOUR(self)->reserved[2]));
117
+ }
118
+
119
+ /*
120
+ * call-seq:
121
+ * approx_poly(<i>approx_poly_option</i>) -> cvcontour
122
+ *
123
+ * Approximates polygonal curve(s) with desired precision.
124
+ * <i>approx_poly_option</i> should be Hash include these keys.
125
+ * :method - Approximation method.
126
+ * :dp - corresponds to Douglas-Peucker algorithm.
127
+ * :accuracy - approximation accuracy. (high-accuracy will create more simple contours)
128
+ * :recursive - (default false)
129
+ * If not nil or false, the function approximates all chains that access can be obtained to
130
+ * from self by h_next or v_next links. If 0, approximated this one.
131
+ */
132
+
133
+ VALUE
134
+ rb_approx_poly(int argc, VALUE *argv, VALUE self)
135
+ {
136
+ VALUE approx_poly_option, storage;
137
+ rb_scan_args(argc, argv, "01", &approx_poly_option);
138
+ approx_poly_option = APPROX_POLY_OPTION(approx_poly_option);
139
+ storage = cCvMemStorage::new_object();
140
+ /*
141
+ CvSeq *contour = cvApproxPoly(CVCONTOUR(self), sizeof(CvContour), CVMEMSTORAGE(storage),
142
+ APPROX_POLY_METHOD(approx_poly_option),
143
+ APPROX_POLY_ACCURACY(approx_poly_option),
144
+ APPROX_POLY_RECURSIVE(approx_poly_option));
145
+ return cCvSeq::new_sequence(cCvContour::rb_class(), contour, cCvPoint::rb_class(), storage);
146
+ */
147
+ return Qnil;
148
+ }
149
+
150
+ /*
151
+ * call-seq:
152
+ * bounding_rect -> rect
153
+ *
154
+ * Calculates up-right bounding rectangle of point set.
155
+ *
156
+ */
157
+ VALUE
158
+ rb_bounding_rect(VALUE self)
159
+ {
160
+ return cCvRect::new_object(cvBoundingRect(CVCONTOUR(self), 1));
161
+ }
162
+
163
+ /*
164
+ * call-seq:
165
+ * create_tree([threshold = 0.0]) -> cvcontourtree
166
+ *
167
+ * Creates hierarchical representation of contour.
168
+ * If the parameter <i>threshold</i> is less than or equal to 0,
169
+ * the method creates full binary tree representation.
170
+ * If the threshold is greater than 0, the function creates
171
+ * representation with the precision threshold:
172
+ */
173
+ VALUE
174
+ rb_create_tree(int argc, VALUE *argv, VALUE self)
175
+ {
176
+ VALUE threshold, storage;
177
+ rb_scan_args(argc, argv, "01", &threshold);
178
+ storage = cCvMemStorage::new_object();
179
+ CvContourTree *tree = cvCreateContourTree(CVSEQ(self), CVMEMSTORAGE(storage), IF_DBL(threshold, 0.0));
180
+ return cCvSeq::new_sequence(cCvContourTree::rb_class(), (CvSeq*)tree, cCvPoint::rb_class(), storage);
181
+ }
182
+
183
+ /*
184
+ * call-seq:
185
+ * in?(<i>point</i>) -> true or nil or false
186
+ *
187
+ * Determines whether the <i>point</i> is inside contour(true), outside(false), or lies on an edge(nil).
188
+ */
189
+ VALUE
190
+ rb_in_q(VALUE self, VALUE point)
191
+ {
192
+ double n = cvPointPolygonTest(CVARR(self), VALUE_TO_CVPOINT2D32F(point), 0);
193
+ return n == 0 ? Qnil : n > 0 ? Qtrue : Qfalse;
194
+ }
195
+
196
+ /*
197
+ * call-seq:
198
+ * measure_distance(<i>point</i>) -> float
199
+ *
200
+ * Return distance between the point and the nearest contour edge.
201
+ */
202
+ VALUE
203
+ rb_measure_distance(VALUE self, VALUE point)
204
+ {
205
+ return rb_float_new(cvPointPolygonTest(CVARR(self), VALUE_TO_CVPOINT2D32F(point), 1));
206
+ }
207
+
208
+
209
+ VALUE new_object()
210
+ {
211
+ VALUE storage = cCvMemStorage::new_object();
212
+ CvSeq *seq = cvCreateSeq(CV_SEQ_CONTOUR, sizeof(CvContour), sizeof(CvPoint), CVMEMSTORAGE(storage));
213
+ VALUE object = cCvSeq::new_sequence(cCvContour::rb_class(), seq, cCvPoint::rb_class(), storage);
214
+ return object;
215
+ }
216
+
217
+ __NAMESPACE_END_CVCONTOUR
218
+ __NAMESPACE_END_OPENCV
219
+
@@ -0,0 +1,47 @@
1
+ /************************************************************
2
+
3
+ cvcontour.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVCONTOUR_H
11
+ #define RUBY_OPENCV_CVCONTOUR_H
12
+ #include "opencv.h"
13
+
14
+ #define __NAMESPACE_BEGIN_CVCONTOUR namespace cCvContour{
15
+ #define __NAMESPACE_END_CVCONTOUR }
16
+
17
+ __NAMESPACE_BEGIN_OPENCV
18
+ __NAMESPACE_BEGIN_CVCONTOUR
19
+
20
+ VALUE rb_class();
21
+
22
+ void define_ruby_class();
23
+
24
+ VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
25
+ VALUE rb_rect(VALUE self);
26
+ VALUE rb_color(VALUE self);
27
+ VALUE rb_set_color(VALUE self, VALUE color);
28
+ VALUE rb_reserved(VALUE self);
29
+ VALUE rb_approx_poly(int argc, VALUE *argv, VALUE self);
30
+ VALUE rb_bounding_rect(VALUE self);
31
+ VALUE rb_create_tree(int argc, VALUE *argv, VALUE self);
32
+ VALUE rb_in_q(VALUE self, VALUE point);
33
+ VALUE rb_measure_distance(VALUE self, VALUE point);
34
+
35
+ VALUE new_object();
36
+ __NAMESPACE_END_CVCONTOUR
37
+
38
+ inline CvContour*
39
+ CVCONTOUR(VALUE object){
40
+ CvContour *ptr;
41
+ Data_Get_Struct(object, CvContour, ptr);
42
+ return ptr;
43
+ }
44
+
45
+ __NAMESPACE_END_OPENCV
46
+
47
+ #endif // RUBY_OPENCV_CVCONTOUR_H