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

added OpenCV version constants

This commit is contained in:
ser1zw 2011-10-31 01:51:20 +09:00
parent 32b2c0a41d
commit 1d1244de0c
2 changed files with 13 additions and 1 deletions

View file

@ -159,7 +159,13 @@ define_ruby_module()
if (rb_module)
return;
rb_module = rb_define_module("OpenCV");
/* OpenCV version */
rb_define_const(rb_module, "CV_VERSION", rb_str_new_cstr(CV_VERSION));
rb_define_const(rb_module, "CV_MAJOR_VERSION", INT2FIX(CV_MAJOR_VERSION));
rb_define_const(rb_module, "CV_MINOR_VERSION", INT2FIX(CV_MINOR_VERSION));
rb_define_const(rb_module, "CV_SUBMINOR_VERSION", INT2FIX(CV_SUBMINOR_VERSION));
/* 0: 8bit unsigned */
rb_define_const(rb_module, "CV_8U", INT2FIX(CV_8U));
/* 1: 8bit signed */

View file

@ -8,6 +8,12 @@ include OpenCV
class TestOpenCV < OpenCVTestCase
def test_constants
# OpenCV version
assert_equal('2.3.1', CV_VERSION)
assert_equal(2, CV_MAJOR_VERSION)
assert_equal(3, CV_MINOR_VERSION)
assert_equal(1, CV_SUBMINOR_VERSION)
# Depths
assert_equal(0, CV_8U)
assert_equal(1, CV_8S)