1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

update for generating documents

This commit is contained in:
ser1zw 2014-01-14 18:15:44 +09:00
parent c88feb2c8e
commit 26086ab9b4
65 changed files with 198 additions and 178 deletions

View file

@ -252,8 +252,13 @@ rb_name(VALUE self)
} }
void void
define_ruby_class() init_ruby_class()
{ {
#if 0
// For documentation using YARD
VALUE opencv = rb_define_module("OpenCV");
#endif
if (rb_klass) if (rb_klass)
return; return;
/* /*

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_ALGORITHM
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
__NAMESPACE_END_ALGORITM __NAMESPACE_END_ALGORITM

View file

@ -24,7 +24,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -19,7 +19,7 @@ __NAMESPACE_BEGIN_OPENCV
__NAMESPACE_BEGIN_CVCONDENSATION __NAMESPACE_BEGIN_CVCONDENSATION
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_dp(VALUE self); VALUE rb_dp(VALUE self);
VALUE rb_mp(VALUE self); VALUE rb_mp(VALUE self);

View file

@ -24,7 +24,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVMATND
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
__NAMESPACE_END_CVMATND __NAMESPACE_END_CVMATND
__NAMESPACE_END_OPENCV __NAMESPACE_END_OPENCV

View file

@ -25,7 +25,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -18,7 +18,7 @@
__NAMESPACE_BEGIN_OPENCV __NAMESPACE_BEGIN_OPENCV
__NAMESPACE_BEGIN_CVMEMSTORAGE __NAMESPACE_BEGIN_CVMEMSTORAGE
void define_ruby_class(); void init_ruby_class();
VALUE rb_class(); VALUE rb_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);

View file

@ -31,7 +31,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVMOMENTS
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
VALUE rb_initialize(int argc, VALUE *argv, VALUE self); VALUE rb_initialize(int argc, VALUE *argv, VALUE self);

View file

@ -31,32 +31,6 @@ rb_class()
return rb_klass; return rb_klass;
} }
void
define_ruby_class()
{
if (rb_klass)
return;
/*
* opencv = rb_define_module("OpenCV");
*
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
rb_klass = rb_define_class_under(opencv, "CvPoint", rb_cObject);
rb_define_alloc_func(rb_klass, rb_allocate);
rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
rb_define_alias(rb_klass, "to_a", "to_ary");
}
/* /*
* call-seq: * call-seq:
* combatible?(obj) * combatible?(obj)
@ -224,5 +198,32 @@ new_object(CvPoint point)
return object; return object;
} }
void
init_ruby_class()
{
if (rb_klass)
return;
/*
* opencv = rb_define_module("OpenCV");
*
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
rb_klass = rb_define_class_under(opencv, "CvPoint", rb_cObject);
rb_define_alloc_func(rb_klass, rb_allocate);
rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1);
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0);
rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1);
rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0);
rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1);
rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0);
rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0);
rb_define_alias(rb_klass, "to_a", "to_ary");
}
__NAMESPACE_END_CVPOINT __NAMESPACE_END_CVPOINT
__NAMESPACE_END_OPENCV __NAMESPACE_END_OPENCV

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVPOINT
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_compatible_q(VALUE klass, VALUE object); VALUE rb_compatible_q(VALUE klass, VALUE object);

View file

@ -32,7 +32,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVPOINT2D32F
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_compatible_q(VALUE klass, VALUE object); VALUE rb_compatible_q(VALUE klass, VALUE object);

View file

@ -33,7 +33,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVPOINT3D32F
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_compatible_q(VALUE klass, VALUE object); VALUE rb_compatible_q(VALUE klass, VALUE object);

View file

@ -35,7 +35,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVRECT
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_compatible_q(VALUE klass, VALUE object); VALUE rb_compatible_q(VALUE klass, VALUE object);
VALUE rb_max_rect(VALUE klass, VALUE rect1, VALUE rect2); VALUE rb_max_rect(VALUE klass, VALUE rect1, VALUE rect2);

View file

@ -43,7 +43,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVSCALAR
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_compatible_q(VALUE klass, VALUE object); VALUE rb_compatible_q(VALUE klass, VALUE object);

View file

@ -74,7 +74,7 @@ unregister_elem_class(void *ptr)
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -19,7 +19,7 @@ __NAMESPACE_BEGIN_OPENCV
__NAMESPACE_BEGIN_CVSEQ __NAMESPACE_BEGIN_CVSEQ
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE seqblock_class(void *ptr); VALUE seqblock_class(void *ptr);
void register_elem_class(CvSeq *seq, VALUE klass); void register_elem_class(CvSeq *seq, VALUE klass);

View file

@ -32,7 +32,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVSIZE
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_compatible_q(VALUE klass, VALUE object); VALUE rb_compatible_q(VALUE klass, VALUE object);

View file

@ -32,7 +32,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVSIZE2D32F
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_compatible_q(VALUE klass, VALUE object); VALUE rb_compatible_q(VALUE klass, VALUE object);

View file

@ -29,7 +29,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVSLICE
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
VALUE rb_initialize(VALUE self, VALUE start, VALUE end); VALUE rb_initialize(VALUE self, VALUE start, VALUE end);

View file

@ -24,7 +24,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVSPARSEMAT
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
__NAMESPACE_END_CVSPARSEMAT __NAMESPACE_END_CVSPARSEMAT
__NAMESPACE_END_OPENCV __NAMESPACE_END_OPENCV

View file

@ -31,7 +31,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVSURFPARAMS
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
VALUE rb_initialize(int argc, VALUE *argv, VALUE self); VALUE rb_initialize(int argc, VALUE *argv, VALUE self);

View file

@ -36,7 +36,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVSURFPOINT
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
VALUE rb_initialize(VALUE self, VALUE pt, VALUE laplacian, VALUE size, VALUE dir, VALUE hessian); VALUE rb_initialize(VALUE self, VALUE pt, VALUE laplacian, VALUE size, VALUE dir, VALUE hessian);

View file

@ -30,7 +30,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVTERMCRITERIA
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
VALUE rb_initialize(int argc, VALUE *argv, VALUE self); VALUE rb_initialize(int argc, VALUE *argv, VALUE self);

View file

@ -32,7 +32,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -26,7 +26,7 @@ __NAMESPACE_BEGIN_CVTWOPOINTS
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);

View file

@ -27,7 +27,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_CVVIDEOWRITER
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_initialize(int argc, VALUE *argv, VALUE self); VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
VALUE rb_write(VALUE self, VALUE frame); VALUE rb_write(VALUE self, VALUE frame);

View file

@ -47,7 +47,7 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_EIGENFACES
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_initialize(int argc, VALUE argv[], VALUE self); VALUE rb_initialize(int argc, VALUE argv[], VALUE self);
__NAMESPACE_END_EIGENFACES __NAMESPACE_END_EIGENFACES

View file

@ -152,7 +152,7 @@ rb_load(VALUE self, VALUE filename)
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_FACERECOGNIZER
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_train(VALUE self, VALUE src, VALUE labels); VALUE rb_train(VALUE self, VALUE src, VALUE labels);
VALUE rb_predict(VALUE self, VALUE src); VALUE rb_predict(VALUE self, VALUE src);
VALUE rb_save(VALUE self, VALUE filename); VALUE rb_save(VALUE self, VALUE filename);

View file

@ -47,7 +47,7 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_FISHERFACES
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_initialize(int argc, VALUE argv[], VALUE self); VALUE rb_initialize(int argc, VALUE argv[], VALUE self);
__NAMESPACE_END_FISHERFACES __NAMESPACE_END_FISHERFACES

View file

@ -26,7 +26,7 @@ rb_module_GUI()
} }
void void
define_ruby_module() init_ruby_module()
{ {
if (rb_module) if (rb_module)
return; return;

View file

@ -19,7 +19,7 @@ __NAMESPACE_BEGIN_OPENCV
__NAMESPACE_BEGIN_GUI __NAMESPACE_BEGIN_GUI
VALUE rb_module_GUI(); VALUE rb_module_GUI();
void define_ruby_module(); void init_ruby_module();
VALUE rb_wait_key(int argc, VALUE *argv, VALUE self); VALUE rb_wait_key(int argc, VALUE *argv, VALUE self);

View file

@ -30,7 +30,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -21,7 +21,7 @@ __NAMESPACE_BEGIN_IPLCONVKERNEL
VALUE rb_class(); VALUE rb_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
void define_ruby_class(); void init_ruby_class();
VALUE rb_initialize(int argc, VALUE *argv, VALUE self); VALUE rb_initialize(int argc, VALUE *argv, VALUE self);
VALUE rb_size(VALUE self); VALUE rb_size(VALUE self);
VALUE rb_cols(VALUE self); VALUE rb_cols(VALUE self);

View file

@ -33,40 +33,6 @@ rb_class()
return rb_klass; return rb_klass;
} }
void
define_ruby_class()
{
if (rb_klass)
return;
/*
* opencv = rb_define_module("OpenCV");
* cvmat = rb_define_class_under(opencv, "CvMat", rb_cObject);
*
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
VALUE cvmat = cCvMat::rb_class();
rb_klass = rb_define_class_under(opencv, "IplImage", cvmat);
rb_define_alloc_func(rb_klass, rb_allocate);
rb_define_singleton_method(rb_klass, "load", RUBY_METHOD_FUNC(rb_load_image), -1);
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
rb_define_method(rb_klass, "get_roi", RUBY_METHOD_FUNC(rb_get_roi), 0);
rb_define_alias(rb_klass, "roi", "get_roi");
rb_define_method(rb_klass, "set_roi", RUBY_METHOD_FUNC(rb_set_roi), 1);
rb_define_alias(rb_klass, "roi=", "set_roi");
rb_define_method(rb_klass, "reset_roi", RUBY_METHOD_FUNC(rb_reset_roi), 0);
rb_define_method(rb_klass, "get_coi", RUBY_METHOD_FUNC(rb_get_coi), 0);
rb_define_alias(rb_klass, "coi", "get_coi");
rb_define_method(rb_klass, "set_coi", RUBY_METHOD_FUNC(rb_set_coi), 1);
rb_define_alias(rb_klass, "coi=", "set_coi");
rb_define_method(rb_klass, "reset_coi", RUBY_METHOD_FUNC(rb_reset_coi), 0);
rb_define_method(rb_klass, "pyr_segmentation", RUBY_METHOD_FUNC(rb_pyr_segmentation), 3);
rb_define_method(rb_klass, "smoothness", RUBY_METHOD_FUNC(rb_smoothness), -1);
rb_define_singleton_method(rb_klass, "decode_image", RUBY_METHOD_FUNC(rb_decode_image), -1);
rb_define_alias(rb_singleton_class(rb_klass), "decode", "decode_image");
}
VALUE VALUE
rb_allocate(VALUE klass) rb_allocate(VALUE klass)
{ {
@ -640,5 +606,46 @@ new_object(CvSize size, int type)
return OPENCV_OBJECT(rb_klass, rb_cvCreateImage(size, cvIplDepth(type), CV_MAT_CN(type))); return OPENCV_OBJECT(rb_klass, rb_cvCreateImage(size, cvIplDepth(type), CV_MAT_CN(type)));
} }
void
init_ruby_class()
{
#if 0
// For documentation using YARD
VALUE opencv = rb_define_module("OpenCV");
VALUE cvmat = rb_define_class_under(opencv, "CvMat", rb_cObject);
#endif
if (rb_klass)
return;
/*
* opencv = rb_define_module("OpenCV");
* cvmat = rb_define_class_under(opencv, "CvMat", rb_cObject);
*
* note: this comment is used by rdoc.
*/
VALUE opencv = rb_module_opencv();
VALUE cvmat = cCvMat::rb_class();
rb_klass = rb_define_class_under(opencv, "IplImage", cvmat);
rb_define_alloc_func(rb_klass, rb_allocate);
rb_define_singleton_method(rb_klass, "load", RUBY_METHOD_FUNC(rb_load_image), -1);
rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
rb_define_method(rb_klass, "get_roi", RUBY_METHOD_FUNC(rb_get_roi), 0);
rb_define_alias(rb_klass, "roi", "get_roi");
rb_define_method(rb_klass, "set_roi", RUBY_METHOD_FUNC(rb_set_roi), 1);
rb_define_alias(rb_klass, "roi=", "set_roi");
rb_define_method(rb_klass, "reset_roi", RUBY_METHOD_FUNC(rb_reset_roi), 0);
rb_define_method(rb_klass, "get_coi", RUBY_METHOD_FUNC(rb_get_coi), 0);
rb_define_alias(rb_klass, "coi", "get_coi");
rb_define_method(rb_klass, "set_coi", RUBY_METHOD_FUNC(rb_set_coi), 1);
rb_define_alias(rb_klass, "coi=", "set_coi");
rb_define_method(rb_klass, "reset_coi", RUBY_METHOD_FUNC(rb_reset_coi), 0);
rb_define_method(rb_klass, "pyr_segmentation", RUBY_METHOD_FUNC(rb_pyr_segmentation), 3);
rb_define_method(rb_klass, "smoothness", RUBY_METHOD_FUNC(rb_smoothness), -1);
rb_define_singleton_method(rb_klass, "decode_image", RUBY_METHOD_FUNC(rb_decode_image), -1);
rb_define_alias(rb_singleton_class(rb_klass), "decode", "decode_image");
}
__NAMESPACE_END_IPLIMAGE __NAMESPACE_END_IPLIMAGE
__NAMESPACE_END_OPENCV __NAMESPACE_END_OPENCV

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_IPLIMAGE
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
VALUE rb_initialize(int argc, VALUE *argv, VALUE self); VALUE rb_initialize(int argc, VALUE *argv, VALUE self);

View file

@ -50,7 +50,7 @@ rb_initialize(int argc, VALUE argv[], VALUE self)
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_LBPH
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_initialize(int argc, VALUE argv[], VALUE self); VALUE rb_initialize(int argc, VALUE argv[], VALUE self);
__NAMESPACE_END_LBPH __NAMESPACE_END_LBPH

View file

@ -27,29 +27,6 @@ rb_class()
return rb_klass; return rb_klass;
} }
void
define_ruby_class()
{
if (rb_klass)
return;
/*
* opencv = rb_define_module("OpenCV");
* GUI = rb_define_module_under(opencv, "GUI");
* cvpoint = rb_define_class_under(opencv, "CvPoint", rb_cObject);
*/
VALUE GUI = rb_module_GUI();
VALUE cvpoint = cCvPoint::rb_class();
rb_klass = rb_define_class_under(GUI, "MouseEvent", cvpoint);
rb_define_alloc_func(rb_klass, rb_allocate);
rb_define_method(rb_klass, "event", RUBY_METHOD_FUNC(rb_event), 0);
rb_define_method(rb_klass, "left_button?", RUBY_METHOD_FUNC(rb_left_button_q), 0);
rb_define_method(rb_klass, "right_button?", RUBY_METHOD_FUNC(rb_right_button_q), 0);
rb_define_method(rb_klass, "middle_button?", RUBY_METHOD_FUNC(rb_middle_button_q), 0);
rb_define_method(rb_klass, "ctrl_key?", RUBY_METHOD_FUNC(rb_ctrl_key_q), 0);
rb_define_method(rb_klass, "shift_key?", RUBY_METHOD_FUNC(rb_shift_key_q), 0);
rb_define_method(rb_klass, "alt_key?", RUBY_METHOD_FUNC(rb_alt_key_q), 0);
}
VALUE VALUE
rb_allocate(VALUE klass) rb_allocate(VALUE klass)
{ {
@ -175,6 +152,36 @@ new_object(int event, int x, int y, int flags)
return object; return object;
} }
void
init_ruby_class()
{
#if 0
// For documentation using YARD
VALUE opencv = rb_define_module("OpenCV");
VALUE GUI = rb_define_module_under(opencv, "GUI");
VALUE cvpoint = rb_define_class_under(opencv, "CvPoint", rb_cObject);
#endif
if (rb_klass)
return;
/*
* opencv = rb_define_module("OpenCV");
* GUI = rb_define_module_under(opencv, "GUI");
* cvpoint = rb_define_class_under(opencv, "CvPoint", rb_cObject);
*/
VALUE GUI = rb_module_GUI();
VALUE cvpoint = cCvPoint::rb_class();
rb_klass = rb_define_class_under(GUI, "MouseEvent", cvpoint);
rb_define_alloc_func(rb_klass, rb_allocate);
rb_define_method(rb_klass, "event", RUBY_METHOD_FUNC(rb_event), 0);
rb_define_method(rb_klass, "left_button?", RUBY_METHOD_FUNC(rb_left_button_q), 0);
rb_define_method(rb_klass, "right_button?", RUBY_METHOD_FUNC(rb_right_button_q), 0);
rb_define_method(rb_klass, "middle_button?", RUBY_METHOD_FUNC(rb_middle_button_q), 0);
rb_define_method(rb_klass, "ctrl_key?", RUBY_METHOD_FUNC(rb_ctrl_key_q), 0);
rb_define_method(rb_klass, "shift_key?", RUBY_METHOD_FUNC(rb_shift_key_q), 0);
rb_define_method(rb_klass, "alt_key?", RUBY_METHOD_FUNC(rb_alt_key_q), 0);
}
__NAMESPACE_END_MOUSEEVENT __NAMESPACE_END_MOUSEEVENT
__NAMESPACE_END_GUI __NAMESPACE_END_GUI
__NAMESPACE_END_OPENCV __NAMESPACE_END_OPENCV

