Browse files

add OpenCV::build_information (wrapper of cv::getBuildInformation())

  • Loading branch information...
1 parent 0cd12f6 commit 56b33ca03db12e915f8af1a57b33099108126071 @ser1zw ser1zw committed May 22, 2012
Showing with 17 additions and 0 deletions.
  1. +9 −0 ext/opencv/opencv.cpp
  2. +2 −0 ext/opencv/opencv.h
  3. +6 −0 test/test_opencv.rb
View
9 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)
View
2 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
View
6 test/test_opencv.rb
@@ -329,6 +329,12 @@ def test_cvt_color_funcs
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

0 comments on commit 56b33ca

Please sign in to comment.