Skip to content

Commit

Permalink
add OpenCV::build_information (wrapper of cv::getBuildInformation())
Browse files Browse the repository at this point in the history
  • Loading branch information
ser1zw committed May 22, 2012
1 parent 0cd12f6 commit 56b33ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ext/opencv/opencv.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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, "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, "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, "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) \ #define CREATE_CVTCOLOR_FUNC(rb_func_name, c_const_name, src_cn, dest_cn) \
Expand Down Expand Up @@ -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_HLS2BGR, CV_HLS2BGR, 3, 3);
CREATE_CVTCOLOR_FUNC(rb_HLS2RGB, CV_HLS2RGB, 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 int
error_callback(int status, const char *function_name, const char *error_message, error_callback(int status, const char *function_name, const char *error_message,
const char *file_name, int line, void *user_data) const char *file_name, int line, void *user_data)
Expand Down
2 changes: 2 additions & 0 deletions ext/opencv/opencv.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ VALUE rb_Luv2RGB(VALUE klass, VALUE image);
VALUE rb_HLS2BGR(VALUE klass, VALUE image); VALUE rb_HLS2BGR(VALUE klass, VALUE image);
VALUE rb_HLS2RGB(VALUE klass, VALUE image); VALUE rb_HLS2RGB(VALUE klass, VALUE image);


VALUE rb_build_information(VALUE klass);

__NAMESPACE_END_OPENCV __NAMESPACE_END_OPENCV


#endif // RUBY_OPENCV_H #endif // RUBY_OPENCV_H
6 changes: 6 additions & 0 deletions test/test_opencv.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ def test_cvt_color_funcs


flunk('FIXME: Most cvtColor functions are not tested yet.') flunk('FIXME: Most cvtColor functions are not tested yet.')
end end

def test_build_information
s = build_information
assert_equal(String, s.class)
assert(s =~ /^\s+General configuration for OpenCV #{CV_VERSION}/)
end
end end




0 comments on commit 56b33ca

Please sign in to comment.