ruby-opencv 0.0.11 → 0.0.12.pre
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.yardopts +3 -0
- data/Gemfile +1 -0
- data/Manifest.txt +2 -14
- data/README.md +1 -1
- data/Rakefile +10 -1
- data/examples/facerec/facerec_lbph.rb +1 -1
- data/ext/opencv/algorithm.cpp +6 -1
- data/ext/opencv/algorithm.h +1 -1
- data/ext/opencv/curve.cpp +48 -33
- data/ext/opencv/curve.h +1 -1
- data/ext/opencv/cvavgcomp.cpp +22 -25
- data/ext/opencv/cvavgcomp.h +1 -1
- data/ext/opencv/cvbox2d.cpp +56 -58
- data/ext/opencv/cvbox2d.h +1 -1
- data/ext/opencv/cvcapture.cpp +210 -109
- data/ext/opencv/cvcapture.h +1 -1
- data/ext/opencv/cvchain.cpp +71 -71
- data/ext/opencv/cvchain.h +1 -1
- data/ext/opencv/cvcircle32f.cpp +37 -27
- data/ext/opencv/cvcircle32f.h +1 -1
- data/ext/opencv/cvconnectedcomp.cpp +49 -36
- data/ext/opencv/cvconnectedcomp.h +1 -1
- data/ext/opencv/cvcontour.cpp +117 -81
- data/ext/opencv/cvcontour.h +1 -1
- data/ext/opencv/cvcontourtree.cpp +37 -32
- data/ext/opencv/cvcontourtree.h +1 -1
- data/ext/opencv/cvconvexitydefect.cpp +33 -44
- data/ext/opencv/cvconvexitydefect.h +1 -1
- data/ext/opencv/cverror.cpp +22 -66
- data/ext/opencv/cverror.h +1 -1
- data/ext/opencv/cvfeaturetree.cpp +31 -33
- data/ext/opencv/cvfeaturetree.h +1 -1
- data/ext/opencv/cvfont.cpp +98 -78
- data/ext/opencv/cvfont.h +1 -1
- data/ext/opencv/cvhaarclassifiercascade.cpp +39 -59
- data/ext/opencv/cvhaarclassifiercascade.h +1 -1
- data/ext/opencv/cvhistogram.cpp +259 -90
- data/ext/opencv/cvhistogram.h +1 -1
- data/ext/opencv/cvhumoments.cpp +99 -60
- data/ext/opencv/cvhumoments.h +1 -1
- data/ext/opencv/cvline.cpp +45 -40
- data/ext/opencv/cvline.h +1 -1
- data/ext/opencv/cvmat.cpp +1894 -1829
- data/ext/opencv/cvmat.h +2 -3
- data/ext/opencv/cvmemstorage.cpp +19 -14
- data/ext/opencv/cvmemstorage.h +1 -1
- data/ext/opencv/cvmoments.cpp +51 -45
- data/ext/opencv/cvmoments.h +1 -1
- data/ext/opencv/cvpoint.cpp +32 -26
- data/ext/opencv/cvpoint.h +1 -1
- data/ext/opencv/cvpoint2d32f.cpp +31 -26
- data/ext/opencv/cvpoint2d32f.h +1 -1
- data/ext/opencv/cvpoint3d32f.cpp +36 -29
- data/ext/opencv/cvpoint3d32f.h +1 -1
- data/ext/opencv/cvrect.cpp +38 -33
- data/ext/opencv/cvrect.h +1 -1
- data/ext/opencv/cvscalar.cpp +50 -45
- data/ext/opencv/cvscalar.h +1 -1
- data/ext/opencv/cvseq.cpp +53 -47
- data/ext/opencv/cvseq.h +1 -1
- data/ext/opencv/cvsize.cpp +32 -26
- data/ext/opencv/cvsize.h +1 -1
- data/ext/opencv/cvsize2d32f.cpp +31 -25
- data/ext/opencv/cvsize2d32f.h +1 -1
- data/ext/opencv/cvslice.cpp +28 -22
- data/ext/opencv/cvslice.h +1 -1
- data/ext/opencv/cvsurfparams.cpp +37 -28
- data/ext/opencv/cvsurfparams.h +1 -1
- data/ext/opencv/cvsurfpoint.cpp +76 -53
- data/ext/opencv/cvsurfpoint.h +1 -1
- data/ext/opencv/cvtermcriteria.cpp +32 -26
- data/ext/opencv/cvtermcriteria.h +1 -1
- data/ext/opencv/cvtwopoints.cpp +28 -22
- data/ext/opencv/cvtwopoints.h +1 -1
- data/ext/opencv/cvvideowriter.cpp +25 -20
- data/ext/opencv/cvvideowriter.h +1 -1
- data/ext/opencv/eigenfaces.cpp +10 -2
- data/ext/opencv/eigenfaces.h +1 -1
- data/ext/opencv/facerecognizer.cpp +15 -8
- data/ext/opencv/facerecognizer.h +2 -2
- data/ext/opencv/fisherfaces.cpp +10 -2
- data/ext/opencv/fisherfaces.h +1 -1
- data/ext/opencv/gui.cpp +26 -23
- data/ext/opencv/gui.h +1 -1
- data/ext/opencv/iplconvkernel.cpp +30 -24
- data/ext/opencv/iplconvkernel.h +1 -1
- data/ext/opencv/iplimage.cpp +49 -42
- data/ext/opencv/iplimage.h +1 -1
- data/ext/opencv/lbph.cpp +10 -2
- data/ext/opencv/lbph.h +1 -1
- data/ext/opencv/mouseevent.cpp +30 -25
- data/ext/opencv/mouseevent.h +1 -1
- data/ext/opencv/opencv.cpp +59 -60
- data/ext/opencv/opencv.h +1 -5
- data/ext/opencv/pointset.cpp +31 -25
- data/ext/opencv/pointset.h +1 -1
- data/ext/opencv/trackbar.cpp +27 -21
- data/ext/opencv/trackbar.h +1 -1
- data/ext/opencv/window.cpp +77 -57
- data/ext/opencv/window.h +1 -1
- data/lib/opencv/version.rb +2 -1
- data/ruby-opencv.gemspec +19 -18
- data/test/test_opencv.rb +5 -3
- data/yard_extension.rb +5 -0
- metadata +13 -27
- data/examples/matching_to_many_images/matching_to_many_images.rb +0 -16
- data/examples/matching_to_many_images/query.png +0 -0
- data/examples/matching_to_many_images/train/1.png +0 -0
- data/examples/matching_to_many_images/train/2.png +0 -0
- data/examples/matching_to_many_images/train/3.png +0 -0
- data/examples/matching_to_many_images/train/trainImages.txt +0 -3
- data/ext/opencv/cvcondensation.cpp +0 -282
- data/ext/opencv/cvcondensation.h +0 -49
- data/ext/opencv/cvmatnd.cpp +0 -44
- data/ext/opencv/cvmatnd.h +0 -28
- data/ext/opencv/cvsparsemat.cpp +0 -44
- data/ext/opencv/cvsparsemat.h +0 -28
- data/images/face_detect_from_lena.jpg +0 -0
- data/test/test_cvmat_matching.rb +0 -57
data/ext/opencv/pointset.cpp
CHANGED
|
@@ -23,29 +23,6 @@ rb_module()
|
|
|
23
23
|
return module;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
void
|
|
27
|
-
define_ruby_module()
|
|
28
|
-
{
|
|
29
|
-
if (module)
|
|
30
|
-
return;
|
|
31
|
-
/*
|
|
32
|
-
* opencv = rb_define_module("OpenCV");
|
|
33
|
-
*
|
|
34
|
-
* note: this comment is used by rdoc.
|
|
35
|
-
*/
|
|
36
|
-
VALUE opencv = rb_module_opencv();
|
|
37
|
-
module = rb_define_module_under(opencv, "PointSet");
|
|
38
|
-
rb_define_method(module, "contour_area", RUBY_METHOD_FUNC(rb_contour_area), -1);
|
|
39
|
-
rb_define_method(module, "fit_ellipse2", RUBY_METHOD_FUNC(rb_fit_ellipse2), 0);
|
|
40
|
-
|
|
41
|
-
rb_define_method(module, "convex_hull2", RUBY_METHOD_FUNC(rb_convex_hull2), -1);
|
|
42
|
-
rb_define_method(module, "check_contour_convexity", RUBY_METHOD_FUNC(rb_check_contour_convexity), 0);
|
|
43
|
-
rb_define_alias(module, "convexity?", "check_contour_convexity");
|
|
44
|
-
rb_define_method(module, "convexity_defects", RUBY_METHOD_FUNC(rb_convexity_defects), 1);
|
|
45
|
-
rb_define_method(module, "min_area_rect2", RUBY_METHOD_FUNC(rb_min_area_rect2), 0);
|
|
46
|
-
rb_define_method(module, "min_enclosing_circle", RUBY_METHOD_FUNC(rb_min_enclosing_circle), 0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
26
|
/*
|
|
50
27
|
* call-seq:
|
|
51
28
|
* contour_area -> float
|
|
@@ -90,7 +67,7 @@ rb_fit_ellipse2(VALUE self)
|
|
|
90
67
|
|
|
91
68
|
/*
|
|
92
69
|
* call-seq:
|
|
93
|
-
* convex_hull2(
|
|
70
|
+
* convex_hull2([orientation_clockwise = true]) -> cvcontour
|
|
94
71
|
*
|
|
95
72
|
* Finds convex hull of 2D point set using Sklansky's algorithm.
|
|
96
73
|
*
|
|
@@ -136,7 +113,7 @@ rb_check_contour_convexity(VALUE self)
|
|
|
136
113
|
|
|
137
114
|
/*
|
|
138
115
|
* call-seq:
|
|
139
|
-
* convexity_defects(
|
|
116
|
+
* convexity_defects(hull) -> cvseq(include CvConvexityDefect)
|
|
140
117
|
*
|
|
141
118
|
* Finds convexity defects of contour.
|
|
142
119
|
*/
|
|
@@ -197,6 +174,34 @@ rb_min_enclosing_circle(VALUE self)
|
|
|
197
174
|
return success ? circle : Qnil;
|
|
198
175
|
}
|
|
199
176
|
|
|
177
|
+
void
|
|
178
|
+
init_ruby_module()
|
|
179
|
+
{
|
|
180
|
+
#if 0
|
|
181
|
+
// For documentation using YARD
|
|
182
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
183
|
+
#endif
|
|
184
|
+
|
|
185
|
+
if (module)
|
|
186
|
+
return;
|
|
187
|
+
/*
|
|
188
|
+
* opencv = rb_define_module("OpenCV");
|
|
189
|
+
*
|
|
190
|
+
* note: this comment is used by rdoc.
|
|
191
|
+
*/
|
|
192
|
+
VALUE opencv = rb_module_opencv();
|
|
193
|
+
module = rb_define_module_under(opencv, "PointSet");
|
|
194
|
+
rb_define_method(module, "contour_area", RUBY_METHOD_FUNC(rb_contour_area), -1);
|
|
195
|
+
rb_define_method(module, "fit_ellipse2", RUBY_METHOD_FUNC(rb_fit_ellipse2), 0);
|
|
196
|
+
|
|
197
|
+
rb_define_method(module, "convex_hull2", RUBY_METHOD_FUNC(rb_convex_hull2), -1);
|
|
198
|
+
rb_define_method(module, "check_contour_convexity", RUBY_METHOD_FUNC(rb_check_contour_convexity), 0);
|
|
199
|
+
rb_define_alias(module, "convexity?", "check_contour_convexity");
|
|
200
|
+
rb_define_method(module, "convexity_defects", RUBY_METHOD_FUNC(rb_convexity_defects), 1);
|
|
201
|
+
rb_define_method(module, "min_area_rect2", RUBY_METHOD_FUNC(rb_min_area_rect2), 0);
|
|
202
|
+
rb_define_method(module, "min_enclosing_circle", RUBY_METHOD_FUNC(rb_min_enclosing_circle), 0);
|
|
203
|
+
}
|
|
204
|
+
|
|
200
205
|
__NAMESPACE_END_POINT_SET
|
|
201
206
|
|
|
202
207
|
int
|
|
@@ -272,3 +277,4 @@ VALUE_TO_POINT_SET(VALUE object)
|
|
|
272
277
|
}
|
|
273
278
|
|
|
274
279
|
__NAMESPACE_END_OPENCV
|
|
280
|
+
|
data/ext/opencv/pointset.h
CHANGED
|
@@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_POINT_SET
|
|
|
20
20
|
|
|
21
21
|
VALUE rb_module();
|
|
22
22
|
|
|
23
|
-
void
|
|
23
|
+
void init_ruby_module();
|
|
24
24
|
VALUE rb_contour_area(int argc, VALUE *argv, VALUE self);
|
|
25
25
|
VALUE rb_fit_ellipse2(VALUE self);
|
|
26
26
|
VALUE rb_convex_hull2(int argc, VALUE *argv, VALUE self);
|
data/ext/opencv/trackbar.cpp
CHANGED
|
@@ -25,25 +25,6 @@ VALUE rb_class() {
|
|
|
25
25
|
return rb_klass;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
void define_ruby_class() {
|
|
29
|
-
if (rb_klass)
|
|
30
|
-
return;
|
|
31
|
-
/*
|
|
32
|
-
* opencv = rb_define_module("OpenCV");
|
|
33
|
-
* GUI = rb_define_module_under(opencv, "GUI");
|
|
34
|
-
*
|
|
35
|
-
* note: this comment is used by rdoc.
|
|
36
|
-
*/
|
|
37
|
-
VALUE GUI = rb_module_GUI();
|
|
38
|
-
rb_klass = rb_define_class_under(GUI, "Trackbar", rb_cObject);
|
|
39
|
-
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
40
|
-
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
41
|
-
rb_define_method(rb_klass, "name", RUBY_METHOD_FUNC(rb_name), 0);
|
|
42
|
-
rb_define_method(rb_klass, "max", RUBY_METHOD_FUNC(rb_max), 0);
|
|
43
|
-
rb_define_method(rb_klass, "value", RUBY_METHOD_FUNC(rb_value), 0);
|
|
44
|
-
rb_define_method(rb_klass, "value=", RUBY_METHOD_FUNC(rb_set_value), 1);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
28
|
VALUE rb_allocate(VALUE klass) {
|
|
48
29
|
Trackbar *ptr;
|
|
49
30
|
return Data_Make_Struct(klass, Trackbar, trackbar_mark, trackbar_free, ptr);
|
|
@@ -61,8 +42,8 @@ void trackbar_free(void *ptr) {
|
|
|
61
42
|
|
|
62
43
|
/*
|
|
63
44
|
* call-seq:
|
|
64
|
-
* new(
|
|
65
|
-
* new(
|
|
45
|
+
* new(name,maxval[,val],&block)
|
|
46
|
+
* new(name,maxval[,val]){|value| ... }
|
|
66
47
|
*
|
|
67
48
|
* Create new Trackbar.
|
|
68
49
|
* <i>name</i> should be String.
|
|
@@ -114,6 +95,31 @@ VALUE rb_set_value(VALUE self, VALUE val) {
|
|
|
114
95
|
TRACKBAR(self)->val = NUM2INT(val);
|
|
115
96
|
return self;
|
|
116
97
|
}
|
|
98
|
+
|
|
99
|
+
void init_ruby_class() {
|
|
100
|
+
#if 0
|
|
101
|
+
// For documentation using YARD
|
|
102
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
103
|
+
VALUE GUI = rb_define_module_under(opencv, "GUI");
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
if (rb_klass)
|
|
107
|
+
return;
|
|
108
|
+
/*
|
|
109
|
+
* opencv = rb_define_module("OpenCV");
|
|
110
|
+
* GUI = rb_define_module_under(opencv, "GUI");
|
|
111
|
+
*
|
|
112
|
+
* note: this comment is used by rdoc.
|
|
113
|
+
*/
|
|
114
|
+
VALUE GUI = rb_module_GUI();
|
|
115
|
+
rb_klass = rb_define_class_under(GUI, "Trackbar", rb_cObject);
|
|
116
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
117
|
+
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
118
|
+
rb_define_method(rb_klass, "name", RUBY_METHOD_FUNC(rb_name), 0);
|
|
119
|
+
rb_define_method(rb_klass, "max", RUBY_METHOD_FUNC(rb_max), 0);
|
|
120
|
+
rb_define_method(rb_klass, "value", RUBY_METHOD_FUNC(rb_value), 0);
|
|
121
|
+
rb_define_method(rb_klass, "value=", RUBY_METHOD_FUNC(rb_set_value), 1);
|
|
122
|
+
}
|
|
117
123
|
|
|
118
124
|
__NAMESPACE_END_TRACKBAR
|
|
119
125
|
__NAMESPACE_END_GUI
|
data/ext/opencv/trackbar.h
CHANGED
data/ext/opencv/window.cpp
CHANGED
|
@@ -32,33 +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
|
-
* GUI = rb_define_module_under(opencv, "GUI");
|
|
43
|
-
*
|
|
44
|
-
* note: this comment is used by rdoc.
|
|
45
|
-
*/
|
|
46
|
-
VALUE GUI = rb_module_GUI();
|
|
47
|
-
rb_klass = rb_define_class_under(GUI, "Window", rb_cObject);
|
|
48
|
-
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
49
|
-
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
50
|
-
rb_define_method(rb_klass, "alive?", RUBY_METHOD_FUNC(rb_alive_q), 0);
|
|
51
|
-
rb_define_method(rb_klass, "destroy", RUBY_METHOD_FUNC(rb_destroy), 0);
|
|
52
|
-
rb_define_singleton_method(rb_klass, "destroy_all", RUBY_METHOD_FUNC(rb_destroy_all), 0);
|
|
53
|
-
rb_define_method(rb_klass, "resize", RUBY_METHOD_FUNC(rb_resize), -1);
|
|
54
|
-
rb_define_method(rb_klass, "move", RUBY_METHOD_FUNC(rb_move), -1);
|
|
55
|
-
rb_define_method(rb_klass, "show_image", RUBY_METHOD_FUNC(rb_show_image), 1);
|
|
56
|
-
rb_define_alias(rb_klass, "show", "show_image");
|
|
57
|
-
rb_define_method(rb_klass, "set_trackbar", RUBY_METHOD_FUNC(rb_set_trackbar), -1);
|
|
58
|
-
rb_define_method(rb_klass, "set_mouse_callback", RUBY_METHOD_FUNC(rb_set_mouse_callback), -1);
|
|
59
|
-
rb_define_alias(rb_klass, "on_mouse", "set_mouse_callback");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
35
|
VALUE
|
|
63
36
|
rb_allocate(VALUE klass)
|
|
64
37
|
{
|
|
@@ -83,11 +56,16 @@ window_free(void *ptr)
|
|
|
83
56
|
}
|
|
84
57
|
|
|
85
58
|
/*
|
|
86
|
-
*
|
|
87
|
-
* new(<i>name[, flags]</i>)
|
|
59
|
+
* Creates a window.
|
|
88
60
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
61
|
+
* @overload new(name, flags = CV_WINDOW_AUTOSIZE)
|
|
62
|
+
* @param name [String] Name of the window in the window caption that may be used as a window identifier.
|
|
63
|
+
* @param flags [Integer] Flags of the window. The supported flags are:
|
|
64
|
+
* * CV_WINDOW_AUTOSIZE - If this is set, the window size is automatically adjusted
|
|
65
|
+
* to fit the displayed image, and you cannot change the window size manually.
|
|
66
|
+
* * CV_WINDOW_NORMAL - If this is set, the user can resize the window (no constraint).
|
|
67
|
+
* * CV_WINDOW_OPENGL - If this is set, the window will be created with OpenGL support.
|
|
68
|
+
* @opencv_func cvNamedWindow
|
|
91
69
|
*/
|
|
92
70
|
VALUE
|
|
93
71
|
rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
@@ -166,11 +144,14 @@ rb_destroy_all(VALUE klass)
|
|
|
166
144
|
}
|
|
167
145
|
|
|
168
146
|
/*
|
|
169
|
-
*
|
|
170
|
-
* resize(<i>size</i>)
|
|
171
|
-
* resize(<i>width, height</i>)
|
|
147
|
+
* Resizes window to the specified size.
|
|
172
148
|
*
|
|
173
|
-
*
|
|
149
|
+
* @overload resize(size)
|
|
150
|
+
* @param size [CvSize] The new window size.
|
|
151
|
+
* @overload resize(width, height)
|
|
152
|
+
* @param width [Integer] The new window width.
|
|
153
|
+
* @param height [Integer] The new window height.
|
|
154
|
+
* @opencv_func cvResizeWindow
|
|
174
155
|
*/
|
|
175
156
|
VALUE
|
|
176
157
|
rb_resize(int argc, VALUE *argv, VALUE self)
|
|
@@ -202,11 +183,14 @@ rb_resize(int argc, VALUE *argv, VALUE self)
|
|
|
202
183
|
}
|
|
203
184
|
|
|
204
185
|
/*
|
|
205
|
-
*
|
|
206
|
-
* move(<i>point</i>)
|
|
207
|
-
* move(<i>x, y</i>)
|
|
186
|
+
* Moves window to the specified position.
|
|
208
187
|
*
|
|
209
|
-
*
|
|
188
|
+
* @overload move(point)
|
|
189
|
+
* @param point [CvPoint] The new coordinate of the window.
|
|
190
|
+
* @overload move(x, y)
|
|
191
|
+
* @param x [Integer] The new x-coordinate of the window.
|
|
192
|
+
* @param y [Integer] The new y-coordinate of the window.
|
|
193
|
+
* @opencv_func cvMoveWindow
|
|
210
194
|
*/
|
|
211
195
|
VALUE
|
|
212
196
|
rb_move(int argc, VALUE *argv, VALUE self)
|
|
@@ -238,11 +222,11 @@ rb_move(int argc, VALUE *argv, VALUE self)
|
|
|
238
222
|
}
|
|
239
223
|
|
|
240
224
|
/*
|
|
241
|
-
*
|
|
242
|
-
* show_image(<i>image</i>)
|
|
225
|
+
* Displays an image in the specified window.
|
|
243
226
|
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
227
|
+
* @overload show_image(image)
|
|
228
|
+
* @param image [CvMat] Image to be shown.
|
|
229
|
+
* @opencv_func cvShowImage
|
|
246
230
|
*/
|
|
247
231
|
VALUE
|
|
248
232
|
rb_show_image(VALUE self, VALUE img)
|
|
@@ -265,13 +249,19 @@ trackbar_callback(int value, void* block)
|
|
|
265
249
|
}
|
|
266
250
|
|
|
267
251
|
/*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
252
|
+
* Creates or sets a trackbar and attaches it to the specified window.
|
|
253
|
+
*
|
|
254
|
+
* @overload set_trackbar(trackbar)
|
|
255
|
+
* @param trackbar [TrackBar] The trackbar to set.
|
|
272
256
|
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
257
|
+
* @overload set_trackbar(name, count, value = nil) { |value| ... }
|
|
258
|
+
* @param name [String] Name of the created trackbar.
|
|
259
|
+
* @param count [Integer] Maximal position of the slider. The minimal position is always 0.
|
|
260
|
+
* @param value [Integer] Optional value to an integer variable whose value reflects the position of the slider.
|
|
261
|
+
* Upon creation, the slider position is defined by this variable.
|
|
262
|
+
* @yield [value] Function to be called every time the slider changes position.
|
|
263
|
+
* @yieldparam value [Integer] The trackbar position.
|
|
264
|
+
* @opencv_func cv::createTrackbar
|
|
275
265
|
*/
|
|
276
266
|
VALUE
|
|
277
267
|
rb_set_trackbar(int argc, VALUE *argv, VALUE self)
|
|
@@ -306,16 +296,13 @@ on_mouse(int event, int x, int y, int flags, void* param)
|
|
|
306
296
|
}
|
|
307
297
|
|
|
308
298
|
/*
|
|
309
|
-
*
|
|
310
|
-
* set_mouse_callback(&block)
|
|
311
|
-
* set_mouse_callback {|mouse_event| ... }
|
|
299
|
+
* Sets mouse handler for the specified window.
|
|
312
300
|
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* block given mouse event object, see GUI::Window::MouseEvent
|
|
301
|
+
* @overload set_mouse_callback { |mouse_event| ... }
|
|
302
|
+
* @yield [mouse_event] Mouse callback.
|
|
303
|
+
* @yieldparam mouse_event [MouseEvent] Mouse event
|
|
317
304
|
*
|
|
318
|
-
*
|
|
305
|
+
* @example display mouse event on console
|
|
319
306
|
* window = OpenCV::GUI::Window.new "sample window"
|
|
320
307
|
* image = OpenCV::IplImage::load "sample.png"
|
|
321
308
|
* window.show(image)
|
|
@@ -351,6 +338,39 @@ rb_set_mouse_callback(int argc, VALUE* argv, VALUE self)
|
|
|
351
338
|
return block;
|
|
352
339
|
}
|
|
353
340
|
|
|
341
|
+
void
|
|
342
|
+
init_ruby_class()
|
|
343
|
+
{
|
|
344
|
+
#if 0
|
|
345
|
+
// For documentation using YARD
|
|
346
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
347
|
+
VALUE GUI = rb_define_module_under(opencv, "GUI");
|
|
348
|
+
#endif
|
|
349
|
+
|
|
350
|
+
if (rb_klass)
|
|
351
|
+
return;
|
|
352
|
+
/*
|
|
353
|
+
* opencv = rb_define_module("OpenCV");
|
|
354
|
+
* GUI = rb_define_module_under(opencv, "GUI");
|
|
355
|
+
*
|
|
356
|
+
* note: this comment is used by rdoc.
|
|
357
|
+
*/
|
|
358
|
+
VALUE GUI = rb_module_GUI();
|
|
359
|
+
rb_klass = rb_define_class_under(GUI, "Window", rb_cObject);
|
|
360
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
361
|
+
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
362
|
+
rb_define_method(rb_klass, "alive?", RUBY_METHOD_FUNC(rb_alive_q), 0);
|
|
363
|
+
rb_define_method(rb_klass, "destroy", RUBY_METHOD_FUNC(rb_destroy), 0);
|
|
364
|
+
rb_define_singleton_method(rb_klass, "destroy_all", RUBY_METHOD_FUNC(rb_destroy_all), 0);
|
|
365
|
+
rb_define_method(rb_klass, "resize", RUBY_METHOD_FUNC(rb_resize), -1);
|
|
366
|
+
rb_define_method(rb_klass, "move", RUBY_METHOD_FUNC(rb_move), -1);
|
|
367
|
+
rb_define_method(rb_klass, "show_image", RUBY_METHOD_FUNC(rb_show_image), 1);
|
|
368
|
+
rb_define_alias(rb_klass, "show", "show_image");
|
|
369
|
+
rb_define_method(rb_klass, "set_trackbar", RUBY_METHOD_FUNC(rb_set_trackbar), -1);
|
|
370
|
+
rb_define_method(rb_klass, "set_mouse_callback", RUBY_METHOD_FUNC(rb_set_mouse_callback), -1);
|
|
371
|
+
rb_define_alias(rb_klass, "on_mouse", "set_mouse_callback");
|
|
372
|
+
}
|
|
373
|
+
|
|
354
374
|
__NAMESPACE_END_WINDOW
|
|
355
375
|
__NAMESPACE_END_GUI
|
|
356
376
|
__NAMESPACE_END_OPENCV
|
data/ext/opencv/window.h
CHANGED
data/lib/opencv/version.rb
CHANGED
data/ruby-opencv.gemspec
CHANGED
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: ruby-opencv 0.0.
|
|
2
|
+
# stub: ruby-opencv 0.0.12.pre.20140119031203 ruby lib
|
|
3
|
+
# stub: ext/opencv/extconf.rb
|
|
3
4
|
|
|
4
5
|
Gem::Specification.new do |s|
|
|
5
6
|
s.name = "ruby-opencv"
|
|
6
|
-
s.version = "0.0.
|
|
7
|
+
s.version = "0.0.12.pre.20140119031203"
|
|
7
8
|
|
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
|
10
|
+
s.require_paths = ["lib"]
|
|
9
11
|
s.authors = ["lsxi", "ser1zw", "pcting"]
|
|
10
|
-
s.date = "
|
|
12
|
+
s.date = "2014-01-18"
|
|
11
13
|
s.description = "ruby-opencv is a wrapper of OpenCV for Ruby. It helps you to write computer vision programs (e.g. detecting faces from pictures) with Ruby."
|
|
12
14
|
s.email = ["masakazu.yonekura@gmail.com", "azariahsawtikes@gmail.com", "pcting@gmail.com"]
|
|
13
15
|
s.extensions = ["ext/opencv/extconf.rb"]
|
|
14
|
-
s.extra_rdoc_files = ["DEVELOPERS_NOTE.md", "History.txt", "License.txt", "Manifest.txt", "README.md", "examples/facerec/readme.md"
|
|
15
|
-
s.files = [".gitignore", "DEVELOPERS_NOTE.md", "Gemfile", "History.txt", "License.txt", "Manifest.txt", "README.md", "Rakefile", "config.yml", "examples/alpha_blend.rb", "examples/contours/bitmap-contours-with-labels.png", "examples/contours/bitmap-contours.png", "examples/contours/bounding-box-detect-canny.rb", "examples/contours/contour_retrieval_modes.rb", "examples/contours/rotated-boxes.jpg", "examples/convexhull.rb", "examples/face_detect.rb", "examples/facerec/create_csv.rb", "examples/facerec/facerec_eigenfaces.rb", "examples/facerec/facerec_fisherfaces.rb", "examples/facerec/facerec_lbph.rb", "examples/facerec/readme.md", "examples/find_obj.rb", "examples/houghcircle.rb", "examples/images/box.png", "examples/images/box_in_scene.png", "examples/images/inpaint.png", "examples/images/lena-256x256.jpg", "examples/images/lena-eyes.jpg", "examples/images/lenna-rotated.jpg", "examples/images/lenna.jpg", "examples/images/stuff.jpg", "examples/images/tiffany.jpg", "examples/inpaint.rb", "examples/match_kdtree.rb", "examples/match_template.rb", "examples/
|
|
16
|
+
s.extra_rdoc_files = ["DEVELOPERS_NOTE.md", "History.txt", "License.txt", "Manifest.txt", "README.md", "examples/facerec/readme.md"]
|
|
17
|
+
s.files = [".gitignore", ".yardopts", "DEVELOPERS_NOTE.md", "Gemfile", "History.txt", "License.txt", "Manifest.txt", "README.md", "Rakefile", "config.yml", "examples/alpha_blend.rb", "examples/contours/bitmap-contours-with-labels.png", "examples/contours/bitmap-contours.png", "examples/contours/bounding-box-detect-canny.rb", "examples/contours/contour_retrieval_modes.rb", "examples/contours/rotated-boxes.jpg", "examples/convexhull.rb", "examples/face_detect.rb", "examples/facerec/create_csv.rb", "examples/facerec/facerec_eigenfaces.rb", "examples/facerec/facerec_fisherfaces.rb", "examples/facerec/facerec_lbph.rb", "examples/facerec/readme.md", "examples/find_obj.rb", "examples/houghcircle.rb", "examples/images/box.png", "examples/images/box_in_scene.png", "examples/images/inpaint.png", "examples/images/lena-256x256.jpg", "examples/images/lena-eyes.jpg", "examples/images/lenna-rotated.jpg", "examples/images/lenna.jpg", "examples/images/stuff.jpg", "examples/images/tiffany.jpg", "examples/inpaint.rb", "examples/match_kdtree.rb", "examples/match_template.rb", "examples/paint.rb", "examples/snake.rb", "ext/opencv/algorithm.cpp", "ext/opencv/algorithm.h", "ext/opencv/curve.cpp", "ext/opencv/curve.h", "ext/opencv/cvavgcomp.cpp", "ext/opencv/cvavgcomp.h", "ext/opencv/cvbox2d.cpp", "ext/opencv/cvbox2d.h", "ext/opencv/cvcapture.cpp", "ext/opencv/cvcapture.h", "ext/opencv/cvchain.cpp", "ext/opencv/cvchain.h", "ext/opencv/cvcircle32f.cpp", "ext/opencv/cvcircle32f.h", "ext/opencv/cvconnectedcomp.cpp", "ext/opencv/cvconnectedcomp.h", "ext/opencv/cvcontour.cpp", "ext/opencv/cvcontour.h", "ext/opencv/cvcontourtree.cpp", "ext/opencv/cvcontourtree.h", "ext/opencv/cvconvexitydefect.cpp", "ext/opencv/cvconvexitydefect.h", "ext/opencv/cverror.cpp", "ext/opencv/cverror.h", "ext/opencv/cvfeaturetree.cpp", "ext/opencv/cvfeaturetree.h", "ext/opencv/cvfont.cpp", "ext/opencv/cvfont.h", "ext/opencv/cvhaarclassifiercascade.cpp", "ext/opencv/cvhaarclassifiercascade.h", "ext/opencv/cvhistogram.cpp", "ext/opencv/cvhistogram.h", "ext/opencv/cvhumoments.cpp", "ext/opencv/cvhumoments.h", "ext/opencv/cvline.cpp", "ext/opencv/cvline.h", "ext/opencv/cvmat.cpp", "ext/opencv/cvmat.h", "ext/opencv/cvmemstorage.cpp", "ext/opencv/cvmemstorage.h", "ext/opencv/cvmoments.cpp", "ext/opencv/cvmoments.h", "ext/opencv/cvpoint.cpp", "ext/opencv/cvpoint.h", "ext/opencv/cvpoint2d32f.cpp", "ext/opencv/cvpoint2d32f.h", "ext/opencv/cvpoint3d32f.cpp", "ext/opencv/cvpoint3d32f.h", "ext/opencv/cvrect.cpp", "ext/opencv/cvrect.h", "ext/opencv/cvscalar.cpp", "ext/opencv/cvscalar.h", "ext/opencv/cvseq.cpp", "ext/opencv/cvseq.h", "ext/opencv/cvsize.cpp", "ext/opencv/cvsize.h", "ext/opencv/cvsize2d32f.cpp", "ext/opencv/cvsize2d32f.h", "ext/opencv/cvslice.cpp", "ext/opencv/cvslice.h", "ext/opencv/cvsurfparams.cpp", "ext/opencv/cvsurfparams.h", "ext/opencv/cvsurfpoint.cpp", "ext/opencv/cvsurfpoint.h", "ext/opencv/cvtermcriteria.cpp", "ext/opencv/cvtermcriteria.h", "ext/opencv/cvtwopoints.cpp", "ext/opencv/cvtwopoints.h", "ext/opencv/cvutils.cpp", "ext/opencv/cvutils.h", "ext/opencv/cvvideowriter.cpp", "ext/opencv/cvvideowriter.h", "ext/opencv/eigenfaces.cpp", "ext/opencv/eigenfaces.h", "ext/opencv/extconf.rb", "ext/opencv/facerecognizer.cpp", "ext/opencv/facerecognizer.h", "ext/opencv/fisherfaces.cpp", "ext/opencv/fisherfaces.h", "ext/opencv/gui.cpp", "ext/opencv/gui.h", "ext/opencv/iplconvkernel.cpp", "ext/opencv/iplconvkernel.h", "ext/opencv/iplimage.cpp", "ext/opencv/iplimage.h", "ext/opencv/lbph.cpp", "ext/opencv/lbph.h", "ext/opencv/mouseevent.cpp", "ext/opencv/mouseevent.h", "ext/opencv/opencv.cpp", "ext/opencv/opencv.h", "ext/opencv/pointset.cpp", "ext/opencv/pointset.h", "ext/opencv/trackbar.cpp", "ext/opencv/trackbar.h", "ext/opencv/window.cpp", "ext/opencv/window.h", "images/CvMat_sobel.png", "images/CvMat_sub_rect.png", "images/CvSeq_relationmap.png", "lib/opencv.rb", "lib/opencv/psyched_yaml.rb", "lib/opencv/version.rb", "ruby-opencv.gemspec", "test/eigenfaces_save.xml", "test/fisherfaces_save.xml", "test/helper.rb", "test/lbph_save.xml", "test/runner.rb", "test/samples/airplane.jpg", "test/samples/baboon.jpg", "test/samples/baboon200.jpg", "test/samples/baboon200_rotated.jpg", "test/samples/blank0.jpg", "test/samples/blank1.jpg", "test/samples/blank2.jpg", "test/samples/blank3.jpg", "test/samples/blank4.jpg", "test/samples/blank5.jpg", "test/samples/blank6.jpg", "test/samples/blank7.jpg", "test/samples/blank8.jpg", "test/samples/blank9.jpg", "test/samples/cat.jpg", "test/samples/chessboard.jpg", "test/samples/contours.jpg", "test/samples/fruits.jpg", "test/samples/haarcascade_frontalface_alt.xml.gz", "test/samples/inpaint-mask.bmp", "test/samples/lena-256x256.jpg", "test/samples/lena-32x32.jpg", "test/samples/lena-eyes.jpg", "test/samples/lena-inpaint.jpg", "test/samples/lena.jpg", "test/samples/lines.jpg", "test/samples/messy0.jpg", "test/samples/messy1.jpg", "test/samples/movie_sample.avi", "test/samples/one_way_train_0000.jpg", "test/samples/one_way_train_0001.jpg", "test/samples/partially_blank0.jpg", "test/samples/partially_blank1.jpg", "test/samples/smooth0.jpg", "test/samples/smooth1.jpg", "test/samples/smooth2.jpg", "test/samples/smooth3.jpg", "test/samples/smooth4.jpg", "test/samples/smooth5.jpg", "test/samples/smooth6.jpg", "test/samples/str-cv-rotated.jpg", "test/samples/str-cv.jpg", "test/samples/str-ov.jpg", "test/samples/stuff.jpg", "test/test_curve.rb", "test/test_cvavgcomp.rb", "test/test_cvbox2d.rb", "test/test_cvcapture.rb", "test/test_cvchain.rb", "test/test_cvcircle32f.rb", "test/test_cvconnectedcomp.rb", "test/test_cvcontour.rb", "test/test_cvcontourtree.rb", "test/test_cverror.rb", "test/test_cvfeaturetree.rb", "test/test_cvfont.rb", "test/test_cvhaarclassifiercascade.rb", "test/test_cvhistogram.rb", "test/test_cvhumoments.rb", "test/test_cvline.rb", "test/test_cvmat.rb", "test/test_cvmat_drawing.rb", "test/test_cvmat_dxt.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvmoments.rb", "test/test_cvpoint.rb", "test/test_cvpoint2d32f.rb", "test/test_cvpoint3d32f.rb", "test/test_cvrect.rb", "test/test_cvscalar.rb", "test/test_cvseq.rb", "test/test_cvsize.rb", "test/test_cvsize2d32f.rb", "test/test_cvslice.rb", "test/test_cvsurfparams.rb", "test/test_cvsurfpoint.rb", "test/test_cvtermcriteria.rb", "test/test_cvtwopoints.rb", "test/test_cvvideowriter.rb", "test/test_eigenfaces.rb", "test/test_fisherfaces.rb", "test/test_iplconvkernel.rb", "test/test_iplimage.rb", "test/test_lbph.rb", "test/test_mouseevent.rb", "test/test_opencv.rb", "test/test_pointset.rb", "test/test_preliminary.rb", "test/test_trackbar.rb", "test/test_window.rb", "yard_extension.rb"]
|
|
16
18
|
s.homepage = "https://github.com/ruby-opencv/ruby-opencv/"
|
|
17
19
|
s.licenses = ["The BSD License"]
|
|
18
20
|
s.rdoc_options = ["--main", "README.md"]
|
|
19
|
-
s.require_paths = ["lib"]
|
|
20
21
|
s.rubyforge_project = "ruby-opencv"
|
|
21
|
-
s.rubygems_version = "2.1
|
|
22
|
+
s.rubygems_version = "2.2.1"
|
|
22
23
|
s.summary = "OpenCV wrapper for Ruby"
|
|
23
|
-
s.test_files = ["test/test_cvcontour.rb", "test/test_eigenfaces.rb", "test/test_cvmoments.rb", "test/test_cvseq.rb", "test/test_cvcontourtree.rb", "test/test_cvbox2d.rb", "test/test_iplimage.rb", "test/test_cvvideowriter.rb", "test/test_cvline.rb", "test/test_cvhumoments.rb", "test/test_cvfont.rb", "test/test_cvconnectedcomp.rb", "test/test_cvhistogram.rb", "test/test_trackbar.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvhaarclassifiercascade.rb", "test/test_cvcircle32f.rb", "test/test_cvcapture.rb", "test/test_cvmat_dxt.rb", "test/test_cvrect.rb", "test/test_iplconvkernel.rb", "test/test_cvsurfpoint.rb", "test/test_cvavgcomp.rb", "test/test_cvscalar.rb", "test/test_pointset.rb", "test/test_curve.rb", "test/test_cvtermcriteria.rb", "test/test_cvtwopoints.rb", "test/test_cvsurfparams.rb", "test/test_cvpoint2d32f.rb", "test/test_cvpoint3d32f.rb", "test/test_cvfeaturetree.rb", "test/test_mouseevent.rb", "test/test_cvchain.rb", "test/test_cvmat.rb", "test/test_fisherfaces.rb", "test/
|
|
24
|
+
s.test_files = ["test/test_cvcontour.rb", "test/test_eigenfaces.rb", "test/test_cvmoments.rb", "test/test_cvseq.rb", "test/test_cvcontourtree.rb", "test/test_cvbox2d.rb", "test/test_iplimage.rb", "test/test_cvvideowriter.rb", "test/test_cvline.rb", "test/test_cvhumoments.rb", "test/test_cvfont.rb", "test/test_cvconnectedcomp.rb", "test/test_cvhistogram.rb", "test/test_trackbar.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvhaarclassifiercascade.rb", "test/test_cvcircle32f.rb", "test/test_cvcapture.rb", "test/test_cvmat_dxt.rb", "test/test_cvrect.rb", "test/test_iplconvkernel.rb", "test/test_cvsurfpoint.rb", "test/test_cvavgcomp.rb", "test/test_cvscalar.rb", "test/test_pointset.rb", "test/test_curve.rb", "test/test_cvtermcriteria.rb", "test/test_cvtwopoints.rb", "test/test_cvsurfparams.rb", "test/test_cvpoint2d32f.rb", "test/test_cvpoint3d32f.rb", "test/test_cvfeaturetree.rb", "test/test_mouseevent.rb", "test/test_cvchain.rb", "test/test_cvmat.rb", "test/test_fisherfaces.rb", "test/test_cverror.rb", "test/test_cvpoint.rb", "test/test_cvsize2d32f.rb", "test/test_preliminary.rb", "test/test_cvmat_drawing.rb", "test/test_lbph.rb", "test/test_cvsize.rb", "test/test_window.rb", "test/test_cvslice.rb", "test/test_opencv.rb"]
|
|
24
25
|
|
|
25
26
|
if s.respond_to? :specification_version then
|
|
26
27
|
s.specification_version = 4
|
|
27
28
|
|
|
28
29
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
29
30
|
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
|
|
30
|
-
s.add_development_dependency(%q<rake-compiler>, ["
|
|
31
|
-
s.add_development_dependency(%q<hoe-gemspec>, ["
|
|
32
|
-
s.add_development_dependency(%q<hoe>, ["~> 3.
|
|
31
|
+
s.add_development_dependency(%q<rake-compiler>, ["~> 0"])
|
|
32
|
+
s.add_development_dependency(%q<hoe-gemspec>, ["~> 0"])
|
|
33
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.8"])
|
|
33
34
|
else
|
|
34
35
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
|
35
|
-
s.add_dependency(%q<rake-compiler>, ["
|
|
36
|
-
s.add_dependency(%q<hoe-gemspec>, ["
|
|
37
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
|
36
|
+
s.add_dependency(%q<rake-compiler>, ["~> 0"])
|
|
37
|
+
s.add_dependency(%q<hoe-gemspec>, ["~> 0"])
|
|
38
|
+
s.add_dependency(%q<hoe>, ["~> 3.8"])
|
|
38
39
|
end
|
|
39
40
|
else
|
|
40
41
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
|
41
|
-
s.add_dependency(%q<rake-compiler>, ["
|
|
42
|
-
s.add_dependency(%q<hoe-gemspec>, ["
|
|
43
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
|
42
|
+
s.add_dependency(%q<rake-compiler>, ["~> 0"])
|
|
43
|
+
s.add_dependency(%q<hoe-gemspec>, ["~> 0"])
|
|
44
|
+
s.add_dependency(%q<hoe>, ["~> 3.8"])
|
|
44
45
|
end
|
|
45
46
|
end
|