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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d02abda7096be25deaf28aa16aeee36f815ddef
|
|
4
|
+
data.tar.gz: b42f74d46051e42289131b2fd1b0922c4e1f762d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f92654da489e2c7444bb2f8934702cfd69f39f06b004336e423d81e0511ac55cb2ebb6fa67219b1cffdf799d3f63e4780e6de8856ad6c5376581e6299273e607
|
|
7
|
+
data.tar.gz: 8ca6223922b06bf6bb5f16be6be950f604a8e4e1962e774af44be30f0e2c02be67431751b17f1c8b6b24502c646fcd2eda31a23706fa5c8753ae2aaf5dfa366b
|
data/.gitignore
CHANGED
data/.yardopts
ADDED
data/Gemfile
CHANGED
data/Manifest.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.gitignore
|
|
2
|
+
.yardopts
|
|
2
3
|
DEVELOPERS_NOTE.md
|
|
3
4
|
Gemfile
|
|
4
5
|
History.txt
|
|
@@ -34,12 +35,6 @@ examples/images/tiffany.jpg
|
|
|
34
35
|
examples/inpaint.rb
|
|
35
36
|
examples/match_kdtree.rb
|
|
36
37
|
examples/match_template.rb
|
|
37
|
-
examples/matching_to_many_images/matching_to_many_images.rb
|
|
38
|
-
examples/matching_to_many_images/query.png
|
|
39
|
-
examples/matching_to_many_images/train/1.png
|
|
40
|
-
examples/matching_to_many_images/train/2.png
|
|
41
|
-
examples/matching_to_many_images/train/3.png
|
|
42
|
-
examples/matching_to_many_images/train/trainImages.txt
|
|
43
38
|
examples/paint.rb
|
|
44
39
|
examples/snake.rb
|
|
45
40
|
ext/opencv/algorithm.cpp
|
|
@@ -56,8 +51,6 @@ ext/opencv/cvchain.cpp
|
|
|
56
51
|
ext/opencv/cvchain.h
|
|
57
52
|
ext/opencv/cvcircle32f.cpp
|
|
58
53
|
ext/opencv/cvcircle32f.h
|
|
59
|
-
ext/opencv/cvcondensation.cpp
|
|
60
|
-
ext/opencv/cvcondensation.h
|
|
61
54
|
ext/opencv/cvconnectedcomp.cpp
|
|
62
55
|
ext/opencv/cvconnectedcomp.h
|
|
63
56
|
ext/opencv/cvcontour.cpp
|
|
@@ -82,8 +75,6 @@ ext/opencv/cvline.cpp
|
|
|
82
75
|
ext/opencv/cvline.h
|
|
83
76
|
ext/opencv/cvmat.cpp
|
|
84
77
|
ext/opencv/cvmat.h
|
|
85
|
-
ext/opencv/cvmatnd.cpp
|
|
86
|
-
ext/opencv/cvmatnd.h
|
|
87
78
|
ext/opencv/cvmemstorage.cpp
|
|
88
79
|
ext/opencv/cvmemstorage.h
|
|
89
80
|
ext/opencv/cvmoments.cpp
|
|
@@ -106,8 +97,6 @@ ext/opencv/cvsize2d32f.cpp
|
|
|
106
97
|
ext/opencv/cvsize2d32f.h
|
|
107
98
|
ext/opencv/cvslice.cpp
|
|
108
99
|
ext/opencv/cvslice.h
|
|
109
|
-
ext/opencv/cvsparsemat.cpp
|
|
110
|
-
ext/opencv/cvsparsemat.h
|
|
111
100
|
ext/opencv/cvsurfparams.cpp
|
|
112
101
|
ext/opencv/cvsurfparams.h
|
|
113
102
|
ext/opencv/cvsurfpoint.cpp
|
|
@@ -148,7 +137,6 @@ ext/opencv/window.h
|
|
|
148
137
|
images/CvMat_sobel.png
|
|
149
138
|
images/CvMat_sub_rect.png
|
|
150
139
|
images/CvSeq_relationmap.png
|
|
151
|
-
images/face_detect_from_lena.jpg
|
|
152
140
|
lib/opencv.rb
|
|
153
141
|
lib/opencv/psyched_yaml.rb
|
|
154
142
|
lib/opencv/version.rb
|
|
@@ -222,7 +210,6 @@ test/test_cvmat.rb
|
|
|
222
210
|
test/test_cvmat_drawing.rb
|
|
223
211
|
test/test_cvmat_dxt.rb
|
|
224
212
|
test/test_cvmat_imageprocessing.rb
|
|
225
|
-
test/test_cvmat_matching.rb
|
|
226
213
|
test/test_cvmoments.rb
|
|
227
214
|
test/test_cvpoint.rb
|
|
228
215
|
test/test_cvpoint2d32f.rb
|
|
@@ -249,3 +236,4 @@ test/test_pointset.rb
|
|
|
249
236
|
test/test_preliminary.rb
|
|
250
237
|
test/test_trackbar.rb
|
|
251
238
|
test/test_window.rb
|
|
239
|
+
yard_extension.rb
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
@@ -6,6 +6,9 @@ require 'hoe'
|
|
|
6
6
|
require 'rake/extensiontask'
|
|
7
7
|
require 'fileutils'
|
|
8
8
|
require './lib/opencv/psyched_yaml'
|
|
9
|
+
require 'yard'
|
|
10
|
+
require 'yard/rake/yardoc_task'
|
|
11
|
+
require './yard_extension'
|
|
9
12
|
|
|
10
13
|
SO_FILE = 'opencv.so'
|
|
11
14
|
|
|
@@ -27,7 +30,7 @@ hoespec = Hoe.spec 'ruby-opencv' do |s|
|
|
|
27
30
|
s.test_globs = ['test/test_*.rb']
|
|
28
31
|
s.urls = ['https://github.com/ruby-opencv/ruby-opencv/']
|
|
29
32
|
|
|
30
|
-
s.extra_dev_deps << ['rake-compiler', '
|
|
33
|
+
s.extra_dev_deps << ['rake-compiler', '~> 0'] << ['hoe-gemspec', '~> 0']
|
|
31
34
|
|
|
32
35
|
Rake::ExtensionTask.new('opencv', spec) do |ext|
|
|
33
36
|
ext.lib_dir = 'lib'
|
|
@@ -87,4 +90,10 @@ task 'gem:precompile' => ['gem'] do
|
|
|
87
90
|
FileUtils.rm_rf tmp_dir
|
|
88
91
|
end
|
|
89
92
|
|
|
93
|
+
# yard
|
|
94
|
+
YARD::Rake::YardocTask.new do |t|
|
|
95
|
+
t.files = ['lib/**/*.rb', 'ext/**/*.cpp']
|
|
96
|
+
end
|
|
97
|
+
|
|
90
98
|
# vim: syntax=ruby
|
|
99
|
+
|
|
@@ -97,7 +97,7 @@ model.set_double('threshold', 0.0);
|
|
|
97
97
|
|
|
98
98
|
# Now the threshold of this model is set to 0.0. A prediction
|
|
99
99
|
# now returns -1, as it's impossible to have a distance below it
|
|
100
|
-
predicted_label = model.predict(test_sample)
|
|
100
|
+
predicted_label, predicted_confidence = model.predict(test_sample)
|
|
101
101
|
puts "Predicted class = #{predicted_label}"
|
|
102
102
|
|
|
103
103
|
# Show some informations about the model, as there's no cool
|
data/ext/opencv/algorithm.cpp
CHANGED
data/ext/opencv/algorithm.h
CHANGED
data/ext/opencv/curve.cpp
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/*
|
|
12
12
|
* Document-class: OpenCV::Curve
|
|
13
13
|
*
|
|
14
|
-
* Curve sequence
|
|
14
|
+
* Curve sequence
|
|
15
15
|
*/
|
|
16
16
|
__NAMESPACE_BEGIN_OPENCV
|
|
17
17
|
__NAMESPACE_BEGIN_CURVE
|
|
@@ -24,27 +24,11 @@ rb_module()
|
|
|
24
24
|
return module;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
void
|
|
28
|
-
define_ruby_module()
|
|
29
|
-
{
|
|
30
|
-
if (module)
|
|
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
|
-
module = rb_define_module_under(opencv, "Curve");
|
|
39
|
-
rb_define_method(module, "closed?", RUBY_METHOD_FUNC(rb_closed_q), 0);
|
|
40
|
-
rb_define_method(module, "convex?", RUBY_METHOD_FUNC(rb_convex_q), 0);
|
|
41
|
-
rb_define_method(module, "hole?", RUBY_METHOD_FUNC(rb_hole_q), 0);
|
|
42
|
-
rb_define_method(module, "simple?", RUBY_METHOD_FUNC(rb_simple_q), 0);
|
|
43
|
-
rb_define_method(module, "arc_length", RUBY_METHOD_FUNC(rb_arc_length), -1);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
27
|
/*
|
|
47
|
-
* If curve is closed, return true. Otherwise return false.
|
|
28
|
+
* If the curve is closed, return true. Otherwise return false.
|
|
29
|
+
* @overload closed?
|
|
30
|
+
* @return [Boolean] Closed or not
|
|
31
|
+
* @opencv_func CV_IS_SEQ_CLOSED
|
|
48
32
|
*/
|
|
49
33
|
VALUE
|
|
50
34
|
rb_closed_q(VALUE self)
|
|
@@ -53,7 +37,10 @@ rb_closed_q(VALUE self)
|
|
|
53
37
|
}
|
|
54
38
|
|
|
55
39
|
/*
|
|
56
|
-
* If curve is convex, return true. Otherwise return false.
|
|
40
|
+
* If the curve is convex, return true. Otherwise return false.
|
|
41
|
+
* @overload convex?
|
|
42
|
+
* @return [Boolean] Convex or not
|
|
43
|
+
* @opencv_func CV_IS_SEQ_CONVEX
|
|
57
44
|
*/
|
|
58
45
|
VALUE
|
|
59
46
|
rb_convex_q(VALUE self)
|
|
@@ -62,7 +49,10 @@ rb_convex_q(VALUE self)
|
|
|
62
49
|
}
|
|
63
50
|
|
|
64
51
|
/*
|
|
65
|
-
* If curve is hole(inner contour), return true. Otherwise return false.
|
|
52
|
+
* If the curve is hole(inner contour), return true. Otherwise return false.
|
|
53
|
+
* @overload hole?
|
|
54
|
+
* @return [Boolean] Hole or not
|
|
55
|
+
* @opencv_func CV_IS_SEQ_HOLE
|
|
66
56
|
*/
|
|
67
57
|
VALUE
|
|
68
58
|
rb_hole_q(VALUE self)
|
|
@@ -71,7 +61,10 @@ rb_hole_q(VALUE self)
|
|
|
71
61
|
}
|
|
72
62
|
|
|
73
63
|
/*
|
|
74
|
-
*
|
|
64
|
+
* If the curve is simple, return true. Otherwise return false.
|
|
65
|
+
* @overload simple?
|
|
66
|
+
* @return [Boolean] Simple or not
|
|
67
|
+
* @opencv_func CV_IS_SEQ_SIMPLE
|
|
75
68
|
*/
|
|
76
69
|
VALUE
|
|
77
70
|
rb_simple_q(VALUE self)
|
|
@@ -80,15 +73,17 @@ rb_simple_q(VALUE self)
|
|
|
80
73
|
}
|
|
81
74
|
|
|
82
75
|
/*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
76
|
+
* Calculates length of a curve
|
|
77
|
+
* @overload arc_length(slice = nil, is_closed = nil)
|
|
78
|
+
* @param slice [Range,CvSlice,nil] Starting and ending points of the curve.
|
|
79
|
+
* By default, the whole curve length is calculated.
|
|
80
|
+
* @param is_closed [Boolean,nil] Indicates whether the curve is closed or not.
|
|
81
|
+
* There are 3 cases:
|
|
82
|
+
* * is_closed = true - the curve is assumed to be unclosed.
|
|
83
|
+
* * is_closed = false - the curve is assumed to be closed.
|
|
84
|
+
* * is_closed = nil (default) use self#closed?
|
|
85
|
+
* @return [Number] Length of the curve
|
|
86
|
+
* @opencv_func cvArcLength
|
|
92
87
|
*/
|
|
93
88
|
VALUE
|
|
94
89
|
rb_arc_length(int argc, VALUE *argv, VALUE self)
|
|
@@ -107,6 +102,26 @@ rb_arc_length(int argc, VALUE *argv, VALUE self)
|
|
|
107
102
|
return rb_float_new(length);
|
|
108
103
|
}
|
|
109
104
|
|
|
105
|
+
void
|
|
106
|
+
init_ruby_module()
|
|
107
|
+
{
|
|
108
|
+
#if 0
|
|
109
|
+
// For documentation using YARD
|
|
110
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
111
|
+
#endif
|
|
112
|
+
|
|
113
|
+
if (module)
|
|
114
|
+
return;
|
|
115
|
+
|
|
116
|
+
VALUE opencv = rb_module_opencv();
|
|
117
|
+
module = rb_define_module_under(opencv, "Curve");
|
|
118
|
+
rb_define_method(module, "closed?", RUBY_METHOD_FUNC(rb_closed_q), 0);
|
|
119
|
+
rb_define_method(module, "convex?", RUBY_METHOD_FUNC(rb_convex_q), 0);
|
|
120
|
+
rb_define_method(module, "hole?", RUBY_METHOD_FUNC(rb_hole_q), 0);
|
|
121
|
+
rb_define_method(module, "simple?", RUBY_METHOD_FUNC(rb_simple_q), 0);
|
|
122
|
+
rb_define_method(module, "arc_length", RUBY_METHOD_FUNC(rb_arc_length), -1);
|
|
123
|
+
}
|
|
124
|
+
|
|
110
125
|
__NAMESPACE_END_CURVE
|
|
111
126
|
__NAMESPACE_END_OPENCV
|
|
112
127
|
|
data/ext/opencv/curve.h
CHANGED
data/ext/opencv/cvavgcomp.cpp
CHANGED
|
@@ -11,13 +11,7 @@
|
|
|
11
11
|
/*
|
|
12
12
|
* Document-class: OpenCV::CvAvgComp
|
|
13
13
|
*
|
|
14
|
-
* CvRect with parameter "neighbors"
|
|
15
|
-
* CvHaarClassifierCascade#detect_object.
|
|
16
|
-
*
|
|
17
|
-
* typedef struct CvAvgComp {
|
|
18
|
-
* CvRect rect;
|
|
19
|
-
* int neighbors;
|
|
20
|
-
* }
|
|
14
|
+
* CvRect with parameter "neighbors"
|
|
21
15
|
*/
|
|
22
16
|
__NAMESPACE_BEGIN_OPENCV
|
|
23
17
|
__NAMESPACE_BEGIN_AVGCOMP
|
|
@@ -30,23 +24,6 @@ rb_class()
|
|
|
30
24
|
return rb_klass;
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
void
|
|
34
|
-
define_ruby_class()
|
|
35
|
-
{
|
|
36
|
-
if (rb_klass)
|
|
37
|
-
return;
|
|
38
|
-
/*
|
|
39
|
-
* opencv = rb_define_module("OpenCV");
|
|
40
|
-
* cvrect = rb_define_class_under(opencv, "CvRect", rb_cObject);
|
|
41
|
-
*
|
|
42
|
-
* note: this comment is used by rdoc.
|
|
43
|
-
*/
|
|
44
|
-
VALUE opencv = rb_module_opencv(), cvrect = cCvRect::rb_class();
|
|
45
|
-
rb_klass = rb_define_class_under(opencv, "CvAvgComp", cvrect);
|
|
46
|
-
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
47
|
-
rb_define_method(rb_klass, "neighbors", RUBY_METHOD_FUNC(rb_neighbors), 0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
27
|
VALUE
|
|
51
28
|
rb_allocate(VALUE klass)
|
|
52
29
|
{
|
|
@@ -55,7 +32,9 @@ rb_allocate(VALUE klass)
|
|
|
55
32
|
}
|
|
56
33
|
|
|
57
34
|
/*
|
|
58
|
-
* Return neighbors
|
|
35
|
+
* Return neighbors
|
|
36
|
+
* @overload neighbors
|
|
37
|
+
* @return [Integer] neighbors
|
|
59
38
|
*/
|
|
60
39
|
VALUE
|
|
61
40
|
rb_neighbors(VALUE self)
|
|
@@ -63,5 +42,23 @@ rb_neighbors(VALUE self)
|
|
|
63
42
|
return INT2NUM(CVAVGCOMP(self)->neighbors);
|
|
64
43
|
}
|
|
65
44
|
|
|
45
|
+
void
|
|
46
|
+
init_ruby_class()
|
|
47
|
+
{
|
|
48
|
+
#if 0
|
|
49
|
+
// For documentation using YARD
|
|
50
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
51
|
+
VALUE cvrect = rb_define_class_under(opencv, "CvRect", rb_cObject);
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
if (rb_klass)
|
|
55
|
+
return;
|
|
56
|
+
|
|
57
|
+
VALUE opencv = rb_module_opencv(), cvrect = cCvRect::rb_class();
|
|
58
|
+
rb_klass = rb_define_class_under(opencv, "CvAvgComp", cvrect);
|
|
59
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
60
|
+
rb_define_method(rb_klass, "neighbors", RUBY_METHOD_FUNC(rb_neighbors), 0);
|
|
61
|
+
}
|
|
62
|
+
|
|
66
63
|
__NAMESPACE_END_AVGCOMP
|
|
67
64
|
__NAMESPACE_END_OPENCV
|
data/ext/opencv/cvavgcomp.h
CHANGED
data/ext/opencv/cvbox2d.cpp
CHANGED
|
@@ -11,12 +11,7 @@
|
|
|
11
11
|
/*
|
|
12
12
|
* Document-class: OpenCV::CvBox2D
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* typdef struct CvBox2D {
|
|
16
|
-
* CvPoint2D32f center; // center of the box.
|
|
17
|
-
* CvSize2D32f size; // box width and length
|
|
18
|
-
* float angle; // angle between the horizonal axis and the first side (i.e length) in radians
|
|
19
|
-
* } CvBox2D;
|
|
14
|
+
* Stores coordinates of a rotated rectangle.
|
|
20
15
|
*/
|
|
21
16
|
__NAMESPACE_BEGIN_OPENCV
|
|
22
17
|
__NAMESPACE_BEGIN_CVBOX2D
|
|
@@ -29,29 +24,6 @@ rb_class()
|
|
|
29
24
|
return rb_klass;
|
|
30
25
|
}
|
|
31
26
|
|
|
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, "CvBox2D", rb_cObject);
|
|
44
|
-
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
45
|
-
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
46
|
-
rb_define_method(rb_klass, "center", RUBY_METHOD_FUNC(rb_center), 0);
|
|
47
|
-
rb_define_method(rb_klass, "center=", RUBY_METHOD_FUNC(rb_set_center), 1);
|
|
48
|
-
rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_size), 0);
|
|
49
|
-
rb_define_method(rb_klass, "size=", RUBY_METHOD_FUNC(rb_set_size), 1);
|
|
50
|
-
rb_define_method(rb_klass, "angle", RUBY_METHOD_FUNC(rb_angle), 0);
|
|
51
|
-
rb_define_method(rb_klass, "angle=", RUBY_METHOD_FUNC(rb_set_angle), 1);
|
|
52
|
-
rb_define_method(rb_klass, "points", RUBY_METHOD_FUNC(rb_points), 0);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
27
|
VALUE
|
|
56
28
|
rb_allocate(VALUE klass)
|
|
57
29
|
{
|
|
@@ -59,11 +31,13 @@ rb_allocate(VALUE klass)
|
|
|
59
31
|
return Data_Make_Struct(klass, CvBox2D, 0, -1, ptr);
|
|
60
32
|
}
|
|
61
33
|
|
|
62
|
-
/*
|
|
63
|
-
* call-seq:
|
|
64
|
-
* CvBox2D.new(<i>[center][, size][, angle]</i>) -> cvbox2d
|
|
65
|
-
*
|
|
34
|
+
/*
|
|
66
35
|
* Create a box
|
|
36
|
+
* @overload new(center=nil, size=nil, angle=nil)
|
|
37
|
+
* @param center [CvPoint2D32f,nil] Center of the box
|
|
38
|
+
* @param size [CvSize,nil] Size of the box
|
|
39
|
+
* @param angle [Number,nil] Angle between the horizontal axis and the first side in degrees
|
|
40
|
+
* @return [CvBox2D] New box
|
|
67
41
|
*/
|
|
68
42
|
VALUE
|
|
69
43
|
rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
@@ -84,9 +58,9 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
|
84
58
|
}
|
|
85
59
|
|
|
86
60
|
/*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
61
|
+
* Returns center point of the box
|
|
62
|
+
* @overload center
|
|
63
|
+
* @return [CvPoint2D32f] Center of the box
|
|
90
64
|
*/
|
|
91
65
|
VALUE
|
|
92
66
|
rb_center(VALUE self)
|
|
@@ -95,10 +69,10 @@ rb_center(VALUE self)
|
|
|
95
69
|
}
|
|
96
70
|
|
|
97
71
|
/*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
72
|
+
* Set center point of the box
|
|
73
|
+
* @overload center=value
|
|
74
|
+
* @param value [CvPoint2D32f] Center of the box
|
|
75
|
+
* @return [CvBox2D] self
|
|
102
76
|
*/
|
|
103
77
|
VALUE
|
|
104
78
|
rb_set_center(VALUE self, VALUE value)
|
|
@@ -108,9 +82,9 @@ rb_set_center(VALUE self, VALUE value)
|
|
|
108
82
|
}
|
|
109
83
|
|
|
110
84
|
/*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
85
|
+
* Returns size of the box
|
|
86
|
+
* @overload size
|
|
87
|
+
* @return [CvSize2D32f] Size of the box
|
|
114
88
|
*/
|
|
115
89
|
VALUE
|
|
116
90
|
rb_size(VALUE self)
|
|
@@ -119,10 +93,10 @@ rb_size(VALUE self)
|
|
|
119
93
|
}
|
|
120
94
|
|
|
121
95
|
/*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
96
|
+
* Set size of the box
|
|
97
|
+
* @overload size=value
|
|
98
|
+
* @param value [CvSize2D32f] Size of the box
|
|
99
|
+
* @return [CvBox2D] self
|
|
126
100
|
*/
|
|
127
101
|
VALUE
|
|
128
102
|
rb_set_size(VALUE self, VALUE value)
|
|
@@ -132,10 +106,9 @@ rb_set_size(VALUE self, VALUE value)
|
|
|
132
106
|
}
|
|
133
107
|
|
|
134
108
|
/*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* Return angle of box as Float.
|
|
109
|
+
* Returns angle of the box
|
|
110
|
+
* @overload angle
|
|
111
|
+
* @return [Float] Angle of the box
|
|
139
112
|
*/
|
|
140
113
|
VALUE
|
|
141
114
|
rb_angle(VALUE self)
|
|
@@ -144,10 +117,10 @@ rb_angle(VALUE self)
|
|
|
144
117
|
}
|
|
145
118
|
|
|
146
119
|
/*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
120
|
+
* Set angle of the box
|
|
121
|
+
* @overload angle=value
|
|
122
|
+
* @param value [Number] Angle of the box
|
|
123
|
+
* @return [CvBox2D] self
|
|
151
124
|
*/
|
|
152
125
|
VALUE
|
|
153
126
|
rb_set_angle(VALUE self, VALUE value)
|
|
@@ -157,9 +130,10 @@ rb_set_angle(VALUE self, VALUE value)
|
|
|
157
130
|
}
|
|
158
131
|
|
|
159
132
|
/*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
133
|
+
* Find box vertices
|
|
134
|
+
* @overload points
|
|
135
|
+
* @return [Array<CvPoint2D32f>] Vertices of the box
|
|
136
|
+
* @opencv_func cvBoxPoints
|
|
163
137
|
*/
|
|
164
138
|
VALUE
|
|
165
139
|
rb_points(VALUE self)
|
|
@@ -193,5 +167,29 @@ new_object(CvBox2D box)
|
|
|
193
167
|
return object;
|
|
194
168
|
}
|
|
195
169
|
|
|
170
|
+
void
|
|
171
|
+
init_ruby_class()
|
|
172
|
+
{
|
|
173
|
+
#if 0
|
|
174
|
+
// For documentation using YARD
|
|
175
|
+
VALUE opencv = rb_define_module("OpenCV");
|
|
176
|
+
#endif
|
|
177
|
+
|
|
178
|
+
if (rb_klass)
|
|
179
|
+
return;
|
|
180
|
+
|
|
181
|
+
VALUE opencv = rb_module_opencv();
|
|
182
|
+
rb_klass = rb_define_class_under(opencv, "CvBox2D", rb_cObject);
|
|
183
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
|
184
|
+
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
|
185
|
+
rb_define_method(rb_klass, "center", RUBY_METHOD_FUNC(rb_center), 0);
|
|
186
|
+
rb_define_method(rb_klass, "center=", RUBY_METHOD_FUNC(rb_set_center), 1);
|
|
187
|
+
rb_define_method(rb_klass, "size", RUBY_METHOD_FUNC(rb_size), 0);
|
|
188
|
+
rb_define_method(rb_klass, "size=", RUBY_METHOD_FUNC(rb_set_size), 1);
|
|
189
|
+
rb_define_method(rb_klass, "angle", RUBY_METHOD_FUNC(rb_angle), 0);
|
|
190
|
+
rb_define_method(rb_klass, "angle=", RUBY_METHOD_FUNC(rb_set_angle), 1);
|
|
191
|
+
rb_define_method(rb_klass, "points", RUBY_METHOD_FUNC(rb_points), 0);
|
|
192
|
+
}
|
|
193
|
+
|
|
196
194
|
__NAMESPACE_END_CVBOX2D
|
|
197
195
|
__NAMESPACE_END_OPENCV
|