bantic-ruby-opencv 0.0.8

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 (118) hide show
  1. data/CHANGELOG +2 -0
  2. data/License.txt +30 -0
  3. data/README.rdoc +90 -0
  4. data/Rakefile +15 -0
  5. data/examples/convexhull.rb +47 -0
  6. data/examples/face_detect.rb +24 -0
  7. data/examples/houghcircle.rb +23 -0
  8. data/examples/inpaint.png +0 -0
  9. data/examples/inpaint.rb +42 -0
  10. data/examples/paint.rb +71 -0
  11. data/examples/snake.rb +42 -0
  12. data/examples/stuff.jpg +0 -0
  13. data/ext/curve.cpp +103 -0
  14. data/ext/curve.h +34 -0
  15. data/ext/cvavgcomp.cpp +67 -0
  16. data/ext/cvavgcomp.h +39 -0
  17. data/ext/cvbox2d.cpp +114 -0
  18. data/ext/cvbox2d.h +53 -0
  19. data/ext/cvcapture.cpp +276 -0
  20. data/ext/cvcapture.h +54 -0
  21. data/ext/cvchain.cpp +184 -0
  22. data/ext/cvchain.h +43 -0
  23. data/ext/cvchaincode.cpp +49 -0
  24. data/ext/cvchaincode.h +43 -0
  25. data/ext/cvcircle32f.cpp +90 -0
  26. data/ext/cvcircle32f.h +53 -0
  27. data/ext/cvcondensation.cpp +230 -0
  28. data/ext/cvcondensation.h +49 -0
  29. data/ext/cvconnectedcomp.cpp +115 -0
  30. data/ext/cvconnectedcomp.h +46 -0
  31. data/ext/cvcontour.cpp +217 -0
  32. data/ext/cvcontour.h +47 -0
  33. data/ext/cvcontourtree.cpp +86 -0
  34. data/ext/cvcontourtree.h +41 -0
  35. data/ext/cvconvexitydefect.cpp +103 -0
  36. data/ext/cvconvexitydefect.h +42 -0
  37. data/ext/cverror.cpp +140 -0
  38. data/ext/cverror.h +79 -0
  39. data/ext/cvfont.cpp +173 -0
  40. data/ext/cvfont.h +56 -0
  41. data/ext/cvhaarclassifiercascade.cpp +159 -0
  42. data/ext/cvhaarclassifiercascade.h +41 -0
  43. data/ext/cvhistogram.cpp +200 -0
  44. data/ext/cvhistogram.h +51 -0
  45. data/ext/cvindex.cpp +73 -0
  46. data/ext/cvindex.h +40 -0
  47. data/ext/cvline.cpp +106 -0
  48. data/ext/cvline.h +52 -0
  49. data/ext/cvmat.cpp +4809 -0
  50. data/ext/cvmat.h +286 -0
  51. data/ext/cvmatnd.cpp +44 -0
  52. data/ext/cvmatnd.h +28 -0
  53. data/ext/cvmemstorage.cpp +64 -0
  54. data/ext/cvmemstorage.h +53 -0
  55. data/ext/cvmoments.cpp +204 -0
  56. data/ext/cvmoments.h +48 -0
  57. data/ext/cvpoint.cpp +229 -0
  58. data/ext/cvpoint.h +59 -0
  59. data/ext/cvpoint2d32f.cpp +213 -0
  60. data/ext/cvpoint2d32f.h +61 -0
  61. data/ext/cvpoint3d32f.cpp +245 -0
  62. data/ext/cvpoint3d32f.h +64 -0
  63. data/ext/cvrect.cpp +340 -0
  64. data/ext/cvrect.h +79 -0
  65. data/ext/cvscalar.cpp +227 -0
  66. data/ext/cvscalar.h +63 -0
  67. data/ext/cvseq.cpp +583 -0
  68. data/ext/cvseq.h +71 -0
  69. data/ext/cvset.cpp +63 -0
  70. data/ext/cvset.h +39 -0
  71. data/ext/cvsize.cpp +223 -0
  72. data/ext/cvsize.h +63 -0
  73. data/ext/cvsize2d32f.cpp +180 -0
  74. data/ext/cvsize2d32f.h +59 -0
  75. data/ext/cvslice.cpp +82 -0
  76. data/ext/cvslice.h +53 -0
  77. data/ext/cvsparsemat.cpp +44 -0
  78. data/ext/cvsparsemat.h +28 -0
  79. data/ext/cvtermcriteria.cpp +183 -0
  80. data/ext/cvtermcriteria.h +71 -0
  81. data/ext/cvtwopoints.cpp +98 -0
  82. data/ext/cvtwopoints.h +50 -0
  83. data/ext/cvvector.cpp +206 -0
  84. data/ext/cvvector.h +54 -0
  85. data/ext/cvvideowriter.cpp +116 -0
  86. data/ext/cvvideowriter.h +41 -0
  87. data/ext/extconf.rb +58 -0
  88. data/ext/gui.cpp +65 -0
  89. data/ext/gui.h +33 -0
  90. data/ext/iplconvkernel.cpp +177 -0
  91. data/ext/iplconvkernel.h +52 -0
  92. data/ext/iplimage.cpp +238 -0
  93. data/ext/iplimage.h +54 -0
  94. data/ext/mouseevent.cpp +184 -0
  95. data/ext/mouseevent.h +59 -0
  96. data/ext/opencv.cpp +481 -0
  97. data/ext/opencv.h +356 -0
  98. data/ext/point3dset.cpp +41 -0
  99. data/ext/point3dset.h +31 -0
  100. data/ext/pointset.cpp +238 -0
  101. data/ext/pointset.h +69 -0
  102. data/ext/trackbar.cpp +122 -0
  103. data/ext/trackbar.h +65 -0
  104. data/ext/window.cpp +368 -0
  105. data/ext/window.h +56 -0
  106. data/images/CvMat_sobel.png +0 -0
  107. data/images/CvMat_sub_rect.png +0 -0
  108. data/images/CvSeq_relationmap.png +0 -0
  109. data/images/face_detect_from_lena.jpg +0 -0
  110. data/lib/opencv.rb +3 -0
  111. data/lib/version.rb +3 -0
  112. data/metadata +191 -0
  113. data/ruby-opencv.gemspec +33 -0
  114. data/setup/setup.cygwin.rb +120 -0
  115. data/setup/setup.mingw.rb +99 -0
  116. data/setup/setup.mswin32.rb +103 -0
  117. data/test/test_opencv.rb +6 -0
  118. metadata +272 -0
