bonanza-ruby-opencv 0.0.13.20140330211753
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.yardopts +3 -0
- data/DEVELOPERS_NOTE.md +137 -0
- data/Gemfile +9 -0
- data/History.txt +5 -0
- data/License.txt +30 -0
- data/Manifest.txt +239 -0
- data/README.md +98 -0
- data/Rakefile +99 -0
- data/config.yml +7 -0
- data/examples/alpha_blend.rb +21 -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/facerec/create_csv.rb +43 -0
- data/examples/facerec/facerec_eigenfaces.rb +132 -0
- data/examples/facerec/facerec_fisherfaces.rb +131 -0
- data/examples/facerec/facerec_lbph.rb +116 -0
- data/examples/facerec/readme.md +111 -0
- data/examples/find_obj.rb +169 -0
- data/examples/houghcircle.rb +22 -0
- data/examples/images/box.png +0 -0
- data/examples/images/box_in_scene.png +0 -0
- data/examples/images/inpaint.png +0 -0
- data/examples/images/lena-256x256.jpg +0 -0
- data/examples/images/lena-eyes.jpg +0 -0
- data/examples/images/lenna-rotated.jpg +0 -0
- data/examples/images/lenna.jpg +0 -0
- data/examples/images/stuff.jpg +0 -0
- data/examples/images/tiffany.jpg +0 -0
- data/examples/inpaint.rb +57 -0
- data/examples/match_kdtree.rb +88 -0
- data/examples/match_template.rb +26 -0
- data/examples/paint.rb +70 -0
- data/examples/snake.rb +43 -0
- data/ext/opencv/algorithm.cpp +291 -0
- data/ext/opencv/algorithm.h +38 -0
- data/ext/opencv/curve.cpp +127 -0
- data/ext/opencv/curve.h +34 -0
- data/ext/opencv/cvavgcomp.cpp +64 -0
- data/ext/opencv/cvavgcomp.h +39 -0
- data/ext/opencv/cvbox2d.cpp +195 -0
- data/ext/opencv/cvbox2d.h +61 -0
- data/ext/opencv/cvcapture.cpp +607 -0
- data/ext/opencv/cvcapture.h +72 -0
- data/ext/opencv/cvchain.cpp +233 -0
- data/ext/opencv/cvchain.h +46 -0
- data/ext/opencv/cvcircle32f.cpp +126 -0
- data/ext/opencv/cvcircle32f.h +52 -0
- data/ext/opencv/cvconnectedcomp.cpp +156 -0
- data/ext/opencv/cvconnectedcomp.h +49 -0
- data/ext/opencv/cvcontour.cpp +332 -0
- data/ext/opencv/cvcontour.h +48 -0
- data/ext/opencv/cvcontourtree.cpp +96 -0
- data/ext/opencv/cvcontourtree.h +41 -0
- data/ext/opencv/cvconvexitydefect.cpp +92 -0
- data/ext/opencv/cvconvexitydefect.h +42 -0
- data/ext/opencv/cverror.cpp +115 -0
- data/ext/opencv/cverror.h +28 -0
- data/ext/opencv/cvfeaturetree.cpp +123 -0
- data/ext/opencv/cvfeaturetree.h +55 -0
- data/ext/opencv/cvfont.cpp +228 -0
- data/ext/opencv/cvfont.h +64 -0
- data/ext/opencv/cvhaarclassifiercascade.cpp +148 -0
- data/ext/opencv/cvhaarclassifiercascade.h +39 -0
- data/ext/opencv/cvhistogram.cpp +715 -0
- data/ext/opencv/cvhistogram.h +73 -0
- data/ext/opencv/cvhumoments.cpp +178 -0
- data/ext/opencv/cvhumoments.h +51 -0
- data/ext/opencv/cvline.cpp +159 -0
- data/ext/opencv/cvline.h +54 -0
- data/ext/opencv/cvmat.cpp +6829 -0
- data/ext/opencv/cvmat.h +323 -0
- data/ext/opencv/cvmemstorage.cpp +73 -0
- data/ext/opencv/cvmemstorage.h +53 -0
- data/ext/opencv/cvmoments.cpp +293 -0
- data/ext/opencv/cvmoments.h +75 -0
- data/ext/opencv/cvpoint.cpp +265 -0
- data/ext/opencv/cvpoint.h +67 -0
- data/ext/opencv/cvpoint2d32f.cpp +216 -0
- data/ext/opencv/cvpoint2d32f.h +63 -0
- data/ext/opencv/cvpoint3d32f.cpp +252 -0
- data/ext/opencv/cvpoint3d32f.h +66 -0
- data/ext/opencv/cvrect.cpp +441 -0
- data/ext/opencv/cvrect.h +88 -0
- data/ext/opencv/cvscalar.cpp +301 -0
- data/ext/opencv/cvscalar.h +76 -0
- data/ext/opencv/cvseq.cpp +605 -0
- data/ext/opencv/cvseq.h +74 -0
- data/ext/opencv/cvsize.cpp +227 -0
- data/ext/opencv/cvsize.h +65 -0
- data/ext/opencv/cvsize2d32f.cpp +215 -0
- data/ext/opencv/cvsize2d32f.h +64 -0
- data/ext/opencv/cvslice.cpp +126 -0
- data/ext/opencv/cvslice.h +61 -0
- data/ext/opencv/cvsurfparams.cpp +208 -0
- data/ext/opencv/cvsurfparams.h +58 -0
- data/ext/opencv/cvsurfpoint.cpp +279 -0
- data/ext/opencv/cvsurfpoint.h +54 -0
- data/ext/opencv/cvtermcriteria.cpp +198 -0
- data/ext/opencv/cvtermcriteria.h +71 -0
- data/ext/opencv/cvtwopoints.cpp +122 -0
- data/ext/opencv/cvtwopoints.h +51 -0
- data/ext/opencv/cvutils.cpp +221 -0
- data/ext/opencv/cvutils.h +31 -0
- data/ext/opencv/cvvideowriter.cpp +142 -0
- data/ext/opencv/cvvideowriter.h +43 -0
- data/ext/opencv/eigenfaces.cpp +75 -0
- data/ext/opencv/eigenfaces.h +30 -0
- data/ext/opencv/extconf.rb +82 -0
- data/ext/opencv/facerecognizer.cpp +181 -0
- data/ext/opencv/facerecognizer.h +46 -0
- data/ext/opencv/fisherfaces.cpp +75 -0
- data/ext/opencv/fisherfaces.h +30 -0
- data/ext/opencv/gui.cpp +71 -0
- data/ext/opencv/gui.h +30 -0
- data/ext/opencv/iplconvkernel.cpp +198 -0
- data/ext/opencv/iplconvkernel.h +71 -0
- data/ext/opencv/iplimage.cpp +666 -0
- data/ext/opencv/iplimage.h +75 -0
- data/ext/opencv/lbph.cpp +78 -0
- data/ext/opencv/lbph.h +30 -0
- data/ext/opencv/mouseevent.cpp +186 -0
- data/ext/opencv/mouseevent.h +56 -0
- data/ext/opencv/opencv.cpp +833 -0
- data/ext/opencv/opencv.h +405 -0
- data/ext/opencv/pointset.cpp +280 -0
- data/ext/opencv/pointset.h +68 -0
- data/ext/opencv/trackbar.cpp +127 -0
- data/ext/opencv/trackbar.h +69 -0
- data/ext/opencv/window.cpp +377 -0
- data/ext/opencv/window.h +66 -0
- data/images/CvMat_sobel.png +0 -0
- data/images/CvMat_sub_rect.png +0 -0
- data/images/CvSeq_relationmap.png +0 -0
- data/lib/opencv.rb +12 -0
- data/lib/opencv/psyched_yaml.rb +22 -0
- data/lib/opencv/version.rb +4 -0
- data/test/eigenfaces_save.xml +7524 -0
- data/test/fisherfaces_save.xml +7530 -0
- data/test/helper.rb +166 -0
- data/test/lbph_save.xml +4304 -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/chessboard.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 +3003 -0
- data/test/test_cvmat_drawing.rb +349 -0
- data/test/test_cvmat_dxt.rb +150 -0
- data/test/test_cvmat_imageprocessing.rb +2085 -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_eigenfaces.rb +93 -0
- data/test/test_fisherfaces.rb +93 -0
- data/test/test_iplconvkernel.rb +54 -0
- data/test/test_iplimage.rb +232 -0
- data/test/test_lbph.rb +152 -0
- data/test/test_mouseevent.rb +17 -0
- data/test/test_opencv.rb +360 -0
- data/test/test_pointset.rb +128 -0
- data/test/test_preliminary.rb +130 -0
- data/test/test_trackbar.rb +47 -0
- data/test/test_window.rb +115 -0
- data/yard_extension.rb +5 -0
- metadata +399 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvcontour.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVCONTOUR_H
|
11
|
+
#define RUBY_OPENCV_CVCONTOUR_H
|
12
|
+
#include "opencv.h"
|
13
|
+
|
14
|
+
#define __NAMESPACE_BEGIN_CVCONTOUR namespace cCvContour {
|
15
|
+
#define __NAMESPACE_END_CVCONTOUR }
|
16
|
+
|
17
|
+
__NAMESPACE_BEGIN_OPENCV
|
18
|
+
__NAMESPACE_BEGIN_CVCONTOUR
|
19
|
+
|
20
|
+
VALUE rb_class();
|
21
|
+
|
22
|
+
void init_ruby_class();
|
23
|
+
|
24
|
+
VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
|
25
|
+
VALUE rb_rect(VALUE self);
|
26
|
+
VALUE rb_color(VALUE self);
|
27
|
+
VALUE rb_set_color(VALUE self, VALUE color);
|
28
|
+
VALUE rb_reserved(VALUE self);
|
29
|
+
VALUE rb_approx_poly(int argc, VALUE *argv, VALUE self);
|
30
|
+
VALUE rb_bounding_rect(VALUE self);
|
31
|
+
VALUE rb_create_tree(int argc, VALUE *argv, VALUE self);
|
32
|
+
VALUE rb_in_q(VALUE self, VALUE point);
|
33
|
+
VALUE rb_measure_distance(VALUE self, VALUE point);
|
34
|
+
VALUE rb_point_polygon_test(VALUE self, VALUE point, VALUE measure_dist);
|
35
|
+
|
36
|
+
VALUE new_object();
|
37
|
+
__NAMESPACE_END_CVCONTOUR
|
38
|
+
|
39
|
+
inline CvContour*
|
40
|
+
CVCONTOUR(VALUE object){
|
41
|
+
CvContour *ptr;
|
42
|
+
Data_Get_Struct(object, CvContour, ptr);
|
43
|
+
return ptr;
|
44
|
+
}
|
45
|
+
|
46
|
+
__NAMESPACE_END_OPENCV
|
47
|
+
|
48
|
+
#endif // RUBY_OPENCV_CVCONTOUR_H
|
@@ -0,0 +1,96 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvcontourtree.cpp -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cvcontour.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvContourTree
|
13
|
+
*
|
14
|
+
* Contour tree
|
15
|
+
*
|
16
|
+
* @see CvContour#create_tree
|
17
|
+
*/
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVCONTOURTREE
|
20
|
+
|
21
|
+
VALUE rb_klass;
|
22
|
+
|
23
|
+
VALUE
|
24
|
+
rb_class()
|
25
|
+
{
|
26
|
+
return rb_klass;
|
27
|
+
}
|
28
|
+
|
29
|
+
/*
|
30
|
+
* Returns the first point of the binary tree root segment
|
31
|
+
* @overload p1
|
32
|
+
* @return [CvPoint] First point of the binary tree root segment
|
33
|
+
*/
|
34
|
+
VALUE
|
35
|
+
rb_p1(VALUE self)
|
36
|
+
{
|
37
|
+
return REFER_OBJECT(cCvPoint::rb_class(), &CVCONTOURTREE(self)->p1, self);
|
38
|
+
}
|
39
|
+
|
40
|
+
/*
|
41
|
+
* Returns the last point of the binary tree root segment
|
42
|
+
* @overload p2
|
43
|
+
* @return [CvPoint] Last point of the binary tree root segment
|
44
|
+
*/
|
45
|
+
VALUE
|
46
|
+
rb_p2(VALUE self)
|
47
|
+
{
|
48
|
+
return REFER_OBJECT(cCvPoint::rb_class(), &CVCONTOURTREE(self)->p2, self);
|
49
|
+
}
|
50
|
+
|
51
|
+
/*
|
52
|
+
* Restores the contour from its binary tree representation.
|
53
|
+
*
|
54
|
+
* The parameter +criteria+ determines the accuracy and/or the number of tree levels
|
55
|
+
* used for reconstruction, so it is possible to build approximated contour.
|
56
|
+
* @overload contour(criteria = 0)
|
57
|
+
* @param criteria [Integer] Criteria, where to stop reconstruction
|
58
|
+
* @return [CvContour] Contour tree
|
59
|
+
* @opencv_func cvContourFromContourTree
|
60
|
+
*/
|
61
|
+
VALUE
|
62
|
+
rb_contour(VALUE self, VALUE criteria)
|
63
|
+
{
|
64
|
+
VALUE storage = cCvMemStorage::new_object();
|
65
|
+
CvSeq *contour = NULL;
|
66
|
+
try {
|
67
|
+
contour = cvContourFromContourTree(CVCONTOURTREE(self), CVMEMSTORAGE(storage),
|
68
|
+
VALUE_TO_CVTERMCRITERIA(criteria));
|
69
|
+
}
|
70
|
+
catch (cv::Exception& e) {
|
71
|
+
raise_cverror(e);
|
72
|
+
}
|
73
|
+
return cCvSeq::new_sequence(cCvContour::rb_class(), contour, cCvPoint::rb_class(), storage);
|
74
|
+
}
|
75
|
+
|
76
|
+
void
|
77
|
+
init_ruby_class()
|
78
|
+
{
|
79
|
+
#if 0
|
80
|
+
// For documentation using YARD
|
81
|
+
VALUE opencv = rb_define_module("OpenCV");
|
82
|
+
VALUE cvseq = rb_define_class_under(opencv, "CvSeq");
|
83
|
+
#endif
|
84
|
+
if (rb_klass)
|
85
|
+
return;
|
86
|
+
VALUE opencv = rb_module_opencv();
|
87
|
+
VALUE cvseq = cCvSeq::rb_class();
|
88
|
+
|
89
|
+
rb_klass = rb_define_class_under(opencv, "CvContourTree", cvseq);
|
90
|
+
rb_define_method(rb_klass, "p1", RUBY_METHOD_FUNC(rb_p1), 0);
|
91
|
+
rb_define_method(rb_klass, "p2", RUBY_METHOD_FUNC(rb_p2), 0);
|
92
|
+
rb_define_method(rb_klass, "contour", RUBY_METHOD_FUNC(rb_contour), 1);
|
93
|
+
}
|
94
|
+
|
95
|
+
__NAMESPACE_END_CVCONTOURTREE
|
96
|
+
__NAMESPACE_END_OPENCV
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvcontourtree.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVCONTOURTREE_H
|
11
|
+
#define RUBY_OPENCV_CVCONTOURTREE_H
|
12
|
+
#include "opencv.h"
|
13
|
+
|
14
|
+
#define __NAMESPACE_BEGIN_CVCONTOURTREE namespace cCvContourTree {
|
15
|
+
#define __NAMESPACE_END_CVCONTOURTREE }
|
16
|
+
|
17
|
+
__NAMESPACE_BEGIN_OPENCV
|
18
|
+
__NAMESPACE_BEGIN_CVCONTOURTREE
|
19
|
+
|
20
|
+
VALUE rb_class();
|
21
|
+
|
22
|
+
void init_ruby_class();
|
23
|
+
|
24
|
+
VALUE rb_p1(VALUE self);
|
25
|
+
VALUE rb_p2(VALUE self);
|
26
|
+
VALUE rb_contour(VALUE self, VALUE criteria);
|
27
|
+
|
28
|
+
VALUE new_object();
|
29
|
+
|
30
|
+
__NAMESPACE_END_CVCONTOURTREE
|
31
|
+
|
32
|
+
inline CvContourTree*
|
33
|
+
CVCONTOURTREE(VALUE object){
|
34
|
+
CvContourTree *ptr;
|
35
|
+
Data_Get_Struct(object, CvContourTree, ptr);
|
36
|
+
return ptr;
|
37
|
+
}
|
38
|
+
|
39
|
+
__NAMESPACE_END_OPENCV
|
40
|
+
|
41
|
+
#endif // RUBY_OPENCV_CVCONTOUR_H
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvconvexitydefect.cpp -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cvconvexitydefect.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvConvexityDefect
|
13
|
+
*
|
14
|
+
* Convexity defect
|
15
|
+
*/
|
16
|
+
__NAMESPACE_BEGIN_OPENCV
|
17
|
+
__NAMESPACE_BEGIN_CVCONVEXITYDEFECT
|
18
|
+
|
19
|
+
VALUE rb_klass;
|
20
|
+
|
21
|
+
VALUE
|
22
|
+
rb_class()
|
23
|
+
{
|
24
|
+
return rb_klass;
|
25
|
+
}
|
26
|
+
|
27
|
+
/*
|
28
|
+
* Returns the point of the contour where the defect begins
|
29
|
+
* @overload start
|
30
|
+
* @return [CvPoint] Start point of the contour
|
31
|
+
*/
|
32
|
+
VALUE
|
33
|
+
rb_start(VALUE self)
|
34
|
+
{
|
35
|
+
return cCvPoint::new_object(*CVCONVEXITYDEFECT(self)->start);
|
36
|
+
}
|
37
|
+
|
38
|
+
/*
|
39
|
+
* Returns the point of the contour where the defect ends
|
40
|
+
* @overload end
|
41
|
+
* @return [CvPoint] End point of the contour
|
42
|
+
*/
|
43
|
+
VALUE
|
44
|
+
rb_end(VALUE self)
|
45
|
+
{
|
46
|
+
return cCvPoint::new_object(*CVCONVEXITYDEFECT(self)->end);
|
47
|
+
}
|
48
|
+
|
49
|
+
/*
|
50
|
+
* Returns the farthest from the convex hull point within the defect
|
51
|
+
* @overload depth_point
|
52
|
+
* @return [CvPoint] The farthest from the convex hull point within the defect
|
53
|
+
*/
|
54
|
+
VALUE
|
55
|
+
rb_depth_point(VALUE self)
|
56
|
+
{
|
57
|
+
return cCvPoint::new_object(*CVCONVEXITYDEFECT(self)->depth_point);
|
58
|
+
}
|
59
|
+
|
60
|
+
/*
|
61
|
+
* Returns distance between the farthest point and the convex hull
|
62
|
+
* @overload depth
|
63
|
+
* @return [Number] Distance between the farthest point and the convex hull
|
64
|
+
*/
|
65
|
+
VALUE
|
66
|
+
rb_depth(VALUE self)
|
67
|
+
{
|
68
|
+
return rb_float_new(CVCONVEXITYDEFECT(self)->depth);
|
69
|
+
}
|
70
|
+
|
71
|
+
void
|
72
|
+
init_ruby_class()
|
73
|
+
{
|
74
|
+
#if 0
|
75
|
+
// For documentation using YARD
|
76
|
+
VALUE opencv = rb_define_module("OpenCV");
|
77
|
+
#endif
|
78
|
+
|
79
|
+
if (rb_klass)
|
80
|
+
return;
|
81
|
+
|
82
|
+
VALUE opencv = rb_module_opencv();
|
83
|
+
|
84
|
+
rb_klass = rb_define_class_under(opencv, "CvConvexityDefect", rb_cObject);
|
85
|
+
rb_define_method(rb_klass, "start", RUBY_METHOD_FUNC(rb_start), 0);
|
86
|
+
rb_define_method(rb_klass, "end", RUBY_METHOD_FUNC(rb_end), 0);
|
87
|
+
rb_define_method(rb_klass, "depth_point", RUBY_METHOD_FUNC(rb_depth_point), 0);
|
88
|
+
rb_define_method(rb_klass, "depth", RUBY_METHOD_FUNC(rb_depth), 0);
|
89
|
+
}
|
90
|
+
|
91
|
+
__NAMESPACE_END_CVCONVEXITYDEFECT
|
92
|
+
__NAMESPACE_END_OPENCV
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cvconvexitydefect.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2007 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVCONVEXITYDEFECT_H
|
11
|
+
#define RUBY_OPENCV_CVCONVEXITYDEFECT_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVCONVEXITYDEFECT namespace cCvConvexityDefect {
|
16
|
+
#define __NAMESPACE_END_CVCONVEXITYDEFECT }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVCONVEXITYDEFECT
|
20
|
+
|
21
|
+
VALUE rb_class();
|
22
|
+
|
23
|
+
void init_ruby_class();
|
24
|
+
|
25
|
+
VALUE rb_start(VALUE self);
|
26
|
+
VALUE rb_end(VALUE self);
|
27
|
+
VALUE rb_depth_point(VALUE self);
|
28
|
+
VALUE rb_depth(VALUE self);
|
29
|
+
|
30
|
+
__NAMESPACE_END_CVCONVEXITYDEFECT
|
31
|
+
|
32
|
+
inline CvConvexityDefect*
|
33
|
+
CVCONVEXITYDEFECT(VALUE object)
|
34
|
+
{
|
35
|
+
CvConvexityDefect *ptr;
|
36
|
+
Data_Get_Struct(object, CvConvexityDefect, ptr);
|
37
|
+
return ptr;
|
38
|
+
}
|
39
|
+
|
40
|
+
__NAMESPACE_END_OPENCV
|
41
|
+
|
42
|
+
#endif // RUBY_OPENCV_CVCONVEXITYDEFECT_H
|
@@ -0,0 +1,115 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cverror.cpp -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#include "cverror.h"
|
11
|
+
/*
|
12
|
+
* Document-class: OpenCV::CvError
|
13
|
+
*
|
14
|
+
* OpenCV errors
|
15
|
+
*/
|
16
|
+
|
17
|
+
__NAMESPACE_BEGIN_OPENCV
|
18
|
+
__NAMESPACE_BEGIN_CVERROR
|
19
|
+
|
20
|
+
st_table *cv_error = st_init_numtable();
|
21
|
+
|
22
|
+
VALUE rb_klass;
|
23
|
+
|
24
|
+
void
|
25
|
+
REGISTER_CVERROR(const char* object_name, int error_code)
|
26
|
+
{
|
27
|
+
st_insert(cv_error, (st_data_t)error_code,
|
28
|
+
(st_data_t)rb_define_class_under(rb_module_opencv(), object_name, rb_klass));
|
29
|
+
}
|
30
|
+
|
31
|
+
VALUE
|
32
|
+
rb_class()
|
33
|
+
{
|
34
|
+
return rb_klass;
|
35
|
+
}
|
36
|
+
|
37
|
+
VALUE
|
38
|
+
by_code(int error_code)
|
39
|
+
{
|
40
|
+
VALUE klass = 0;
|
41
|
+
st_lookup(cv_error, (st_data_t)error_code, (st_data_t*)&klass);
|
42
|
+
return klass ? klass : rb_eStandardError;
|
43
|
+
}
|
44
|
+
|
45
|
+
void
|
46
|
+
raise(cv::Exception e)
|
47
|
+
{
|
48
|
+
rb_raise(by_code(e.code), "%s", e.what());
|
49
|
+
}
|
50
|
+
|
51
|
+
void
|
52
|
+
init_ruby_class()
|
53
|
+
{
|
54
|
+
#if 0
|
55
|
+
// For documentation using YARD
|
56
|
+
VALUE opencv = rb_define_module("OpenCV");
|
57
|
+
#endif
|
58
|
+
|
59
|
+
if (rb_klass)
|
60
|
+
return;
|
61
|
+
|
62
|
+
VALUE opencv = rb_module_opencv();
|
63
|
+
rb_klass = rb_define_class_under(opencv, "CvError", rb_eStandardError);
|
64
|
+
REGISTER_CVERROR("CvStsBackTrace", CV_StsBackTrace);
|
65
|
+
REGISTER_CVERROR("CvStsError", CV_StsError);
|
66
|
+
REGISTER_CVERROR("CvStsInternal", CV_StsInternal);
|
67
|
+
REGISTER_CVERROR("CvStsNoMem", CV_StsNoMem);
|
68
|
+
REGISTER_CVERROR("CvStsBadArg", CV_StsBadArg);
|
69
|
+
REGISTER_CVERROR("CvStsBadFunc", CV_StsBadFunc);
|
70
|
+
REGISTER_CVERROR("CvStsNoConv", CV_StsNoConv);
|
71
|
+
REGISTER_CVERROR("CvStsAutoTrace", CV_StsAutoTrace);
|
72
|
+
REGISTER_CVERROR("CvHeaderIsNull", CV_HeaderIsNull);
|
73
|
+
REGISTER_CVERROR("CvBadImageSize", CV_BadImageSize);
|
74
|
+
REGISTER_CVERROR("CvBadOffset", CV_BadOffset);
|
75
|
+
REGISTER_CVERROR("CvBadDataPtr", CV_BadDataPtr);
|
76
|
+
REGISTER_CVERROR("CvBadStep", CV_BadStep);
|
77
|
+
REGISTER_CVERROR("CvBadModelOrChSeq", CV_BadModelOrChSeq);
|
78
|
+
REGISTER_CVERROR("CvBadNumChannels", CV_BadNumChannels);
|
79
|
+
REGISTER_CVERROR("CvBadNumChannel1U", CV_BadNumChannel1U);
|
80
|
+
REGISTER_CVERROR("CvBadDepth", CV_BadDepth);
|
81
|
+
REGISTER_CVERROR("CvBadAlphaChannel", CV_BadAlphaChannel);
|
82
|
+
REGISTER_CVERROR("CvBadOrder", CV_BadOrder);
|
83
|
+
REGISTER_CVERROR("CvBadOrigin", CV_BadOrigin);
|
84
|
+
REGISTER_CVERROR("CvBadAlign", CV_BadAlign);
|
85
|
+
REGISTER_CVERROR("CvBadCallBack", CV_BadCallBack);
|
86
|
+
REGISTER_CVERROR("CvBadTileSize", CV_BadTileSize);
|
87
|
+
REGISTER_CVERROR("CvBadCOI", CV_BadCOI);
|
88
|
+
REGISTER_CVERROR("CvBadROISize", CV_BadROISize);
|
89
|
+
REGISTER_CVERROR("CvMaskIsTiled", CV_MaskIsTiled);
|
90
|
+
REGISTER_CVERROR("CvStsNullPtr", CV_StsNullPtr);
|
91
|
+
REGISTER_CVERROR("CvStsVecLengthErr", CV_StsVecLengthErr);
|
92
|
+
REGISTER_CVERROR("CvStsFilterStructContentErr", CV_StsFilterStructContentErr);
|
93
|
+
REGISTER_CVERROR("CvStsKernelStructContentErr", CV_StsKernelStructContentErr);
|
94
|
+
REGISTER_CVERROR("CvStsFilterOffsetErr", CV_StsFilterOffsetErr);
|
95
|
+
REGISTER_CVERROR("CvStsBadSize", CV_StsBadSize);
|
96
|
+
REGISTER_CVERROR("CvStsDivByZero", CV_StsDivByZero);
|
97
|
+
REGISTER_CVERROR("CvStsInplaceNotSupported", CV_StsInplaceNotSupported);
|
98
|
+
REGISTER_CVERROR("CvStsObjectNotFound", CV_StsObjectNotFound);
|
99
|
+
REGISTER_CVERROR("CvStsUnmatchedFormats", CV_StsUnmatchedFormats);
|
100
|
+
REGISTER_CVERROR("CvStsBadFlag", CV_StsBadFlag);
|
101
|
+
REGISTER_CVERROR("CvStsBadPoint", CV_StsBadPoint);
|
102
|
+
REGISTER_CVERROR("CvStsBadMask", CV_StsBadMask);
|
103
|
+
REGISTER_CVERROR("CvStsUnmatchedSizes", CV_StsUnmatchedSizes);
|
104
|
+
REGISTER_CVERROR("CvStsUnsupportedFormat", CV_StsUnsupportedFormat);
|
105
|
+
REGISTER_CVERROR("CvStsOutOfRange", CV_StsOutOfRange);
|
106
|
+
REGISTER_CVERROR("CvStsParseError", CV_StsParseError);
|
107
|
+
REGISTER_CVERROR("CvStsNotImplemented", CV_StsNotImplemented);
|
108
|
+
REGISTER_CVERROR("CvStsBadMemBlock", CV_StsBadMemBlock);
|
109
|
+
REGISTER_CVERROR("CvStsAssert", CV_StsAssert);
|
110
|
+
REGISTER_CVERROR("CvGpuNotSupported", CV_GpuNotSupported);
|
111
|
+
REGISTER_CVERROR("CvGpuApiCallError", CV_GpuApiCallError);
|
112
|
+
}
|
113
|
+
|
114
|
+
__NAMESPACE_END_CVERROR
|
115
|
+
__NAMESPACE_END_OPENCV
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/************************************************************
|
2
|
+
|
3
|
+
cverror.h -
|
4
|
+
|
5
|
+
$Author: lsxi $
|
6
|
+
|
7
|
+
Copyright (C) 2005-2006 Masakazu Yonekura
|
8
|
+
|
9
|
+
************************************************************/
|
10
|
+
#ifndef RUBY_OPENCV_CVERROR_H
|
11
|
+
#define RUBY_OPENCV_CVERROR_H
|
12
|
+
|
13
|
+
#include "opencv.h"
|
14
|
+
|
15
|
+
#define __NAMESPACE_BEGIN_CVERROR namespace cCvError {
|
16
|
+
#define __NAMESPACE_END_CVERROR }
|
17
|
+
|
18
|
+
__NAMESPACE_BEGIN_OPENCV
|
19
|
+
__NAMESPACE_BEGIN_CVERROR
|
20
|
+
|
21
|
+
void init_ruby_class();
|
22
|
+
VALUE by_code(int error_code);
|
23
|
+
void raise(cv::Exception e);
|
24
|
+
|
25
|
+
__NAMESPACE_END_CVERROR
|
26
|
+
__NAMESPACE_END_OPENCV
|
27
|
+
|
28
|
+
#endif // RUBY_OPENCV_CVERROR_H
|