View file

@ -27,7 +27,7 @@ typedef struct MouseEvent {
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);

View file

@ -154,7 +154,7 @@ rb_module_opencv()
} }
void void
define_ruby_module() init_ruby_module()
{ {
if (rb_module) if (rb_module)
return; return;
@ -705,70 +705,70 @@ extern "C" {
{ {
cvRedirectError((CvErrorCallback)mOpenCV::error_callback); cvRedirectError((CvErrorCallback)mOpenCV::error_callback);
mOpenCV::define_ruby_module(); mOpenCV::init_ruby_module();
mOpenCV::cCvError::init_ruby_class(); mOpenCV::cCvError::init_ruby_class();
mOpenCV::cCvPoint::define_ruby_class(); mOpenCV::cCvPoint::init_ruby_class();
mOpenCV::cCvPoint2D32f::define_ruby_class(); mOpenCV::cCvPoint2D32f::init_ruby_class();
mOpenCV::cCvPoint3D32f::define_ruby_class(); mOpenCV::cCvPoint3D32f::init_ruby_class();
mOpenCV::cCvSize::define_ruby_class(); mOpenCV::cCvSize::init_ruby_class();
mOpenCV::cCvSize2D32f::define_ruby_class(); mOpenCV::cCvSize2D32f::init_ruby_class();
mOpenCV::cCvRect::define_ruby_class(); mOpenCV::cCvRect::init_ruby_class();
mOpenCV::cCvScalar::define_ruby_class(); mOpenCV::cCvScalar::init_ruby_class();
mOpenCV::cCvSlice::define_ruby_class(); mOpenCV::cCvSlice::init_ruby_class();
mOpenCV::cCvTermCriteria::define_ruby_class(); mOpenCV::cCvTermCriteria::init_ruby_class();
mOpenCV::cCvBox2D::init_ruby_class(); mOpenCV::cCvBox2D::init_ruby_class();
mOpenCV::cCvFont::init_ruby_class(); mOpenCV::cCvFont::init_ruby_class();
mOpenCV::cIplConvKernel::define_ruby_class(); mOpenCV::cIplConvKernel::init_ruby_class();
mOpenCV::cCvMoments::define_ruby_class(); mOpenCV::cCvMoments::init_ruby_class();
mOpenCV::cCvHuMoments::init_ruby_class(); mOpenCV::cCvHuMoments::init_ruby_class();
mOpenCV::cCvConvexityDefect::init_ruby_class(); mOpenCV::cCvConvexityDefect::init_ruby_class();
mOpenCV::cCvSURFPoint::define_ruby_class(); mOpenCV::cCvSURFPoint::init_ruby_class();
mOpenCV::cCvSURFParams::define_ruby_class(); mOpenCV::cCvSURFParams::init_ruby_class();
mOpenCV::cCvMemStorage::define_ruby_class(); mOpenCV::cCvMemStorage::init_ruby_class();
mOpenCV::cCvSeq::define_ruby_class(); mOpenCV::cCvSeq::init_ruby_class();
mOpenCV::mCurve::init_ruby_module(); mOpenCV::mCurve::init_ruby_module();
mOpenCV::mPointSet::define_ruby_module(); mOpenCV::mPointSet::init_ruby_module();
mOpenCV::cCvChain::init_ruby_class(); mOpenCV::cCvChain::init_ruby_class();
mOpenCV::cCvContour::init_ruby_class(); mOpenCV::cCvContour::init_ruby_class();
mOpenCV::cCvContourTree::init_ruby_class(); mOpenCV::cCvContourTree::init_ruby_class();
mOpenCV::cCvMat::init_ruby_class(); mOpenCV::cCvMat::init_ruby_class();
mOpenCV::cIplImage::define_ruby_class(); mOpenCV::cIplImage::init_ruby_class();
mOpenCV::cCvMatND::define_ruby_class(); mOpenCV::cCvMatND::init_ruby_class();
mOpenCV::cCvSparseMat::define_ruby_class(); mOpenCV::cCvSparseMat::init_ruby_class();
mOpenCV::cCvHistogram::init_ruby_class(); mOpenCV::cCvHistogram::init_ruby_class();
mOpenCV::cCvCapture::init_ruby_class(); mOpenCV::cCvCapture::init_ruby_class();
mOpenCV::cCvVideoWriter::define_ruby_class(); mOpenCV::cCvVideoWriter::init_ruby_class();
mOpenCV::cCvLine::init_ruby_class(); mOpenCV::cCvLine::init_ruby_class();
mOpenCV::cCvTwoPoints::define_ruby_class(); mOpenCV::cCvTwoPoints::init_ruby_class();
mOpenCV::cCvCircle32f::init_ruby_class(); mOpenCV::cCvCircle32f::init_ruby_class();
mOpenCV::cCvConDensation::define_ruby_class(); mOpenCV::cCvConDensation::init_ruby_class();
mOpenCV::cCvFeatureTree::init_ruby_class(); mOpenCV::cCvFeatureTree::init_ruby_class();
mOpenCV::cCvConnectedComp::init_ruby_class(); mOpenCV::cCvConnectedComp::init_ruby_class();
mOpenCV::cCvAvgComp::init_ruby_class(); mOpenCV::cCvAvgComp::init_ruby_class();
mOpenCV::cCvHaarClassifierCascade::init_ruby_class(); mOpenCV::cCvHaarClassifierCascade::init_ruby_class();
mOpenCV::cAlgorithm::define_ruby_class(); mOpenCV::cAlgorithm::init_ruby_class();
mOpenCV::cFaceRecognizer::define_ruby_class(); mOpenCV::cFaceRecognizer::init_ruby_class();
mOpenCV::cEigenFaces::define_ruby_class(); mOpenCV::cEigenFaces::init_ruby_class();
mOpenCV::cFisherFaces::define_ruby_class(); mOpenCV::cFisherFaces::init_ruby_class();
mOpenCV::cLBPH::define_ruby_class(); mOpenCV::cLBPH::init_ruby_class();
mOpenCV::mGUI::define_ruby_module(); mOpenCV::mGUI::init_ruby_module();
mOpenCV::mGUI::cWindow::define_ruby_class(); mOpenCV::mGUI::cWindow::init_ruby_class();
mOpenCV::mGUI::cTrackbar::define_ruby_class(); mOpenCV::mGUI::cTrackbar::init_ruby_class();
mOpenCV::mGUI::cMouseEvent::define_ruby_class(); mOpenCV::mGUI::cMouseEvent::init_ruby_class();
#ifdef HAVE_ML_H #ifdef HAVE_ML_H
/* feature support. /* feature support.
mOpenCV::mMachineLearning::define_ruby_module(); mOpenCV::mMachineLearning::init_ruby_module();
*/ */
#endif #endif

View file

@ -200,7 +200,7 @@ void release_object(void *ptr);
void release_iplconvkernel_object(void *ptr); void release_iplconvkernel_object(void *ptr);
VALUE rb_module_opencv(); VALUE rb_module_opencv();
void define_ruby_module(); void init_ruby_module();
// Ruby/OpenCV inline functions // Ruby/OpenCV inline functions
inline CvArr* inline CvArr*

View file

@ -24,7 +24,7 @@ rb_module()
} }
void void
define_ruby_module() init_ruby_module()
{ {
if (module) if (module)
return; return;

View file

@ -20,7 +20,7 @@ __NAMESPACE_BEGIN_POINT_SET
VALUE rb_module(); VALUE rb_module();
void define_ruby_module(); void init_ruby_module();
VALUE rb_contour_area(int argc, VALUE *argv, VALUE self); VALUE rb_contour_area(int argc, VALUE *argv, VALUE self);
VALUE rb_fit_ellipse2(VALUE self); VALUE rb_fit_ellipse2(VALUE self);
VALUE rb_convex_hull2(int argc, VALUE *argv, VALUE self); VALUE rb_convex_hull2(int argc, VALUE *argv, VALUE self);

View file

@ -25,7 +25,7 @@ VALUE rb_class() {
return rb_klass; return rb_klass;
} }
void define_ruby_class() { void init_ruby_class() {
if (rb_klass) if (rb_klass)
return; return;
/* /*

View file

@ -33,7 +33,7 @@ __NAMESPACE_BEGIN_TRACKBAR
VALUE rb_class(); VALUE rb_class();
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);
void trackbar_mark(void *ptr); void trackbar_mark(void *ptr);

View file

@ -33,7 +33,7 @@ rb_class()
} }
void void
define_ruby_class() init_ruby_class()
{ {
if (rb_klass) if (rb_klass)
return; return;

View file

@ -30,7 +30,7 @@ typedef struct Window {
__NAMESPACE_BEGIN_WINDOW __NAMESPACE_BEGIN_WINDOW
void define_ruby_class(); void init_ruby_class();
VALUE rb_allocate(VALUE klass); VALUE rb_allocate(VALUE klass);

View file

@ -1,5 +1,5 @@
require 'yard' require 'yard'
YARD::Tags::Library.define_tag('Corresponding OpenCV function', :opencv_func) YARD::Tags::Library.define_tag('OpenCV function', :opencv_func)
YARD::Tags::Library.visible_tags.place(:opencv_func).before(:abstract) YARD::Tags::Library.visible_tags.place(:opencv_func).before(:abstract)