afeld-opencv 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +23 -0
- data/Gemfile +6 -0
- data/History.txt +5 -0
- data/License.txt +30 -0
- data/Manifest.txt +217 -0
- data/README.rdoc +161 -0
- data/Rakefile +52 -0
- data/examples/alpha_blend.rb +21 -0
- data/examples/box.png +0 -0
- data/examples/box_in_scene.png +0 -0
- data/examples/contours/bitmap-contours-with-labels.png +0 -0
- data/examples/contours/bitmap-contours.png +0 -0
- data/examples/contours/bounding-box-detect-canny.rb +62 -0
- data/examples/contours/contour_retrieval_modes.rb +139 -0
- data/examples/contours/rotated-boxes.jpg +0 -0
- data/examples/convexhull.rb +47 -0
- data/examples/face_detect.rb +20 -0
- data/examples/find_obj.rb +169 -0
- data/examples/houghcircle.rb +22 -0
- data/examples/inpaint.png +0 -0
- data/examples/inpaint.rb +57 -0
- data/examples/lenna-rotated.jpg +0 -0
- data/examples/lenna.jpg +0 -0
- data/examples/match_kdtree.rb +88 -0
- data/examples/paint.rb +70 -0
- data/examples/snake.rb +43 -0
- data/examples/stuff.jpg +0 -0
- data/examples/tiffany.jpg +0 -0
- data/ext/opencv/curve.cpp +112 -0
- data/ext/opencv/curve.h +34 -0
- data/ext/opencv/cvavgcomp.cpp +67 -0
- data/ext/opencv/cvavgcomp.h +39 -0
- data/ext/opencv/cvbox2d.cpp +197 -0
- data/ext/opencv/cvbox2d.h +61 -0
- data/ext/opencv/cvcapture.cpp +499 -0
- data/ext/opencv/cvcapture.h +72 -0
- data/ext/opencv/cvchain.cpp +230 -0
- data/ext/opencv/cvchain.h +46 -0
- data/ext/opencv/cvcircle32f.cpp +116 -0
- data/ext/opencv/cvcircle32f.h +52 -0
- data/ext/opencv/cvcondensation.cpp +282 -0
- data/ext/opencv/cvcondensation.h +49 -0
- data/ext/opencv/cvconnectedcomp.cpp +143 -0
- data/ext/opencv/cvconnectedcomp.h +49 -0
- data/ext/opencv/cvcontour.cpp +297 -0
- data/ext/opencv/cvcontour.h +48 -0
- data/ext/opencv/cvcontourtree.cpp +91 -0
- data/ext/opencv/cvcontourtree.h +41 -0
- data/ext/opencv/cvconvexitydefect.cpp +103 -0
- data/ext/opencv/cvconvexitydefect.h +42 -0
- data/ext/opencv/cverror.cpp +159 -0
- data/ext/opencv/cverror.h +28 -0
- data/ext/opencv/cvfeaturetree.cpp +125 -0
- data/ext/opencv/cvfeaturetree.h +55 -0
- data/ext/opencv/cvfont.cpp +208 -0
- data/ext/opencv/cvfont.h +64 -0
- data/ext/opencv/cvhaarclassifiercascade.cpp +168 -0
- data/ext/opencv/cvhaarclassifiercascade.h +39 -0
- data/ext/opencv/cvhistogram.cpp +546 -0
- data/ext/opencv/cvhistogram.h +73 -0
- data/ext/opencv/cvhumoments.cpp +139 -0
- data/ext/opencv/cvhumoments.h +51 -0
- data/ext/opencv/cvline.cpp +154 -0
- data/ext/opencv/cvline.h +54 -0
- data/ext/opencv/cvmat.cpp +5627 -0
- data/ext/opencv/cvmat.h +280 -0
- data/ext/opencv/cvmatnd.cpp +44 -0
- data/ext/opencv/cvmatnd.h +28 -0
- data/ext/opencv/cvmemstorage.cpp +68 -0
- data/ext/opencv/cvmemstorage.h +53 -0
- data/ext/opencv/cvmoments.cpp +287 -0
- data/ext/opencv/cvmoments.h +75 -0
- data/ext/opencv/cvpoint.cpp +228 -0
- data/ext/opencv/cvpoint.h +64 -0
- data/ext/opencv/cvpoint2d32f.cpp +211 -0
- data/ext/opencv/cvpoint2d32f.h +63 -0
- data/ext/opencv/cvpoint3d32f.cpp +246 -0
- data/ext/opencv/cvpoint3d32f.h +66 -0
- data/ext/opencv/cvrect.cpp +333 -0
- data/ext/opencv/cvrect.h +79 -0
- data/ext/opencv/cvscalar.cpp +236 -0
- data/ext/opencv/cvscalar.h +71 -0
- data/ext/opencv/cvseq.cpp +599 -0
- data/ext/opencv/cvseq.h +72 -0
- data/ext/opencv/cvsize.cpp +221 -0
- data/ext/opencv/cvsize.h +65 -0
- data/ext/opencv/cvsize2d32f.cpp +209 -0
- data/ext/opencv/cvsize2d32f.h +64 -0
- data/ext/opencv/cvslice.cpp +120 -0
- data/ext/opencv/cvslice.h +61 -0
- data/ext/opencv/cvsparsemat.cpp +44 -0
- data/ext/opencv/cvsparsemat.h +28 -0
- data/ext/opencv/cvsurfparams.cpp +199 -0
- data/ext/opencv/cvsurfparams.h +58 -0
- data/ext/opencv/cvsurfpoint.cpp +223 -0
- data/ext/opencv/cvsurfpoint.h +52 -0
- data/ext/opencv/cvtermcriteria.cpp +192 -0
- data/ext/opencv/cvtermcriteria.h +71 -0
- data/ext/opencv/cvtwopoints.cpp +116 -0
- data/ext/opencv/cvtwopoints.h +51 -0
- data/ext/opencv/cvutils.cpp +194 -0
- data/ext/opencv/cvutils.h +29 -0
- data/ext/opencv/cvvideowriter.cpp +137 -0
- data/ext/opencv/cvvideowriter.h +43 -0
- data/ext/opencv/gui.cpp +68 -0
- data/ext/opencv/gui.h +30 -0
- data/ext/opencv/iplconvkernel.cpp +192 -0
- data/ext/opencv/iplconvkernel.h +71 -0
- data/ext/opencv/iplimage.cpp +576 -0
- data/ext/opencv/iplimage.h +70 -0
- data/ext/opencv/lib/opencv.rb +3 -0
- data/ext/opencv/lib/opencv/psyched_yaml.rb +22 -0
- data/ext/opencv/lib/opencv/version.rb +3 -0
- data/ext/opencv/mouseevent.cpp +181 -0
- data/ext/opencv/mouseevent.h +56 -0
- data/ext/opencv/opencv.cpp +710 -0
- data/ext/opencv/opencv.h +400 -0
- data/ext/opencv/pointset.cpp +284 -0
- data/ext/opencv/pointset.h +69 -0
- data/ext/opencv/trackbar.cpp +121 -0
- data/ext/opencv/trackbar.h +69 -0
- data/ext/opencv/window.cpp +357 -0
- data/ext/opencv/window.h +66 -0
- data/extconf.rb +65 -0
- data/images/CvMat_sobel.png +0 -0
- data/images/CvMat_sub_rect.png +0 -0
- data/images/CvSeq_relationmap.png +0 -0
- data/images/face_detect_from_lena.jpg +0 -0
- data/test/helper.rb +146 -0
- data/test/runner.rb +30 -0
- data/test/samples/airplane.jpg +0 -0
- data/test/samples/baboon.jpg +0 -0
- data/test/samples/baboon200.jpg +0 -0
- data/test/samples/baboon200_rotated.jpg +0 -0
- data/test/samples/blank0.jpg +0 -0
- data/test/samples/blank1.jpg +0 -0
- data/test/samples/blank2.jpg +0 -0
- data/test/samples/blank3.jpg +0 -0
- data/test/samples/blank4.jpg +0 -0
- data/test/samples/blank5.jpg +0 -0
- data/test/samples/blank6.jpg +0 -0
- data/test/samples/blank7.jpg +0 -0
- data/test/samples/blank8.jpg +0 -0
- data/test/samples/blank9.jpg +0 -0
- data/test/samples/cat.jpg +0 -0
- data/test/samples/contours.jpg +0 -0
- data/test/samples/fruits.jpg +0 -0
- data/test/samples/haarcascade_frontalface_alt.xml.gz +0 -0
- data/test/samples/inpaint-mask.bmp +0 -0
- data/test/samples/lena-256x256.jpg +0 -0
- data/test/samples/lena-32x32.jpg +0 -0
- data/test/samples/lena-eyes.jpg +0 -0
- data/test/samples/lena-inpaint.jpg +0 -0
- data/test/samples/lena.jpg +0 -0
- data/test/samples/lines.jpg +0 -0
- data/test/samples/messy0.jpg +0 -0
- data/test/samples/messy1.jpg +0 -0
- data/test/samples/movie_sample.avi +0 -0
- data/test/samples/one_way_train_0000.jpg +0 -0
- data/test/samples/one_way_train_0001.jpg +0 -0
- data/test/samples/partially_blank0.jpg +0 -0
- data/test/samples/partially_blank1.jpg +0 -0
- data/test/samples/smooth0.jpg +0 -0
- data/test/samples/smooth1.jpg +0 -0
- data/test/samples/smooth2.jpg +0 -0
- data/test/samples/smooth3.jpg +0 -0
- data/test/samples/smooth4.jpg +0 -0
- data/test/samples/smooth5.jpg +0 -0
- data/test/samples/smooth6.jpg +0 -0
- data/test/samples/str-cv-rotated.jpg +0 -0
- data/test/samples/str-cv.jpg +0 -0
- data/test/samples/str-ov.jpg +0 -0
- data/test/samples/stuff.jpg +0 -0
- data/test/test_curve.rb +43 -0
- data/test/test_cvavgcomp.rb +24 -0
- data/test/test_cvbox2d.rb +76 -0
- data/test/test_cvcapture.rb +183 -0
- data/test/test_cvchain.rb +108 -0
- data/test/test_cvcircle32f.rb +41 -0
- data/test/test_cvconnectedcomp.rb +61 -0
- data/test/test_cvcontour.rb +150 -0
- data/test/test_cvcontourtree.rb +43 -0
- data/test/test_cverror.rb +50 -0
- data/test/test_cvfeaturetree.rb +65 -0
- data/test/test_cvfont.rb +58 -0
- data/test/test_cvhaarclassifiercascade.rb +63 -0
- data/test/test_cvhistogram.rb +271 -0
- data/test/test_cvhumoments.rb +83 -0
- data/test/test_cvline.rb +50 -0
- data/test/test_cvmat.rb +2752 -0
- data/test/test_cvmat_drawing.rb +318 -0
- data/test/test_cvmat_dxt.rb +147 -0
- data/test/test_cvmat_imageprocessing.rb +1943 -0
- data/test/test_cvmoments.rb +180 -0
- data/test/test_cvpoint.rb +75 -0
- data/test/test_cvpoint2d32f.rb +75 -0
- data/test/test_cvpoint3d32f.rb +93 -0
- data/test/test_cvrect.rb +144 -0
- data/test/test_cvscalar.rb +113 -0
- data/test/test_cvseq.rb +295 -0
- data/test/test_cvsize.rb +75 -0
- data/test/test_cvsize2d32f.rb +75 -0
- data/test/test_cvslice.rb +31 -0
- data/test/test_cvsurfparams.rb +57 -0
- data/test/test_cvsurfpoint.rb +66 -0
- data/test/test_cvtermcriteria.rb +56 -0
- data/test/test_cvtwopoints.rb +40 -0
- data/test/test_cvvideowriter.rb +58 -0
- data/test/test_iplconvkernel.rb +54 -0
- data/test/test_iplimage.rb +156 -0
- data/test/test_mouseevent.rb +17 -0
- data/test/test_opencv.rb +340 -0
- data/test/test_pointset.rb +130 -0
- data/test/test_preliminary.rb +130 -0
- data/test/test_trackbar.rb +47 -0
- data/test/test_window.rb +115 -0
- metadata +399 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvsize2d32f.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVSIZE2D32F_H
|
11
|
+
#define RUBY_OPENCV_CVSIZE2D32F_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVSIZE2D32F namespace cCvSize2D32f {
|
16
|
+
#define __NAMESPACE_END_CVSIZE2D32F }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVSIZE2D32F
|
20
|
+
|
21
|
+
VALUE rb_class();
|
22
|
+
|
23
|
+
void define_ruby_class();
|
24
|
+
|
25
|
+
VALUE rb_compatible_q(VALUE klass, VALUE object);
|
26
|
+
|
27
|
+
VALUE rb_allocate(VALUE klass);
|
28
|
+
VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
|
29
|
+
VALUE rb_width(VALUE self);
|
30
|
+
VALUE rb_set_width(VALUE self, VALUE width);
|
31
|
+
VALUE rb_height(VALUE self);
|
32
|
+
VALUE rb_set_height(VALUE self, VALUE height);
|
33
|
+
|
34
|
+
VALUE rb_to_s(VALUE self);
|
35
|
+
VALUE rb_to_ary(VALUE self);
|
36
|
+
|
37
|
+
VALUE new_object(CvSize2D32f size);
|
38
|
+
|
39
|
+
__NAMESPACE_END_CVSIZE2D32F
|
40
|
+
|
41
|
+
inline CvSize2D32f*
|
42
|
+
CVSIZE2D32F(VALUE object)
|
43
|
+
{
|
44
|
+
CvSize2D32f *ptr;
|
45
|
+
Data_Get_Struct(object, CvSize2D32f, ptr);
|
46
|
+
return ptr;
|
47
|
+
}
|
48
|
+
|
49
|
+
inline CvSize2D32f
|
50
|
+
VALUE_TO_CVSIZE2D32F(VALUE object)
|
51
|
+
{
|
52
|
+
if (cCvSize2D32f::rb_compatible_q(cCvSize2D32f::rb_class(), object)) {
|
53
|
+
return cvSize2D32f(NUM2DBL(rb_funcall(object, rb_intern("width"), 0)),
|
54
|
+
NUM2DBL(rb_funcall(object, rb_intern("height"), 0)));
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
raise_compatible_typeerror(object, cCvSize2D32f::rb_class());
|
58
|
+
}
|
59
|
+
throw "Should never reach here";
|
60
|
+
}
|
61
|
+
|
62
|
+
__NAMESPACE_END_OPENCV
|
63
|
+
|
64
|
+
#endif // RUBY_OPENCV_CVSIZE2D32F_H
|
@@ -0,0 +1,120 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvslice.cpp -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cvslice.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvClice
|
13
|
+
*
|
14
|
+
* C structure is here, very simple.
|
15
|
+
* typdef struct CvSlice {
|
16
|
+
* int start_index;
|
17
|
+
* int end_index;
|
18
|
+
* } CvSlice;
|
19
|
+
*/
|
20
|
+
__NAMESPACE_BEGIN_OPENCV
|
21
|
+
__NAMESPACE_BEGIN_CVSLICE
|
22
|
+
|
23
|
+
VALUE rb_klass;
|
24
|
+
|
25
|
+
VALUE
|
26
|
+
rb_class()
|
27
|
+
{
|
28
|
+
return rb_klass;
|
29
|
+
}
|
30
|
+
|
31
|
+
void
|
32
|
+
define_ruby_class()
|
33
|
+
{
|
34
|
+
if (rb_klass)
|
35
|
+
return;
|
36
|
+
/*
|
37
|
+
* opencv = rb_define_module("OpenCV");
|
38
|
+
*
|
39
|
+
* note: this comment is used by rdoc.
|
40
|
+
*/
|
41
|
+
VALUE opencv = rb_module_opencv();
|
42
|
+
rb_klass = rb_define_class_under(opencv, "CvSlice", rb_cObject);
|
43
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
44
|
+
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), 2);
|
45
|
+
rb_define_method(rb_klass, "start_index", RUBY_METHOD_FUNC(rb_start_index_aref), 0);
|
46
|
+
rb_define_method(rb_klass, "end_index", RUBY_METHOD_FUNC(rb_end_index_aref), 0);
|
47
|
+
rb_define_method(rb_klass, "start_index=", RUBY_METHOD_FUNC(rb_start_index_aset), 1);
|
48
|
+
rb_define_method(rb_klass, "end_index=", RUBY_METHOD_FUNC(rb_end_index_aset), 1);
|
49
|
+
}
|
50
|
+
|
51
|
+
VALUE
|
52
|
+
rb_allocate(VALUE klass)
|
53
|
+
{
|
54
|
+
CvSlice *ptr;
|
55
|
+
return Data_Make_Struct(klass, CvSlice, 0, -1, ptr);
|
56
|
+
}
|
57
|
+
|
58
|
+
/*
|
59
|
+
* call-seq:
|
60
|
+
* new(<i>start, end</i>)
|
61
|
+
*
|
62
|
+
* Create new slice object.
|
63
|
+
*/
|
64
|
+
VALUE
|
65
|
+
rb_initialize(VALUE self, VALUE start, VALUE end)
|
66
|
+
{
|
67
|
+
CvSlice *self_ptr = CVSLICE(self);
|
68
|
+
self_ptr->start_index = NUM2INT(start);
|
69
|
+
self_ptr->end_index = NUM2INT(end);
|
70
|
+
return self;
|
71
|
+
}
|
72
|
+
|
73
|
+
/*
|
74
|
+
* call-seq:
|
75
|
+
* start_index
|
76
|
+
*
|
77
|
+
*/
|
78
|
+
VALUE
|
79
|
+
rb_start_index_aref(VALUE self)
|
80
|
+
{
|
81
|
+
return INT2NUM(CVSLICE(self)->start_index);
|
82
|
+
}
|
83
|
+
|
84
|
+
/*
|
85
|
+
* call-seq:
|
86
|
+
* end_index
|
87
|
+
*
|
88
|
+
*/
|
89
|
+
VALUE
|
90
|
+
rb_end_index_aref(VALUE self)
|
91
|
+
{
|
92
|
+
return INT2NUM(CVSLICE(self)->end_index);
|
93
|
+
}
|
94
|
+
|
95
|
+
/*
|
96
|
+
* call-seq:
|
97
|
+
* start_index = index
|
98
|
+
*
|
99
|
+
*/
|
100
|
+
VALUE
|
101
|
+
rb_start_index_aset(VALUE self, VALUE index)
|
102
|
+
{
|
103
|
+
CVSLICE(self)->start_index = NUM2INT(index);
|
104
|
+
return self;
|
105
|
+
}
|
106
|
+
|
107
|
+
/*
|
108
|
+
* call-seq:
|
109
|
+
* end_index = index
|
110
|
+
*
|
111
|
+
*/
|
112
|
+
VALUE
|
113
|
+
rb_end_index_aset(VALUE self, VALUE index)
|
114
|
+
{
|
115
|
+
CVSLICE(self)->end_index = NUM2INT(index);
|
116
|
+
return self;
|
117
|
+
}
|
118
|
+
|
119
|
+
__NAMESPACE_END_CVSLICE
|
120
|
+
__NAMESPACE_END_OPENCV
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvslice.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVSLICE_H
|
11
|
+
#define RUBY_OPENCV_CVSLICE_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVSLICE namespace cCvSlice {
|
16
|
+
#define __NAMESPACE_END_CVSLICE }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVSLICE
|
20
|
+
|
21
|
+
VALUE rb_class();
|
22
|
+
|
23
|
+
void define_ruby_class();
|
24
|
+
|
25
|
+
VALUE rb_allocate(VALUE klass);
|
26
|
+
VALUE rb_initialize(VALUE self, VALUE start, VALUE end);
|
27
|
+
VALUE rb_start_index_aref(VALUE self);
|
28
|
+
VALUE rb_end_index_aref(VALUE self);
|
29
|
+
VALUE rb_start_index_aset(VALUE self, VALUE index);
|
30
|
+
VALUE rb_end_index_aset(VALUE self, VALUE index);
|
31
|
+
|
32
|
+
__NAMESPACE_END_CVSLICE
|
33
|
+
|
34
|
+
inline CvSlice*
|
35
|
+
CVSLICE(VALUE object)
|
36
|
+
{
|
37
|
+
CvSlice *ptr;
|
38
|
+
Data_Get_Struct(object, CvSlice, ptr);
|
39
|
+
return ptr;
|
40
|
+
}
|
41
|
+
|
42
|
+
inline CvSlice
|
43
|
+
VALUE_TO_CVSLICE(VALUE object)
|
44
|
+
{
|
45
|
+
if (rb_obj_is_kind_of(object, cCvSlice::rb_class())) {
|
46
|
+
CvSlice* ptr = CVSLICE(object);
|
47
|
+
return *ptr;
|
48
|
+
}
|
49
|
+
else if (rb_obj_is_kind_of(object, rb_cRange)) {
|
50
|
+
return cvSlice(NUM2INT(rb_funcall(object, rb_intern("begin"), 0)),
|
51
|
+
rb_funcall(object, rb_intern("exclude_end?"), 0) ? NUM2INT(rb_funcall(object, rb_intern("end"), 0)) : NUM2INT(rb_funcall(object, rb_intern("end"), 0)) - 1);
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
raise_compatible_typeerror(object, cCvSlice::rb_class());
|
55
|
+
}
|
56
|
+
throw "Should never reach here";
|
57
|
+
}
|
58
|
+
|
59
|
+
__NAMESPACE_END_OPENCV
|
60
|
+
|
61
|
+
#endif // RUBY_OPENCV_CVSLICE_H
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/***********************************************************
|
2
|
+
|
3
|
+
cvsparse.cpp -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cvsparsemat.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvSparseMat
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
__NAMESPACE_BEGIN_OPENCV
|
16
|
+
__NAMESPACE_BEGIN_CVSPARSEMAT
|
17
|
+
|
18
|
+
VALUE rb_klass;
|
19
|
+
|
20
|
+
VALUE
|
21
|
+
rb_class()
|
22
|
+
{
|
23
|
+
return rb_klass;
|
24
|
+
}
|
25
|
+
|
26
|
+
void
|
27
|
+
define_ruby_class()
|
28
|
+
{
|
29
|
+
if (rb_klass)
|
30
|
+
return;
|
31
|
+
/*
|
32
|
+
* opencv = rb_define_module("OpenCV");
|
33
|
+
* cvmat = rb_define_class_under(opencv, "CvMat", rb_cObject);
|
34
|
+
*
|
35
|
+
* note: this comment is used by rdoc.
|
36
|
+
*/
|
37
|
+
VALUE opencv = rb_module_opencv(), cvmat = cCvMat::rb_class();
|
38
|
+
|
39
|
+
rb_klass = rb_define_class_under(opencv, "CvSparseMat", cvmat);
|
40
|
+
}
|
41
|
+
|
42
|
+
__NAMESPACE_END_CVSPARSEMAT
|
43
|
+
__NAMESPACE_END_OPENCV
|
44
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvsparsemat.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVSPARSEMAT_H
|
11
|
+
#define RUBY_OPENCV_CVSPARSEMAT_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVSPARSEMAT namespace cCvSparseMat {
|
16
|
+
#define __NAMESPACE_END_CVSPARSEMAT }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVSPARSEMAT
|
20
|
+
|
21
|
+
VALUE rb_class();
|
22
|
+
|
23
|
+
void define_ruby_class();
|
24
|
+
|
25
|
+
__NAMESPACE_END_CVSPARSEMAT
|
26
|
+
__NAMESPACE_END_OPENCV
|
27
|
+
|
28
|
+
#endif // RUBY_OPENCV_CVSPARSEMAT_H
|
@@ -0,0 +1,199 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvsurfparams.cpp -
|
4
|
+
|
5
|
+
$Author: ser1zw $
|
6
|
+
|
7
|
+
Copyright (C) 2011 ser1zw
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cvsurfparams.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvSURFParams
|
13
|
+
*
|
14
|
+
* C structure is here.
|
15
|
+
* typedef struct CvSURFParams {
|
16
|
+
* int extended;
|
17
|
+
* double hessianThreshold;
|
18
|
+
* int nOctaves;
|
19
|
+
* int nOctaveLayers;
|
20
|
+
* } CvSURFParams;
|
21
|
+
*/
|
22
|
+
__NAMESPACE_BEGIN_OPENCV
|
23
|
+
__NAMESPACE_BEGIN_CVSURFPARAMS
|
24
|
+
|
25
|
+
VALUE rb_klass;
|
26
|
+
|
27
|
+
VALUE
|
28
|
+
rb_class()
|
29
|
+
{
|
30
|
+
return rb_klass;
|
31
|
+
}
|
32
|
+
|
33
|
+
void
|
34
|
+
define_ruby_class()
|
35
|
+
{
|
36
|
+
if (rb_klass)
|
37
|
+
return;
|
38
|
+
/*
|
39
|
+
* opencv = rb_define_module("OpenCV");
|
40
|
+
*
|
41
|
+
* note: this comment is used by rdoc.
|
42
|
+
*/
|
43
|
+
VALUE opencv = rb_module_opencv();
|
44
|
+
rb_klass = rb_define_class_under(opencv, "CvSURFParams", rb_cObject);
|
45
|
+
rb_define_alloc_func(rb_klass, rb_allocate);
|
46
|
+
rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
|
47
|
+
rb_define_method(rb_klass, "hessian_threshold", RUBY_METHOD_FUNC(rb_get_hessian_threshold), 0);
|
48
|
+
rb_define_method(rb_klass, "hessian_threshold=", RUBY_METHOD_FUNC(rb_set_hessian_threshold), 1);
|
49
|
+
rb_define_method(rb_klass, "extended", RUBY_METHOD_FUNC(rb_get_extended), 0);
|
50
|
+
rb_define_method(rb_klass, "extended=", RUBY_METHOD_FUNC(rb_set_extended), 1);
|
51
|
+
rb_define_method(rb_klass, "n_octaves", RUBY_METHOD_FUNC(rb_get_n_octaves), 0);
|
52
|
+
rb_define_method(rb_klass, "n_octaves=", RUBY_METHOD_FUNC(rb_set_n_octaves), 1);
|
53
|
+
rb_define_method(rb_klass, "n_octave_layers", RUBY_METHOD_FUNC(rb_get_n_octave_layers), 0);
|
54
|
+
rb_define_method(rb_klass, "n_octave_layers=", RUBY_METHOD_FUNC(rb_set_n_octave_layers), 1);
|
55
|
+
}
|
56
|
+
|
57
|
+
VALUE
|
58
|
+
rb_allocate(VALUE klass)
|
59
|
+
{
|
60
|
+
CvSURFParams *ptr;
|
61
|
+
return Data_Make_Struct(klass, CvSURFParams, 0, -1, ptr);
|
62
|
+
}
|
63
|
+
|
64
|
+
/*
|
65
|
+
* call-seq:
|
66
|
+
* CvSURFParams.new(<i>hessian_threshold[,extended=false,n_octaves=3,n_octave_layers=4]</i>) -> cvsurfparams
|
67
|
+
*
|
68
|
+
* Create a CvSURFParams
|
69
|
+
*/
|
70
|
+
VALUE
|
71
|
+
rb_initialize(int argc, VALUE *argv, VALUE self)
|
72
|
+
{
|
73
|
+
CvSURFParams *self_ptr = CVSURFPARAMS(self);
|
74
|
+
VALUE h_thresh, ext, noct, noctl;
|
75
|
+
rb_scan_args(argc, argv, "13", &h_thresh, &ext, &noct, &noctl);
|
76
|
+
|
77
|
+
self_ptr->hessianThreshold = NUM2DBL(h_thresh);
|
78
|
+
self_ptr->extended = NIL_P(ext) ? 0 : BOOL2INT(ext);
|
79
|
+
self_ptr->nOctaves = NIL_P(noct) ? 3 : NUM2INT(noct);
|
80
|
+
self_ptr->nOctaveLayers = NIL_P(noctl) ? 4 : NUM2INT(noctl);
|
81
|
+
|
82
|
+
return self;
|
83
|
+
}
|
84
|
+
|
85
|
+
/*
|
86
|
+
* call-seq:
|
87
|
+
* hessian_threshold -> number
|
88
|
+
* Return threshold of hessian
|
89
|
+
*/
|
90
|
+
VALUE
|
91
|
+
rb_get_hessian_threshold(VALUE self)
|
92
|
+
{
|
93
|
+
return DBL2NUM(CVSURFPARAMS(self)->hessianThreshold);
|
94
|
+
}
|
95
|
+
|
96
|
+
/*
|
97
|
+
* call-seq:
|
98
|
+
* hessian_threshold = <i>value</i>
|
99
|
+
*
|
100
|
+
* Set threshold of hessian to <i>value</i>
|
101
|
+
*/
|
102
|
+
VALUE
|
103
|
+
rb_set_hessian_threshold(VALUE self, VALUE value)
|
104
|
+
{
|
105
|
+
CVSURFPARAMS(self)->hessianThreshold = NUM2DBL(value);
|
106
|
+
return self;
|
107
|
+
}
|
108
|
+
|
109
|
+
/*
|
110
|
+
* call-seq:
|
111
|
+
* extended -> bool
|
112
|
+
* Return the type of descripters
|
113
|
+
* false: basic descriptors (64 elements each)
|
114
|
+
* true : exteneded descriptors (128 elements each)
|
115
|
+
*/
|
116
|
+
VALUE
|
117
|
+
rb_get_extended(VALUE self)
|
118
|
+
{
|
119
|
+
return INT2BOOL(CVSURFPARAMS(self)->extended);
|
120
|
+
}
|
121
|
+
|
122
|
+
/*
|
123
|
+
* call-seq:
|
124
|
+
* extended = <i>value</i>
|
125
|
+
* Set the type of descripters
|
126
|
+
* false: basic descriptors (64 elements each)
|
127
|
+
* true : exteneded descriptors (128 elements each)
|
128
|
+
*/
|
129
|
+
VALUE
|
130
|
+
rb_set_extended(VALUE self, VALUE value)
|
131
|
+
{
|
132
|
+
CVSURFPARAMS(self)->extended = BOOL2INT(value);
|
133
|
+
return self;
|
134
|
+
}
|
135
|
+
|
136
|
+
/*
|
137
|
+
* call-seq:
|
138
|
+
* n_octaves -> fixnum
|
139
|
+
* Return the number of octaves to be used for extraction
|
140
|
+
*/
|
141
|
+
VALUE
|
142
|
+
rb_get_n_octaves(VALUE self)
|
143
|
+
{
|
144
|
+
return INT2NUM(CVSURFPARAMS(self)->nOctaves);
|
145
|
+
}
|
146
|
+
|
147
|
+
/*
|
148
|
+
* call-seq:
|
149
|
+
* n_octaves = <i>value</i>
|
150
|
+
* Set the number of octaves to be used for extraction
|
151
|
+
*/
|
152
|
+
VALUE
|
153
|
+
rb_set_n_octaves(VALUE self, VALUE value)
|
154
|
+
{
|
155
|
+
CVSURFPARAMS(self)->nOctaves = NUM2INT(value);
|
156
|
+
return self;
|
157
|
+
}
|
158
|
+
|
159
|
+
/*
|
160
|
+
* call-seq:
|
161
|
+
* n_octave_layers -> fixnum
|
162
|
+
* Return the number of layers within each octave
|
163
|
+
*/
|
164
|
+
VALUE
|
165
|
+
rb_get_n_octave_layers(VALUE self)
|
166
|
+
{
|
167
|
+
return INT2NUM(CVSURFPARAMS(self)->nOctaveLayers);
|
168
|
+
}
|
169
|
+
|
170
|
+
/*
|
171
|
+
* call-seq:
|
172
|
+
* n_octave_layers = <i>value</i>
|
173
|
+
* Set the number of layers within each octave
|
174
|
+
*/
|
175
|
+
VALUE
|
176
|
+
rb_set_n_octave_layers(VALUE self, VALUE value)
|
177
|
+
{
|
178
|
+
CVSURFPARAMS(self)->nOctaveLayers = NUM2INT(value);
|
179
|
+
return self;
|
180
|
+
}
|
181
|
+
|
182
|
+
VALUE
|
183
|
+
new_object()
|
184
|
+
{
|
185
|
+
return rb_allocate(rb_klass);
|
186
|
+
}
|
187
|
+
|
188
|
+
VALUE
|
189
|
+
new_object(CvSURFParams* cvsurfparams)
|
190
|
+
{
|
191
|
+
VALUE object = rb_allocate(rb_klass);
|
192
|
+
CvSURFParams *ptr = CVSURFPARAMS(object);
|
193
|
+
ptr = cvsurfparams;
|
194
|
+
return object;
|
195
|
+
}
|
196
|
+
|
197
|
+
__NAMESPACE_END_CVSURFPARAMS
|
198
|
+
__NAMESPACE_END_OPENCV
|
199
|
+
|