diff --git a/ext/opencv/opencv.cpp b/ext/opencv/opencv.cpp index 3247a17..0cc616e 100644 --- a/ext/opencv/opencv.cpp +++ b/ext/opencv/opencv.cpp @@ -527,6 +527,8 @@ define_ruby_module() rb_define_module_function(rb_module, "Luv2RGB", RUBY_METHOD_FUNC(rb_Luv2RGB), 1); rb_define_module_function(rb_module, "HLS2BGR", RUBY_METHOD_FUNC(rb_HLS2BGR), 1); rb_define_module_function(rb_module, "HLS2RGB", RUBY_METHOD_FUNC(rb_HLS2RGB), 1); + + rb_define_module_function(rb_module, "build_information", RUBY_METHOD_FUNC(rb_build_information), 0); } #define CREATE_CVTCOLOR_FUNC(rb_func_name, c_const_name, src_cn, dest_cn) \ @@ -620,6 +622,13 @@ CREATE_CVTCOLOR_FUNC(rb_Luv2RGB, CV_Luv2RGB, 3, 3); CREATE_CVTCOLOR_FUNC(rb_HLS2BGR, CV_HLS2BGR, 3, 3); CREATE_CVTCOLOR_FUNC(rb_HLS2RGB, CV_HLS2RGB, 3, 3); +VALUE +rb_build_information(VALUE klass) +{ + return rb_str_new_cstr(cv::getBuildInformation().c_str()); +} + + int error_callback(int status, const char *function_name, const char *error_message, const char *file_name, int line, void *user_data) diff --git a/ext/opencv/opencv.h b/ext/opencv/opencv.h index eb5b440..18c283a 100644 --- a/ext/opencv/opencv.h +++ b/ext/opencv/opencv.h @@ -393,6 +393,8 @@ VALUE rb_Luv2RGB(VALUE klass, VALUE image); VALUE rb_HLS2BGR(VALUE klass, VALUE image); VALUE rb_HLS2RGB(VALUE klass, VALUE image); +VALUE rb_build_information(VALUE klass); + __NAMESPACE_END_OPENCV #endif // RUBY_OPENCV_H diff --git a/test/test_opencv.rb b/test/test_opencv.rb index 2ef9bb1..7807f02 100755 --- a/test/test_opencv.rb +++ b/test/test_opencv.rb @@ -329,6 +329,12 @@ class TestOpenCV < OpenCVTestCase flunk('FIXME: Most cvtColor functions are not tested yet.') end + + def test_build_information + s = build_information + assert_equal(String, s.class) + assert(s =~ /^\s+General configuration for OpenCV #{CV_VERSION}/) + end end