mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
Merge branch 'master' into documentation
This commit is contained in:
commit
c9c7975cf0
5 changed files with 24 additions and 9 deletions
10
README.rdoc
10
README.rdoc
|
@ -35,7 +35,7 @@ OpenCV wrapper for Ruby
|
|||
|
||||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout OpenCV_2.4
|
||||
$ git checkout master # for OpenCV 2.4 or later. To use OpenCV 2.3, type "git checkout OpenCV_2.3" instead
|
||||
$ ruby extconf.rb --with-opencv-dir=/path/to/opencvdir
|
||||
$ make
|
||||
$ make install
|
||||
|
@ -46,7 +46,7 @@ Use *nmake* instead of *make*.
|
|||
|
||||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout OpenCV_2.4
|
||||
$ git checkout master # for OpenCV 2.4 or later. To use OpenCV 2.3, type "git checkout OpenCV_2.3" instead
|
||||
$ ruby extconf.rb --with-opencv-dir=C:\path\to\opencvdir\install # for your own built OpenCV library
|
||||
$ nmake
|
||||
$ nmake install
|
||||
|
@ -62,7 +62,7 @@ Type the following commands on the *MSYS* *console*.
|
|||
|
||||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout OpenCV_2.4
|
||||
$ git checkout master # for OpenCV 2.4 or later. To use OpenCV 2.3, type "git checkout OpenCV_2.3" instead
|
||||
$ ruby extconf.rb --with-opencv-dir=/C/path/to/opencvdir/install # for your own built OpenCV library
|
||||
$ make
|
||||
$ make install
|
||||
|
@ -78,7 +78,7 @@ To use pre-built OpenCV libraries, set the following option to extconf.rb.
|
|||
|
||||
For example, if you install OpenCV library to */opt/local/* like:
|
||||
|
||||
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/opt/local/ ./OpenCV-2.4.0-beta2
|
||||
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/opt/local/ ./OpenCV-2.4.0
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
|
@ -94,7 +94,7 @@ You can also install this library creating a gem like:
|
|||
|
||||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout OpenCV_2.4
|
||||
$ git checkout master # for OpenCV 2.4 or later. To use OpenCV 2.3, type "git checkout OpenCV_2.3" instead
|
||||
$ bundle install
|
||||
$ rake gem
|
||||
$ gem install pkg/opencv-*.gem -- --with-opencv-dir=/path/to/opencvdir
|
||||
|
|
|
@ -10,9 +10,7 @@ cvmat = OpenCV::CvMat.load("rotated-boxes.jpg")
|
|||
|
||||
# The "canny" edge-detector does only work with grayscale images
|
||||
# so to be sure, convert the image
|
||||
# otherwise you will get something like:
|
||||
# terminate called after throwing an instance of 'cv::Exception'
|
||||
# what(): /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_opencv/work/OpenCV-2.2.0/modules/imgproc/src/canny.cpp:67: error: (-210) in function cvCanny
|
||||
# otherwise you will get an OpenCV::CvStsAssert exception.
|
||||
cvmat = cvmat.BGR2GRAY
|
||||
|
||||
# Use the "canny" edge detection algorithm (http://en.wikipedia.org/wiki/Canny_edge_detector)
|
||||
|
@ -53,7 +51,7 @@ while contour
|
|||
# The corner of the rectangle with the lowest y and x position is the anchor (see image here: http://bit.ly/lT1XvB)
|
||||
# The zero angle position is always straight up.
|
||||
# Positive angle values are clockwise and negative values counter clockwise (so -60 means 60 degree counter clockwise)
|
||||
box = contour.min_area_rect
|
||||
box = contour.min_area_rect2
|
||||
puts "found minimal rectangle with its center at (#{box.center.x.round},#{box.center.y.round}), width of #{box.size.width.round}px, height of #{box.size.height.round} and an angle of #{box.angle.round} degree"
|
||||
end
|
||||
contour = contour.h_next
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue