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/cvtermcriteria.h
CHANGED
data/ext/opencv/cvtwopoints.cpp
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
************************************************************/
|
|
10
10
|
#include "cvtwopoints.h"
|
|
11
11
|
/*
|
|
12
|
-
* Document-class: OpenCV::
|
|
12
|
+
* Document-class: OpenCV::CvTwoPoints
|
|
13
13
|
*
|
|
14
14
|
* This class means one twopoints on X axis Y axis.
|
|
15
15
|
* X and Y takes the value of the Fixnum. see also CvTwopoints2D32F
|
|
@@ -31,27 +31,6 @@ rb_class()
|
|
|
31
31
|
return rb_klass;
|
|
32
32
|
}
|
|
33
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, "CvTwoPoints", rb_cObject);
|
|
47
|
-
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
48
|
-
rb_define_method(rb_klass, "point1", RUBY_METHOD_FUNC(rb_point1), 0);
|
|
49
|
-
rb_define_method(rb_klass, "point2", RUBY_METHOD_FUNC(rb_point2), 0);
|
|
50
|
-
rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
|
|
51
|
-
rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
|
|
52
|
-
rb_define_alias(rb_klass, "to_a", "to_ary");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
34
|
VALUE
|
|
56
35
|
rb_allocate(VALUE klass)
|
|
57
36
|
{
|
|
@@ -112,5 +91,32 @@ rb_to_ary(VALUE self)
|
|
|
112
91
|
return rb_ary_new3(2, rb_point1(self), rb_point2(self));
|
|
113
92
|
}
|
|
114
93
|
|
|
94
|
+
void
|
|
95
|
+
init_ruby_class()
|
|
96
|
+
{
|
|
97
|
+
#if 0
|
|
98
|
+
// For documentation using YARD
|
|
99
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
100
|
+
#endif
|
|
101
|
+
|
|
102
|
+
if (rb_klass)
|
|
103
|
+
return;
|
|
104
|
+
/*
|
|
105
|
+
* opencv = rb_define_module("OpenCV");
|
|
106
|
+
*
|
|
107
|
+
* note: this comment is used by rdoc.
|
|
108
|
+
*/
|
|
109
|
+
VALUE opencv = rb_module_opencv();
|
|
110
|
+
|
|
111
|
+
rb_klass = rb_define_class_under(opencv, "CvTwoPoints", rb_cObject);
|
|
112
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
113
|
+
rb_define_method(rb_klass, "point1", RUBY_METHOD_FUNC(rb_point1), 0);
|
|
114
|
+
rb_define_method(rb_klass, "point2", RUBY_METHOD_FUNC(rb_point2), 0);
|
|
115
|
+
rb_define_method(rb_klass, "[]", RUBY_METHOD_FUNC(rb_aref), 1);
|
|
116
|
+
rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
|
|
117
|
+
rb_define_alias(rb_klass, "to_a", "to_ary");
|
|
118
|
+
}
|
|
119
|
+
|
|
115
120
|
__NAMESPACE_END_CVTWOPOINTS
|
|
116
121
|
__NAMESPACE_END_OPENCV
|
|
122
|
+
|
data/ext/opencv/cvtwopoints.h
CHANGED
|
@@ -26,27 +26,10 @@ rb_class()
|
|
|
26
26
|
return rb_klass;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
void
|
|
30
|
-
define_ruby_class()
|
|
31
|
-
{
|
|
32
|
-
if (rb_klass)
|
|
33
|
-
return;
|
|
34
|
-
/*
|
|
35
|
-
* opencv = rb_define_module("OpenCV");
|
|
36
|
-
*
|
|
37
|
-
* note: this comment is used by rdoc.
|
|
38
|
-
*/
|
|
39
|
-
VALUE opencv = rb_module_opencv();
|
|
40
|
-
rb_klass = rb_define_class_under(opencv, "CvVideoWriter", rb_cObject);
|
|
41
|
-
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
42
|
-
rb_define_method(rb_klass, "write", RUBY_METHOD_FUNC(rb_write), 1);
|
|
43
|
-
rb_define_method(rb_klass, "close", RUBY_METHOD_FUNC(rb_close), 0);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
29
|
/*
|
|
47
30
|
* call-seq:
|
|
48
|
-
* CvVideoWriter.new(
|
|
49
|
-
* CvVideoWriter.new(
|
|
31
|
+
* CvVideoWriter.new(filname, fourcc, fps, size[, is_color]) -> cvvideowriter
|
|
32
|
+
* CvVideoWriter.new(filname, fourcc, fps, size[, is_color]){|vw| ... } -> nil
|
|
50
33
|
*
|
|
51
34
|
* Open new video writer. If block given, writer is closed automatically when end of block.
|
|
52
35
|
*
|
|
@@ -98,7 +81,7 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
|
98
81
|
|
|
99
82
|
/*
|
|
100
83
|
* call-seq:
|
|
101
|
-
* write(
|
|
84
|
+
* write(frame)
|
|
102
85
|
*
|
|
103
86
|
* Write image as frame of video stream.
|
|
104
87
|
* <i>frame</i> should be IplImage
|
|
@@ -132,6 +115,28 @@ rb_close(VALUE self)
|
|
|
132
115
|
return Qnil;
|
|
133
116
|
}
|
|
134
117
|
|
|
118
|
+
void
|
|
119
|
+
init_ruby_class()
|
|
120
|
+
{
|
|
121
|
+
#if 0
|
|
122
|
+
// For documentation using YARD
|
|
123
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
124
|
+
#endif
|
|
125
|
+
|
|
126
|
+
if (rb_klass)
|
|
127
|
+
return;
|
|
128
|
+
/*
|
|
129
|
+
* opencv = rb_define_module("OpenCV");
|
|
130
|
+
*
|
|
131
|
+
* note: this comment is used by rdoc.
|
|
132
|
+
*/
|
|
133
|
+
VALUE opencv = rb_module_opencv();
|
|
134
|
+
rb_klass = rb_define_class_under(opencv, "CvVideoWriter", rb_cObject);
|
|
135
|
+
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
136
|
+
rb_define_method(rb_klass, "write", RUBY_METHOD_FUNC(rb_write), 1);
|
|
137
|
+
rb_define_method(rb_klass, "close", RUBY_METHOD_FUNC(rb_close), 0);
|
|
138
|
+
}
|
|
135
139
|
|
|
136
140
|
__NAMESPACE_END_CVVIDEOWRITER
|
|
137
141
|
__NAMESPACE_END_OPENCV
|
|
142
|
+
|
data/ext/opencv/cvvideowriter.h
CHANGED
data/ext/opencv/eigenfaces.cpp
CHANGED
|
@@ -47,8 +47,15 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
void
|
|
50
|
-
|
|
50
|
+
init_ruby_class()
|
|
51
51
|
{
|
|
52
|
+
#if 0
|
|
53
|
+
// For documentation using YARD
|
|
54
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
55
|
+
VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
|
|
56
|
+
VALUE face_recognizer = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
|
|
57
|
+
#endif
|
|
58
|
+
|
|
52
59
|
if (rb_klass)
|
|
53
60
|
return;
|
|
54
61
|
/*
|
|
@@ -57,7 +64,8 @@ define_ruby_class()
|
|
|
57
64
|
* note: this comment is used by rdoc.
|
|
58
65
|
*/
|
|
59
66
|
VALUE opencv = rb_module_opencv();
|
|
60
|
-
|
|
67
|
+
VALUE face_recognizer = cFaceRecognizer::rb_class();
|
|
68
|
+
rb_klass = rb_define_class_under(opencv, "EigenFaces", face_recognizer);
|
|
61
69
|
rb_define_alloc_func(rb_klass, cFaceRecognizer::allocate_facerecognizer);
|
|
62
70
|
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
63
71
|
}
|
data/ext/opencv/eigenfaces.h
CHANGED
|
@@ -18,20 +18,19 @@ __NAMESPACE_BEGIN_FACERECOGNIZER
|
|
|
18
18
|
|
|
19
19
|
VALUE rb_klass;
|
|
20
20
|
|
|
21
|
-
std::map<
|
|
21
|
+
std::map<void*, cv::Ptr<cv::FaceRecognizer> > ptr_guard_map;
|
|
22
22
|
|
|
23
23
|
void
|
|
24
24
|
guard_facerecognizer(void* data_ptr, cv::Ptr<cv::FaceRecognizer> ptr)
|
|
25
25
|
{
|
|
26
|
-
ptr_guard_map[
|
|
26
|
+
ptr_guard_map[data_ptr] = ptr;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
void
|
|
30
|
-
release_facerecognizer(void *
|
|
30
|
+
release_facerecognizer(void *data_ptr)
|
|
31
31
|
{
|
|
32
|
-
|
|
33
|
-
ptr_guard_map
|
|
34
|
-
ptr_guard_map.erase(key);
|
|
32
|
+
ptr_guard_map[data_ptr].release();
|
|
33
|
+
ptr_guard_map.erase(data_ptr);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
VALUE
|
|
@@ -153,8 +152,14 @@ rb_load(VALUE self, VALUE filename)
|
|
|
153
152
|
}
|
|
154
153
|
|
|
155
154
|
void
|
|
156
|
-
|
|
155
|
+
init_ruby_class()
|
|
157
156
|
{
|
|
157
|
+
#if 0
|
|
158
|
+
// For documentation using YARD
|
|
159
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
160
|
+
VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
|
|
161
|
+
#endif
|
|
162
|
+
|
|
158
163
|
if (rb_klass)
|
|
159
164
|
return;
|
|
160
165
|
/*
|
|
@@ -163,7 +168,8 @@ define_ruby_class()
|
|
|
163
168
|
* note: this comment is used by rdoc.
|
|
164
169
|
*/
|
|
165
170
|
VALUE opencv = rb_module_opencv();
|
|
166
|
-
|
|
171
|
+
VALUE alghorithm = cAlgorithm::rb_class();
|
|
172
|
+
rb_klass = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
|
|
167
173
|
rb_define_method(rb_klass, "train", RUBY_METHOD_FUNC(rb_train), 2);
|
|
168
174
|
rb_define_method(rb_klass, "predict", RUBY_METHOD_FUNC(rb_predict), 1);
|
|
169
175
|
rb_define_method(rb_klass, "save", RUBY_METHOD_FUNC(rb_save), 1);
|
|
@@ -172,3 +178,4 @@ define_ruby_class()
|
|
|
172
178
|
|
|
173
179
|
__NAMESPACE_END_FACERECOGNIZER
|
|
174
180
|
__NAMESPACE_END_OPENCV
|
|
181
|
+
|
data/ext/opencv/facerecognizer.h
CHANGED
|
@@ -20,14 +20,14 @@ __NAMESPACE_BEGIN_FACERECOGNIZER
|
|
|
20
20
|
|
|
21
21
|
VALUE rb_class();
|
|
22
22
|
|
|
23
|
-
void
|
|
23
|
+
void init_ruby_class();
|
|
24
24
|
VALUE rb_train(VALUE self, VALUE src, VALUE labels);
|
|
25
25
|
VALUE rb_predict(VALUE self, VALUE src);
|
|
26
26
|
VALUE rb_save(VALUE self, VALUE filename);
|
|
27
27
|
VALUE rb_load(VALUE self, VALUE filename);
|
|
28
28
|
|
|
29
29
|
void guard_facerecognizer(void* data_ptr, cv::Ptr<cv::FaceRecognizer> ptr);
|
|
30
|
-
void release_facerecognizer(void *
|
|
30
|
+
void release_facerecognizer(void *data_ptr);
|
|
31
31
|
VALUE allocate_facerecognizer(VALUE klass);
|
|
32
32
|
|
|
33
33
|
__NAMESPACE_END_FACERECOGNIZER
|
data/ext/opencv/fisherfaces.cpp
CHANGED
|
@@ -47,8 +47,15 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
void
|
|
50
|
-
|
|
50
|
+
init_ruby_class()
|
|
51
51
|
{
|
|
52
|
+
#if 0
|
|
53
|
+
// For documentation using YARD
|
|
54
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
55
|
+
VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
|
|
56
|
+
VALUE face_recognizer = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
|
|
57
|
+
#endif
|
|
58
|
+
|
|
52
59
|
if (rb_klass)
|
|
53
60
|
return;
|
|
54
61
|
/*
|
|
@@ -57,7 +64,8 @@ define_ruby_class()
|
|
|
57
64
|
* note: this comment is used by rdoc.
|
|
58
65
|
*/
|
|
59
66
|
VALUE opencv = rb_module_opencv();
|
|
60
|
-
|
|
67
|
+
VALUE face_recognizer = cFaceRecognizer::rb_class();
|
|
68
|
+
rb_klass = rb_define_class_under(opencv, "FisherFaces", face_recognizer);
|
|
61
69
|
rb_define_alloc_func(rb_klass, cFaceRecognizer::allocate_facerecognizer);
|
|
62
70
|
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
63
71
|
}
|
data/ext/opencv/fisherfaces.h
CHANGED
data/ext/opencv/gui.cpp
CHANGED
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
#include "gui.h"
|
|
11
11
|
/*
|
|
12
12
|
* Document-module: OpenCV::GUI
|
|
13
|
-
*
|
|
14
|
-
* OpenCV simple GUI interface. Provides Window, Trackbar.
|
|
15
|
-
* This GUI work on GTK or Microsoft Windows native GUI.
|
|
16
13
|
*/
|
|
17
14
|
__NAMESPACE_BEGIN_OPENCV
|
|
18
15
|
__NAMESPACE_BEGIN_GUI
|
|
@@ -25,28 +22,14 @@ rb_module_GUI()
|
|
|
25
22
|
return rb_module;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
void
|
|
29
|
-
define_ruby_module()
|
|
30
|
-
{
|
|
31
|
-
if (rb_module)
|
|
32
|
-
return;
|
|
33
|
-
/*
|
|
34
|
-
* opencv = rb_define_module("OpenCV");
|
|
35
|
-
*
|
|
36
|
-
* note: this comment is used by rdoc.
|
|
37
|
-
*/
|
|
38
|
-
VALUE opencv = rb_module_opencv();
|
|
39
|
-
rb_module = rb_define_module_under(opencv, "GUI");
|
|
40
|
-
rb_define_singleton_method(rb_module, "wait_key", RUBY_METHOD_FUNC(rb_wait_key), -1);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
25
|
/*
|
|
44
|
-
*
|
|
45
|
-
* wait_key(<i>[delay]</i>) -> int or nil
|
|
26
|
+
* Waits for a pressed key.
|
|
46
27
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
28
|
+
* @overload wait_key(delay = 0)
|
|
29
|
+
* @param delay [Integer] Delay in milliseconds. 0 is the special value that means "forever".
|
|
30
|
+
* @return [Number] The code of the pressed key or <tt>nil</tt> if no key was pressed
|
|
31
|
+
* before the specified time had elapsed.
|
|
32
|
+
* @opencv_func cvWaitKey
|
|
50
33
|
*/
|
|
51
34
|
VALUE
|
|
52
35
|
rb_wait_key(int argc, VALUE *argv, VALUE self)
|
|
@@ -63,6 +46,26 @@ rb_wait_key(int argc, VALUE *argv, VALUE self)
|
|
|
63
46
|
return (keycode < 0) ? Qnil : INT2NUM(keycode);
|
|
64
47
|
}
|
|
65
48
|
|
|
49
|
+
void
|
|
50
|
+
init_ruby_module()
|
|
51
|
+
{
|
|
52
|
+
#if 0
|
|
53
|
+
// For documentation using YARD
|
|
54
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
if (rb_module)
|
|
58
|
+
return;
|
|
59
|
+
/*
|
|
60
|
+
* opencv = rb_define_module("OpenCV");
|
|
61
|
+
*
|
|
62
|
+
* note: this comment is used by rdoc.
|
|
63
|
+
*/
|
|
64
|
+
VALUE opencv = rb_module_opencv();
|
|
65
|
+
rb_module = rb_define_module_under(opencv, "GUI");
|
|
66
|
+
rb_define_singleton_method(rb_module, "wait_key", RUBY_METHOD_FUNC(rb_wait_key), -1);
|
|
67
|
+
}
|
|
68
|
+
|
|
66
69
|
__NAMESPACE_END_GUI
|
|
67
70
|
__NAMESPACE_END_OPENCV
|
|
68
71
|
|
data/ext/opencv/gui.h
CHANGED
|
@@ -29,30 +29,6 @@ rb_class()
|
|
|
29
29
|
return rb_klass;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
void
|
|
33
|
-
define_ruby_class()
|
|
34
|
-
{
|
|
35
|
-
if (rb_klass)
|
|
36
|
-
return;
|
|
37
|
-
/*
|
|
38
|
-
* opencv = rb_define_module("OpenCV");
|
|
39
|
-
*
|
|
40
|
-
* note: this comment is used by rdoc.
|
|
41
|
-
*/
|
|
42
|
-
VALUE opencv = rb_module_opencv();
|
|
43
|
-
rb_klass = rb_define_class_under(opencv, "IplConvKernel", rb_cObject);
|
|
44
|
-
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
45
|
-
|
|
46
|
-
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
47
|
-
rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_size), 0);
|
|
48
|
-
rb_define_method(rb_klass, "cols", RUBY_METHOD_FUNC(rb_cols), 0);
|
|
49
|
-
rb_define_alias(rb_klass, "columns", "cols");
|
|
50
|
-
rb_define_method(rb_klass, "rows", RUBY_METHOD_FUNC(rb_rows), 0);
|
|
51
|
-
rb_define_method(rb_klass, "anchor", RUBY_METHOD_FUNC(rb_anchor), 0);
|
|
52
|
-
rb_define_method(rb_klass, "anchor_x", RUBY_METHOD_FUNC(rb_anchor_x), 0);
|
|
53
|
-
rb_define_method(rb_klass, "anchor_y", RUBY_METHOD_FUNC(rb_anchor_y), 0);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
32
|
VALUE
|
|
57
33
|
rb_allocate(VALUE klass)
|
|
58
34
|
{
|
|
@@ -188,5 +164,35 @@ rb_anchor_y(VALUE self)
|
|
|
188
164
|
return INT2NUM(IPLCONVKERNEL(self)->anchorY);
|
|
189
165
|
}
|
|
190
166
|
|
|
167
|
+
void
|
|
168
|
+
init_ruby_class()
|
|
169
|
+
{
|
|
170
|
+
#if 0
|
|
171
|
+
// For documentation using YARD
|
|
172
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
173
|
+
#endif
|
|
174
|
+
|
|
175
|
+
if (rb_klass)
|
|
176
|
+
return;
|
|
177
|
+
/*
|
|
178
|
+
* opencv = rb_define_module("OpenCV");
|
|
179
|
+
*
|
|
180
|
+
* note: this comment is used by rdoc.
|
|
181
|
+
*/
|
|
182
|
+
VALUE opencv = rb_module_opencv();
|
|
183
|
+
rb_klass = rb_define_class_under(opencv, "IplConvKernel", rb_cObject);
|
|
184
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
185
|
+
|
|
186
|
+
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
187
|
+
rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_size), 0);
|
|
188
|
+
rb_define_method(rb_klass, "cols", RUBY_METHOD_FUNC(rb_cols), 0);
|
|
189
|
+
rb_define_alias(rb_klass, "columns", "cols");
|
|
190
|
+
rb_define_method(rb_klass, "rows", RUBY_METHOD_FUNC(rb_rows), 0);
|
|
191
|
+
rb_define_method(rb_klass, "anchor", RUBY_METHOD_FUNC(rb_anchor), 0);
|
|
192
|
+
rb_define_method(rb_klass, "anchor_x", RUBY_METHOD_FUNC(rb_anchor_x), 0);
|
|
193
|
+
rb_define_method(rb_klass, "anchor_y", RUBY_METHOD_FUNC(rb_anchor_y), 0);
|
|
194
|
+
}
|
|
195
|
+
|
|
191
196
|
__NAMESPACE_END_IPLCONVKERNEL
|
|
192
197
|
__NAMESPACE_END_OPENCV
|
|
198
|
+
|