ruby-opencv 0.0.9-x86-mswin32 → 0.0.10.pre-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/History.txt +5 -5
- data/README.md +1 -1
- data/examples/contours/contour_retrieval_modes.rb +139 -139
- data/examples/face_detect.rb +20 -20
- data/examples/houghcircle.rb +22 -22
- data/examples/paint.rb +70 -70
- data/examples/snake.rb +43 -43
- data/ext/opencv/cvcondensation.cpp +282 -282
- data/ext/opencv/cvcondensation.h +49 -49
- data/ext/opencv/cvmat.cpp +6 -6
- data/ext/opencv/cvmatnd.cpp +44 -44
- data/ext/opencv/cvmatnd.h +28 -28
- data/ext/opencv/cvmemstorage.cpp +68 -68
- data/ext/opencv/cvmemstorage.h +53 -53
- data/ext/opencv/cvmoments.h +75 -75
- data/ext/opencv/cvpoint.h +64 -64
- data/ext/opencv/cvpoint2d32f.h +63 -63
- data/ext/opencv/cvpoint3d32f.h +66 -66
- data/ext/opencv/cvrect.h +79 -79
- data/ext/opencv/cvscalar.h +71 -71
- data/ext/opencv/cvsize.h +65 -65
- data/ext/opencv/cvsize2d32f.h +64 -64
- data/ext/opencv/cvslice.h +61 -61
- data/ext/opencv/cvsparsemat.cpp +44 -44
- data/ext/opencv/cvsparsemat.h +28 -28
- data/ext/opencv/cvsurfparams.h +58 -58
- data/ext/opencv/cvsurfpoint.h +52 -52
- data/ext/opencv/cvtermcriteria.h +71 -71
- data/ext/opencv/cvtwopoints.cpp +116 -116
- data/ext/opencv/cvtwopoints.h +51 -51
- data/ext/opencv/cvvideowriter.h +43 -43
- data/ext/opencv/gui.cpp +68 -68
- data/ext/opencv/gui.h +30 -30
- data/ext/opencv/iplconvkernel.h +71 -71
- data/ext/opencv/mouseevent.cpp +181 -181
- data/ext/opencv/mouseevent.h +56 -56
- data/ext/opencv/opencv.cpp +5 -0
- data/ext/opencv/trackbar.h +69 -69
- data/ext/opencv/window.h +66 -66
- data/lib/opencv/version.rb +1 -1
- data/ruby-opencv.gemspec +7 -7
- data/test/test_cvmat_imageprocessing.rb +15 -25
- data/test/test_opencv.rb +7 -2
- metadata +7 -7
data/ext/opencv/cvcondensation.h
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
/************************************************************
|
2
|
-
|
3
|
-
cvcondensation.h -
|
4
|
-
|
5
|
-
$Author: lsxi $
|
6
|
-
|
7
|
-
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
-
|
9
|
-
************************************************************/
|
10
|
-
#ifndef RUBY_OPENCV_CVCONDENSATION_H
|
11
|
-
#define RUBY_OPENCV_CVCONDENSATION_H
|
12
|
-
|
13
|
-
#include "opencv.h"
|
14
|
-
|
15
|
-
#define __NAMESPACE_BEGIN_CVCONDENSATION namespace cCvConDensation {
|
16
|
-
#define __NAMESPACE_END_CVCONDENSATION }
|
17
|
-
|
18
|
-
__NAMESPACE_BEGIN_OPENCV
|
19
|
-
__NAMESPACE_BEGIN_CVCONDENSATION
|
20
|
-
|
21
|
-
VALUE rb_class();
|
22
|
-
void define_ruby_class();
|
23
|
-
|
24
|
-
VALUE rb_dp(VALUE self);
|
25
|
-
VALUE rb_mp(VALUE self);
|
26
|
-
VALUE rb_dynamic_matrix(VALUE self);
|
27
|
-
VALUE rb_state(VALUE self);
|
28
|
-
VALUE rb_confidence(VALUE self);
|
29
|
-
VALUE rb_cumulative(VALUE self);
|
30
|
-
VALUE rb_samples_num(VALUE self);
|
31
|
-
|
32
|
-
VALUE rb_init_sample_set(VALUE self, VALUE lower, VALUE upper);
|
33
|
-
VALUE rb_update_by_time(VALUE self);
|
34
|
-
VALUE rb_each_sample(VALUE self);
|
35
|
-
VALUE rb_calculate_confidence(VALUE self);
|
36
|
-
|
37
|
-
__NAMESPACE_END_CVCONDENSATION
|
38
|
-
|
39
|
-
inline CvConDensation*
|
40
|
-
CVCONDENSATION(VALUE object)
|
41
|
-
{
|
42
|
-
CvConDensation *ptr;
|
43
|
-
Data_Get_Struct(object, CvConDensation, ptr);
|
44
|
-
return ptr;
|
45
|
-
}
|
46
|
-
|
47
|
-
__NAMESPACE_END_OPENCV
|
48
|
-
|
49
|
-
#endif // RUBY_OPENCV_CVCONDENSATION_H
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvcondensation.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVCONDENSATION_H
|
11
|
+
#define RUBY_OPENCV_CVCONDENSATION_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVCONDENSATION namespace cCvConDensation {
|
16
|
+
#define __NAMESPACE_END_CVCONDENSATION }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVCONDENSATION
|
20
|
+
|
21
|
+
VALUE rb_class();
|
22
|
+
void define_ruby_class();
|
23
|
+
|
24
|
+
VALUE rb_dp(VALUE self);
|
25
|
+
VALUE rb_mp(VALUE self);
|
26
|
+
VALUE rb_dynamic_matrix(VALUE self);
|
27
|
+
VALUE rb_state(VALUE self);
|
28
|
+
VALUE rb_confidence(VALUE self);
|
29
|
+
VALUE rb_cumulative(VALUE self);
|
30
|
+
VALUE rb_samples_num(VALUE self);
|
31
|
+
|
32
|
+
VALUE rb_init_sample_set(VALUE self, VALUE lower, VALUE upper);
|
33
|
+
VALUE rb_update_by_time(VALUE self);
|
34
|
+
VALUE rb_each_sample(VALUE self);
|
35
|
+
VALUE rb_calculate_confidence(VALUE self);
|
36
|
+
|
37
|
+
__NAMESPACE_END_CVCONDENSATION
|
38
|
+
|
39
|
+
inline CvConDensation*
|
40
|
+
CVCONDENSATION(VALUE object)
|
41
|
+
{
|
42
|
+
CvConDensation *ptr;
|
43
|
+
Data_Get_Struct(object, CvConDensation, ptr);
|
44
|
+
return ptr;
|
45
|
+
}
|
46
|
+
|
47
|
+
__NAMESPACE_END_OPENCV
|
48
|
+
|
49
|
+
#endif // RUBY_OPENCV_CVCONDENSATION_H
|
data/ext/opencv/cvmat.cpp
CHANGED
@@ -3945,9 +3945,9 @@ rb_resize(int argc, VALUE *argv, VALUE self)
|
|
3945
3945
|
VALUE
|
3946
3946
|
rb_warp_affine(int argc, VALUE *argv, VALUE self)
|
3947
3947
|
{
|
3948
|
-
VALUE map_matrix, flags_val,
|
3948
|
+
VALUE map_matrix, flags_val, fill_value;
|
3949
3949
|
VALUE dest = Qnil;
|
3950
|
-
if (rb_scan_args(argc, argv, "
|
3950
|
+
if (rb_scan_args(argc, argv, "12", &map_matrix, &flags_val, &fill_value) < 3)
|
3951
3951
|
fill_value = INT2FIX(0);
|
3952
3952
|
CvArr* self_ptr = CVARR(self);
|
3953
3953
|
int flags = NIL_P(flags_val) ? (CV_INTER_LINEAR | CV_WARP_FILL_OUTLIERS) : NUM2INT(flags_val);
|
@@ -4755,7 +4755,7 @@ rb_flood_fill_bang(int argc, VALUE *argv, VALUE self)
|
|
4755
4755
|
try {
|
4756
4756
|
CvSize size = cvGetSize(self_ptr);
|
4757
4757
|
// TODO: Change argument format to set mask
|
4758
|
-
mask = new_object(size.
|
4758
|
+
mask = new_object(size.height + 2, size.width + 2, CV_MAKETYPE(CV_8U, 1));
|
4759
4759
|
CvMat* mask_ptr = CVMAT(mask);
|
4760
4760
|
cvSetZero(mask_ptr);
|
4761
4761
|
cvFloodFill(self_ptr,
|
@@ -5261,11 +5261,11 @@ rb_match_template(int argc, VALUE *argv, VALUE self)
|
|
5261
5261
|
* Compares two shapes(self and object). <i>object</i> should be CvMat or CvContour.
|
5262
5262
|
*
|
5263
5263
|
* A - object1, B - object2:
|
5264
|
-
* * method=
|
5264
|
+
* * method=CV_CONTOURS_MATCH_I1
|
5265
5265
|
* I1(A,B)=sumi=1..7abs(1/mAi - 1/mBi)
|
5266
|
-
* * method=
|
5266
|
+
* * method=CV_CONTOURS_MATCH_I2
|
5267
5267
|
* I2(A,B)=sumi=1..7abs(mAi - mBi)
|
5268
|
-
* * method=
|
5268
|
+
* * method=CV_CONTOURS_MATCH_I3
|
5269
5269
|
* I3(A,B)=sumi=1..7abs(mAi - mBi)/abs(mAi)
|
5270
5270
|
*/
|
5271
5271
|
VALUE
|
data/ext/opencv/cvmatnd.cpp
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
/***********************************************************
|
2
|
-
|
3
|
-
cvmatnd.cpp -
|
4
|
-
|
5
|
-
$Author: lsxi $
|
6
|
-
|
7
|
-
Copyright (C) 2007 Masakazu Yonekura
|
8
|
-
|
9
|
-
************************************************************/
|
10
|
-
#include "cvmatnd.h"
|
11
|
-
/*
|
12
|
-
* Document-class: OpenCV::CvMatND
|
13
|
-
*
|
14
|
-
*/
|
15
|
-
__NAMESPACE_BEGIN_OPENCV
|
16
|
-
__NAMESPACE_BEGIN_CVMATND
|
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, "CvMatND", cvmat);
|
40
|
-
}
|
41
|
-
|
42
|
-
__NAMESPACE_END_CVMATND
|
43
|
-
__NAMESPACE_END_OPENCV
|
44
|
-
|
1
|
+
/***********************************************************
|
2
|
+
|
3
|
+
cvmatnd.cpp -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cvmatnd.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvMatND
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
__NAMESPACE_BEGIN_OPENCV
|
16
|
+
__NAMESPACE_BEGIN_CVMATND
|
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, "CvMatND", cvmat);
|
40
|
+
}
|
41
|
+
|
42
|
+
__NAMESPACE_END_CVMATND
|
43
|
+
__NAMESPACE_END_OPENCV
|
44
|
+
|
data/ext/opencv/cvmatnd.h
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
/************************************************************
|
2
|
-
|
3
|
-
cvmatnd.h -
|
4
|
-
|
5
|
-
$Author: lsxi $
|
6
|
-
|
7
|
-
Copyright (C) 2007 Masakazu Yonekura
|
8
|
-
|
9
|
-
************************************************************/
|
10
|
-
#ifndef RUBY_OPENCV_CVMATND_H
|
11
|
-
#define RUBY_OPENCV_CVMATND_H
|
12
|
-
|
13
|
-
#include "opencv.h"
|
14
|
-
|
15
|
-
#define __NAMESPACE_BEGIN_CVMATND namespace cCvMatND {
|
16
|
-
#define __NAMESPACE_END_CVMATND }
|
17
|
-
|
18
|
-
__NAMESPACE_BEGIN_OPENCV
|
19
|
-
__NAMESPACE_BEGIN_CVMATND
|
20
|
-
|
21
|
-
VALUE rb_class();
|
22
|
-
|
23
|
-
void define_ruby_class();
|
24
|
-
|
25
|
-
__NAMESPACE_END_CVMATND
|
26
|
-
__NAMESPACE_END_OPENCV
|
27
|
-
|
28
|
-
#endif // RUBY_OPENCV_CVMATND_H
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvmatnd.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVMATND_H
|
11
|
+
#define RUBY_OPENCV_CVMATND_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVMATND namespace cCvMatND {
|
16
|
+
#define __NAMESPACE_END_CVMATND }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVMATND
|
20
|
+
|
21
|
+
VALUE rb_class();
|
22
|
+
|
23
|
+
void define_ruby_class();
|
24
|
+
|
25
|
+
__NAMESPACE_END_CVMATND
|
26
|
+
__NAMESPACE_END_OPENCV
|
27
|
+
|
28
|
+
#endif // RUBY_OPENCV_CVMATND_H
|
data/ext/opencv/cvmemstorage.cpp
CHANGED
@@ -1,68 +1,68 @@
|
|
1
|
-
/************************************************************
|
2
|
-
|
3
|
-
cvmemstorage.cpp -
|
4
|
-
|
5
|
-
$Author: lsxi $
|
6
|
-
|
7
|
-
Copyright (C) 2005 Masakazu Yonekura
|
8
|
-
|
9
|
-
************************************************************/
|
10
|
-
#include "cvmemstorage.h"
|
11
|
-
/*
|
12
|
-
* Document-class: OpenCV::CvMemStorage
|
13
|
-
*
|
14
|
-
* Internal memory management class used by CvSeq.
|
15
|
-
*/
|
16
|
-
__NAMESPACE_BEGIN_OPENCV
|
17
|
-
__NAMESPACE_BEGIN_CVMEMSTORAGE
|
18
|
-
|
19
|
-
VALUE rb_klass;
|
20
|
-
|
21
|
-
VALUE
|
22
|
-
rb_class()
|
23
|
-
{
|
24
|
-
return rb_klass;
|
25
|
-
}
|
26
|
-
|
27
|
-
void
|
28
|
-
define_ruby_class()
|
29
|
-
{
|
30
|
-
if (rb_klass)
|
31
|
-
return;
|
32
|
-
/*
|
33
|
-
* opencv = rb_define_module("OpenCV");
|
34
|
-
*
|
35
|
-
* note: this comment is used by rdoc.
|
36
|
-
*/
|
37
|
-
VALUE opencv = rb_module_opencv();
|
38
|
-
rb_klass = rb_define_class_under(opencv, "CvMemStorage", rb_cObject);
|
39
|
-
}
|
40
|
-
|
41
|
-
VALUE
|
42
|
-
rb_allocate(VALUE klass)
|
43
|
-
{
|
44
|
-
CvMemStorage *storage = rb_cvCreateMemStorage(0);
|
45
|
-
return Data_Wrap_Struct(klass, 0, cvmemstorage_free, storage);
|
46
|
-
}
|
47
|
-
|
48
|
-
void
|
49
|
-
cvmemstorage_free(void *ptr)
|
50
|
-
{
|
51
|
-
try {
|
52
|
-
cvReleaseMemStorage((CvMemStorage**)&ptr);
|
53
|
-
}
|
54
|
-
catch (cv::Exception& e) {
|
55
|
-
raise_cverror(e);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
VALUE
|
60
|
-
new_object(int blocksize)
|
61
|
-
{
|
62
|
-
CvMemStorage *storage = rb_cvCreateMemStorage(blocksize);
|
63
|
-
return Data_Wrap_Struct(rb_klass, 0, cvmemstorage_free, storage);
|
64
|
-
}
|
65
|
-
|
66
|
-
|
67
|
-
__NAMESPACE_END_CVMEMSTORAGE
|
68
|
-
__NAMESPACE_END_OPENCV
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvmemstorage.cpp -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cvmemstorage.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvMemStorage
|
13
|
+
*
|
14
|
+
* Internal memory management class used by CvSeq.
|
15
|
+
*/
|
16
|
+
__NAMESPACE_BEGIN_OPENCV
|
17
|
+
__NAMESPACE_BEGIN_CVMEMSTORAGE
|
18
|
+
|
19
|
+
VALUE rb_klass;
|
20
|
+
|
21
|
+
VALUE
|
22
|
+
rb_class()
|
23
|
+
{
|
24
|
+
return rb_klass;
|
25
|
+
}
|
26
|
+
|
27
|
+
void
|
28
|
+
define_ruby_class()
|
29
|
+
{
|
30
|
+
if (rb_klass)
|
31
|
+
return;
|
32
|
+
/*
|
33
|
+
* opencv = rb_define_module("OpenCV");
|
34
|
+
*
|
35
|
+
* note: this comment is used by rdoc.
|
36
|
+
*/
|
37
|
+
VALUE opencv = rb_module_opencv();
|
38
|
+
rb_klass = rb_define_class_under(opencv, "CvMemStorage", rb_cObject);
|
39
|
+
}
|
40
|
+
|
41
|
+
VALUE
|
42
|
+
rb_allocate(VALUE klass)
|
43
|
+
{
|
44
|
+
CvMemStorage *storage = rb_cvCreateMemStorage(0);
|
45
|
+
return Data_Wrap_Struct(klass, 0, cvmemstorage_free, storage);
|
46
|
+
}
|
47
|
+
|
48
|
+
void
|
49
|
+
cvmemstorage_free(void *ptr)
|
50
|
+
{
|
51
|
+
try {
|
52
|
+
cvReleaseMemStorage((CvMemStorage**)&ptr);
|
53
|
+
}
|
54
|
+
catch (cv::Exception& e) {
|
55
|
+
raise_cverror(e);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
VALUE
|
60
|
+
new_object(int blocksize)
|
61
|
+
{
|
62
|
+
CvMemStorage *storage = rb_cvCreateMemStorage(blocksize);
|
63
|
+
return Data_Wrap_Struct(rb_klass, 0, cvmemstorage_free, storage);
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
__NAMESPACE_END_CVMEMSTORAGE
|
68
|
+
__NAMESPACE_END_OPENCV
|
data/ext/opencv/cvmemstorage.h
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
/************************************************************
|
2
|
-
|
3
|
-
cvmemstorage.h -
|
4
|
-
|
5
|
-
$Author: lsxi $
|
6
|
-
|
7
|
-
Copyright (C) 2005 Masakazu Yonekura
|
8
|
-
|
9
|
-
************************************************************/
|
10
|
-
#ifndef RUBY_OPENCV_CVMEMSTORAGE_H
|
11
|
-
#define RUBY_OPENCV_CVMEMSTORAGE_H
|
12
|
-
|
13
|
-
#include "opencv.h"
|
14
|
-
|
15
|
-
#define __NAMESPACE_BEGIN_CVMEMSTORAGE namespace cCvMemStorage {
|
16
|
-
#define __NAMESPACE_END_CVMEMSTORAGE }
|
17
|
-
|
18
|
-
__NAMESPACE_BEGIN_OPENCV
|
19
|
-
__NAMESPACE_BEGIN_CVMEMSTORAGE
|
20
|
-
|
21
|
-
void define_ruby_class();
|
22
|
-
|
23
|
-
VALUE rb_class();
|
24
|
-
VALUE rb_allocate(VALUE klass);
|
25
|
-
void cvmemstorage_free(void *ptr);
|
26
|
-
|
27
|
-
VALUE new_object(int blocksize = 0);
|
28
|
-
|
29
|
-
__NAMESPACE_END_CVMEMSTORAGE
|
30
|
-
|
31
|
-
inline CvMemStorage*
|
32
|
-
CVMEMSTORAGE(VALUE object)
|
33
|
-
{
|
34
|
-
CvMemStorage *ptr;
|
35
|
-
Data_Get_Struct(object, CvMemStorage, ptr);
|
36
|
-
return ptr;
|
37
|
-
}
|
38
|
-
|
39
|
-
inline VALUE
|
40
|
-
CHECK_CVMEMSTORAGE(VALUE object)
|
41
|
-
{
|
42
|
-
if (rb_obj_is_kind_of(object, cCvMemStorage::rb_class()))
|
43
|
-
return object;
|
44
|
-
else {
|
45
|
-
if (!NIL_P(object))
|
46
|
-
rb_warn("invalid CvMemStorage object given. allocate new memory storage automatically.");
|
47
|
-
return cCvMemStorage::new_object();
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
__NAMESPACE_END_OPENCV
|
52
|
-
|
53
|
-
#endif // RUBY_OPENCV_CVMEMSTORAGE_H
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvmemstorage.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVMEMSTORAGE_H
|
11
|
+
#define RUBY_OPENCV_CVMEMSTORAGE_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVMEMSTORAGE namespace cCvMemStorage {
|
16
|
+
#define __NAMESPACE_END_CVMEMSTORAGE }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVMEMSTORAGE
|
20
|
+
|
21
|
+
void define_ruby_class();
|
22
|
+
|
23
|
+
VALUE rb_class();
|
24
|
+
VALUE rb_allocate(VALUE klass);
|
25
|
+
void cvmemstorage_free(void *ptr);
|
26
|
+
|
27
|
+
VALUE new_object(int blocksize = 0);
|
28
|
+
|
29
|
+
__NAMESPACE_END_CVMEMSTORAGE
|
30
|
+
|
31
|
+
inline CvMemStorage*
|
32
|
+
CVMEMSTORAGE(VALUE object)
|
33
|
+
{
|
34
|
+
CvMemStorage *ptr;
|
35
|
+
Data_Get_Struct(object, CvMemStorage, ptr);
|
36
|
+
return ptr;
|
37
|
+
}
|
38
|
+
|
39
|
+
inline VALUE
|
40
|
+
CHECK_CVMEMSTORAGE(VALUE object)
|
41
|
+
{
|
42
|
+
if (rb_obj_is_kind_of(object, cCvMemStorage::rb_class()))
|
43
|
+
return object;
|
44
|
+
else {
|
45
|
+
if (!NIL_P(object))
|
46
|
+
rb_warn("invalid CvMemStorage object given. allocate new memory storage automatically.");
|
47
|
+
return cCvMemStorage::new_object();
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
__NAMESPACE_END_OPENCV
|
52
|
+
|
53
|
+
#endif // RUBY_OPENCV_CVMEMSTORAGE_H
|