@@ -0,0 +1,159 @@
1
+ /************************************************************
2
+
3
+ cvhaarclassifercascade.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2007 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvhaarclassifiercascade.h"
11
+ /*
12
+ * Document-class: OpenCV::CvHaarClassifierCascade
13
+ *
14
+ * CvHaarClassifierCascade object is "fast-object-detector".
15
+ * This detector can discover object (e.g. human's face) from image.
16
+ *
17
+ * Find face-area from picture "lena"...
18
+ * link:../images/face_detect_from_lena.jpg
19
+ */
20
+ __NAMESPACE_BEGIN_OPENCV
21
+ __NAMESPACE_BEGIN_CVHAARCLASSIFERCASCADE
22
+
23
+ VALUE rb_klass;
24
+
25
+ VALUE
26
+ rb_class()
27
+ {
28
+ return rb_klass;
29
+ }
30
+
31
+ void define_ruby_class()
32
+ {
33
+ if (rb_klass)
34
+ return;
35
+ /*
36
+ * opencv = rb_define_module("OpenCV");
37
+ *
38
+ * note: this comment is used by rdoc.
39
+ */
40
+ VALUE opencv = rb_module_opencv();
41
+
42
+ rb_klass = rb_define_class_under(opencv, "CvHaarClassifierCascade", rb_cObject);
43
+ rb_define_alloc_func(rb_klass, rb_allocate);
44
+ rb_define_singleton_method(rb_klass, "load", RUBY_METHOD_FUNC(rb_load), 1);
45
+ rb_define_method(rb_klass, "detect_objects", RUBY_METHOD_FUNC(rb_detect_objects), -1);
46
+ rb_define_method(rb_klass, "detect_objects_with_pruning", RUBY_METHOD_FUNC(rb_detect_objects_with_pruning), -1);
47
+ }
48
+
49
+ VALUE
50
+ rb_allocate(VALUE klass)
51
+ {
52
+ return OPENCV_OBJECT(klass, 0);
53
+ }
54
+
55
+ /*
56
+ * call-seq:
57
+ * CvHaarClassiferCascade.load(<i>path</i>) -> object-detector
58
+ *
59
+ * Load trained cascade of haar classifers from file.
60
+ * Object detection classifiers are stored in XML or YAML files.
61
+ * sample of object detection classifier files is included by OpenCV.
62
+ *
63
+ * You can found these at
64
+ * C:\Program Files\OpenCV\data\haarcascades\*.xml (Windows, default install path)
65
+ *
66
+ * e.g. you want to try to detect human's face.
67
+ * detector = CvHaarClassiferCascade.load("haarcascade_frontalface_alt.xml")
68
+ */
69
+ VALUE
70
+ rb_load(VALUE klass, VALUE path)
71
+ {
72
+ CvHaarClassifierCascade *cascade = (CvHaarClassifierCascade*)cvLoad(StringValueCStr(path), 0, 0, 0);
73
+ if(!CV_IS_HAAR_CLASSIFIER(cascade))
74
+ rb_raise(rb_eTypeError, "invalid format haar classifier cascade file.");
75
+ return OPENCV_OBJECT(rb_klass, cascade);
76
+ }
77
+
78
+ VALUE
79
+ rb_save(VALUE self, VALUE path)
80
+ {
81
+ rb_raise(rb_eNotImpError, "");
82
+ }
83
+
84
+ /*
85
+ * call-seq:
86
+ * detect_objects(image[,scale_factor = 1.1, min_neighbor = 3, min_size = CvSize.new(0,0)]) -> cvseq(include CvAvgComp object)
87
+ * detect_objects(image[,scale_factor = 1.1, min_neighbor = 3, min_size = CvSize.new(0,0)]){|cmp| ... } -> cvseq(include CvAvgComp object)
88
+ *
89
+ * Detects objects in the image. This method finds rectangular regions in the
90
+ * given image that are likely to contain objects the cascade has been trained
91
+ * for and return those regions as a sequence of rectangles.
92
+ *
93
+ * * scale_factor (should be > 1.0)
94
+ * The factor by which the search window is scaled between the subsequent scans, for example, 1.1 mean increasing window by 10%.
95
+ * * min_neighbors
96
+ * Minimum number (minus 1) of neighbor rectangles that makes up an object.
97
+ * All the groups of a smaller number of rectangles than min_neighbors - 1 are rejected.
98
+ * If min_neighbors is 0, the function does not any grouping at all and returns all the detected
99
+ * candidate rectangles, whitch many be useful if the user wants to apply a customized grouping procedure.
100
+ * * min_size
101
+ * Minimum window size. By default, it is set to size of samples the classifier has been trained on.
102
+ */
103
+ VALUE
104
+ rb_detect_objects(int argc, VALUE *argv, VALUE self)
105
+ {
106
+ VALUE image, storage, scale_factor, min_neighbors, min_size, result;
107
+ rb_scan_args(argc, argv, "14", &image, &storage, &scale_factor, &min_neighbors, &min_size);
108
+ if (!rb_obj_is_kind_of(image, cCvMat::rb_class()))
109
+ rb_raise(rb_eTypeError, "argument 1(target-image) should be %s.", rb_class2name(cCvMat::rb_class()));
110
+ double scale = IF_DBL(scale_factor, 1.1);
111
+ if (!(scale > 1.0))
112
+ rb_raise(rb_eArgError, "argument 2 (scale factor) must > 1.0.");
113
+ storage = CHECK_CVMEMSTORAGE(storage);
114
+ CvSeq *seq = cvHaarDetectObjects(CVMAT(image), CVHAARCLASSIFIERCASCADE(self), CVMEMSTORAGE(storage),
115
+ scale, IF_INT(min_neighbors, 3), 0, NIL_P(min_size) ? cvSize(0,0) : VALUE_TO_CVSIZE(min_size));
116
+ result = cCvSeq::new_sequence(cCvSeq::rb_class(), seq, cCvAvgComp::rb_class(), storage);
117
+ if (rb_block_given_p()) {
118
+ for(int i = 0; i < seq->total; i++)
119
+ rb_yield(REFER_OBJECT(cCvAvgComp::rb_class(), cvGetSeqElem(seq, i), storage));
120
+ }
121
+ return result;
122
+ }
123
+
124
+ /*
125
+ * call-seq:
126
+ * detect_objects_with_pruning(image[,scale_factor = 1.1, min_neighbor = 3, min_size = CvSize.new(0,0)]) -> cvseq(include CvAvgComp object)
127
+ * detect_objects_with_pruning(image[,scale_factor = 1.1, min_neighbor = 3, min_size = CvSize.new(0,0)]){|cmp| ... } -> cvseq(include CvAvgComp object)
128
+ *
129
+ * Almost same to #detect_objects (Return detected objects).
130
+ *
131
+ * Before scanning to image, Canny edge detector to reject some image regions
132
+ * that contain too few or too much edges, and thus can not contain the searched object.
133
+ *
134
+ * note: The particular threshold values are tuned for face detection.
135
+ * And in this case the pruning speeds up the processing.
136
+ */
137
+ VALUE
138
+ rb_detect_objects_with_pruning(int argc, VALUE *argv, VALUE self)
139
+ {
140
+ VALUE image, storage, scale_factor, min_neighbors, min_size, result;
141
+ rb_scan_args(argc, argv, "14", &image, &storage, &scale_factor, &min_neighbors, &min_size);
142
+ if (!rb_obj_is_kind_of(image, cCvMat::rb_class()))
143
+ rb_raise(rb_eTypeError, "argument 1(target-image) should be %s.", rb_class2name(cCvMat::rb_class()));
144
+ double scale = IF_DBL(scale_factor, 1.1);
145
+ if (!(scale > 1.0))
146
+ rb_raise(rb_eArgError, "argument 2 (scale factor) must > 1.0.");
147
+ storage = CHECK_CVMEMSTORAGE(storage);
148
+ CvSeq *seq = cvHaarDetectObjects(CVMAT(image), CVHAARCLASSIFIERCASCADE(self), CVMEMSTORAGE(storage),
149
+ scale, IF_INT(min_neighbors, 3), CV_HAAR_DO_CANNY_PRUNING, NIL_P(min_size) ? cvSize(0,0) : VALUE_TO_CVSIZE(min_size));
150
+ result = cCvSeq::new_sequence(cCvSeq::rb_class(), seq, cCvAvgComp::rb_class(), storage);
151
+ if (rb_block_given_p()) {
152
+ for(int i = 0; i < seq->total; i++)
153
+ rb_yield(REFER_OBJECT(cCvAvgComp::rb_class(), cvGetSeqElem(seq, i), storage));
154
+ }
155
+ return result;
156
+ }
157
+
158
+ __NAMESPACE_END_CVHAARCLASSIFERCASCADE
159
+ __NAMESPACE_END_OPENCV
@@ -0,0 +1,41 @@
1
+ /************************************************************
2
+
3
+ cvhaarclassifiercascade.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2006 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVHAARCLASSIFIERCASCADE_H
11
+ #define RUBY_OPENCV_CVHAARCLASSIFIERCASCADE_H
12
+
13
+ #define __NAMESPACE_BEGIN_CVHAARCLASSIFERCASCADE namespace cCvHaarClassifierCascade{
14
+ #define __NAMESPACE_END_CVHAARCLASSIFERCASCADE }
15
+
16
+ #include"opencv.h"
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVHAARCLASSIFERCASCADE
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_load(VALUE klass, VALUE path);
29
+ VALUE rb_save(VALUE self, VALUE name);
30
+ VALUE rb_detect_objects(int argc, VALUE *argv, VALUE self);
31
+ VALUE rb_detect_objects_with_pruning(int argc, VALUE *argv, VALUE self);
32
+
33
+ __NAMESPACE_END_CVHAARCLASSIFERCASCADE
34
+ inline CvHaarClassifierCascade *CVHAARCLASSIFIERCASCADE(VALUE object){
35
+ CvHaarClassifierCascade *ptr;
36
+ Data_Get_Struct(object, CvHaarClassifierCascade, ptr);
37
+ return ptr;
38
+ }
39
+ __NAMESPACE_END_OPENCV
40
+
41
+ #endif // RUBY_OPENCV_CVHAARCLASSIFIERCASCADE_H
@@ -0,0 +1,200 @@
1
+ /************************************************************
2
+
3
+ cvhistogram.cpp -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2008 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #include "cvhistogram.h"
11
+ /*
12
+ * Document-class: OpenCV::CvHistogram
13
+ *
14
+ * Muti-dimensional histogram.
15
+ */
16
+ __NAMESPACE_BEGIN_OPENCV
17
+ __NAMESPACE_BEGIN_CVHISTOGRAM
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, "CvHistogram", rb_cObject);
40
+
41
+ rb_define_method(rb_klass, "is_uniform?", RUBY_METHOD_FUNC(rb_is_uniform), 0);
42
+ rb_define_method(rb_klass, "is_sparse?", RUBY_METHOD_FUNC(rb_is_sparse), 0);
43
+ rb_define_method(rb_klass, "has_range?", RUBY_METHOD_FUNC(rb_has_range), 0);
44
+ rb_define_method(rb_klass, "dims", RUBY_METHOD_FUNC(rb_dims), 0);
45
+
46
+ rb_define_method(rb_klass, "normalize", RUBY_METHOD_FUNC(rb_normalize), 1);
47
+ rb_define_method(rb_klass, "normalize!", RUBY_METHOD_FUNC(rb_normalize_bang), 1);
48
+ rb_define_method(rb_klass, "thresh", RUBY_METHOD_FUNC(rb_thresh), 1);
49
+ rb_define_alias(rb_klass, "threshold", "thresh");
50
+ rb_define_method(rb_klass, "thresh!", RUBY_METHOD_FUNC(rb_thresh_bang), 1);
51
+ rb_define_alias(rb_klass, "threshold!", "thresh!");
52
+ }
53
+
54
+ VALUE
55
+ rb_allocate(VALUE klass)
56
+ {
57
+ // not yet
58
+ return Qnil;
59
+ }
60
+
61
+ /*
62
+ * call-seq:
63
+ * is_uniform? -> true or false
64
+ *
65
+ */
66
+ VALUE
67
+ rb_is_uniform(VALUE self)
68
+ {
69
+ return CV_IS_UNIFORM_HIST(CVHISTOGRAM(self)) ? Qtrue : Qfalse;
70
+ }
71
+
72
+ /*
73
+ * call-seq:
74
+ * is_sparse? -> true or false
75
+ *
76
+ */
77
+ VALUE
78
+ rb_is_sparse(VALUE self)
79
+ {
80
+ return CV_IS_SPARSE_HIST(CVHISTOGRAM(self)) ? Qtrue : Qfalse;
81
+ }
82
+
83
+ /*
84
+ * call-seq:
85
+ * has_range? -> true or false
86
+ */
87
+ VALUE
88
+ rb_has_range(VALUE self)
89
+ {
90
+ return CV_HIST_HAS_RANGES(CVHISTOGRAM(self)) ? Qtrue : Qfalse;
91
+ }
92
+
93
+ /*
94
+ * call-seq:
95
+ * dims -> [int[,int...]]
96
+ */
97
+ VALUE
98
+ rb_dims(VALUE self)
99
+ {
100
+ int size[CV_MAX_DIM];
101
+ int dims = cvGetDims(CVHISTOGRAM(self)->bins, size);
102
+ VALUE result = rb_ary_new2(dims);
103
+ for(int i = 0; i < dims; i++){
104
+ rb_ary_store(result, i, INT2FIX(size[i]));
105
+ }
106
+ return result;
107
+ }
108
+
109
+ /*
110
+ * call-seq:
111
+ * bins -> cvmatnd or cvsparsemat
112
+ */
113
+ VALUE
114
+ rb_bins(VALUE self)
115
+ {
116
+ CvHistogram *hist = CVHISTOGRAM(self);
117
+ return REFER_OBJECT(CV_IS_SPARSE_HIST(hist) ? cCvSparseMat::rb_class() : cCvMatND::rb_class(), hist->bins, self);
118
+ }
119
+
120
+ /*
121
+ * call-seq:
122
+ * copy -> cvhist
123
+ *
124
+ * Clone histogram.
125
+ */
126
+ VALUE
127
+ rb_copy(VALUE self)
128
+ {
129
+ VALUE dest = 0;
130
+ CvHistogram *hist = CVHISTOGRAM(dest);
131
+ cvCopyHist(CVHISTOGRAM(self), &hist);
132
+ return dest;
133
+ }
134
+
135
+ /*
136
+ * call-seq:
137
+ * clear!
138
+ *
139
+ * Sets all histogram bins to 0 in case of dense histogram and removes all histogram bins in case of sparse array.
140
+ */
141
+ VALUE
142
+ rb_clear_bang(VALUE self)
143
+ {
144
+ cvClearHist(CVHISTOGRAM(self));
145
+ return self;
146
+ }
147
+
148
+ /*
149
+ * call-seq:
150
+ * normalize(<i>factor</i>) -> cvhist
151
+ *
152
+ * Return normalized the histogram bins by scaling them, such that the sum of the bins becomes equal to <i>factor</i>.
153
+ */
154
+ VALUE
155
+ rb_normalize(VALUE self, VALUE factor)
156
+ {
157
+ return rb_normalize_bang(rb_copy(self), factor);
158
+ }
159
+
160
+ /*
161
+ * call-seq:
162
+ * normalize!(<i>factor</i>) -> self
163
+ *
164
+ * normalizes the histogram bins by scaling them, such that the sum of the bins becomes equal to <i>factor</i>.
165
+ */
166
+ VALUE
167
+ rb_normalize_bang(VALUE self, VALUE factor)
168
+ {
169
+ cvNormalizeHist(CVHISTOGRAM(self), NUM2DBL(factor));
170
+ return self;
171
+ }
172
+
173
+ /*
174
+ * call-seq:
175
+ * thresh(<i>factor</i>) -> cvhist
176
+ *
177
+ * Return cleared histogram bins that are below the specified threshold.
178
+ */
179
+ VALUE
180
+ rb_thresh(VALUE self, VALUE factor)
181
+ {
182
+ return rb_thresh_bang(rb_copy(self), factor);
183
+ }
184
+
185
+ /*
186
+ * call-seq:
187
+ * thresh!(<i>factor</i>) -> self
188
+ *
189
+ * Cleares histogram bins that are below the specified threshold.
190
+ */
191
+ VALUE
192
+ rb_thresh_bang(VALUE self, VALUE factor)
193
+ {
194
+ cvThreshHist(CVHISTOGRAM(self), NUM2DBL(factor));
195
+ return self;
196
+ }
197
+
198
+
199
+ __NAMESPACE_END_CVHISTOGRAM
200
+ __NAMESPACE_END_OPENCV
@@ -0,0 +1,51 @@
1
+ /************************************************************
2
+
3
+ cvhistogram.h -
4
+
5
+ $Author: lsxi $
6
+
7
+ Copyright (C) 2005-2008 Masakazu Yonekura
8
+
9
+ ************************************************************/
10
+ #ifndef RUBY_OPENCV_CVHISTOGRAM_H
11
+ #define RUBY_OPENCV_CVHISTOGRAM_H
12
+
13
+ #include "opencv.h"
14
+
15
+ #define __NAMESPACE_BEGIN_CVHISTOGRAM namespace cCvHistogram{
16
+ #define __NAMESPACE_END_CVHISTOGRAM }
17
+
18
+ __NAMESPACE_BEGIN_OPENCV
19
+ __NAMESPACE_BEGIN_CVHISTOGRAM
20
+
21
+ VALUE rb_class();
22
+
23
+ void define_ruby_class();
24
+
25
+ VALUE rb_is_uniform(VALUE self);
26
+ VALUE rb_is_sparse(VALUE self);
27
+ VALUE rb_has_range(VALUE self);
28
+ VALUE rb_dims(VALUE self);
29
+ VALUE rb_bins(VALUE self);
30
+
31
+ VALUE rb_clear(VALUE self);
32
+ VALUE rb_clear_bang(VALUE self);
33
+
34
+ VALUE rb_normalize(VALUE self, VALUE factor);
35
+ VALUE rb_normalize_bang(VALUE self, VALUE factor);
36
+ VALUE rb_thresh(VALUE self, VALUE factor);
37
+ VALUE rb_thresh_bang(VALUE self, VALUE factor);
38
+
39
+ __NAMESPACE_END_CVHISTOGRAM
40
+
41
+ inline CvHistogram
42
+ *CVHISTOGRAM(VALUE object)
43
+ {
44
+ CvHistogram *ptr;
45
+ Data_Get_Struct(object, CvHistogram, ptr);
46
+ return ptr;
47
+ }
48
+
49
+ __NAMESPACE_END_OPENCV
50
+
51
+ #endif // RUBY_OPENCV_CVHISTOGRAM_H