mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
Merge branch 'OpenCV_2.4' into documentation
This commit is contained in:
commit
7d9901d057
10 changed files with 27 additions and 20 deletions
12
README.rdoc
12
README.rdoc
|
@ -14,7 +14,7 @@ OpenCV wrapper for Ruby
|
|||
== FEATURES/PROBLEMS:
|
||||
|
||||
* Some OpenCV functions are wrapped.
|
||||
* Ruby 1.8.7, 1.9.3 and OpenCV 2.3.1 are supported.
|
||||
* Ruby 1.8.7, 1.9.3 and OpenCV 2.4.0 are supported.
|
||||
|
||||
== DEPENDENCIES:
|
||||
|
||||
|
@ -35,7 +35,7 @@ OpenCV wrapper for Ruby
|
|||
|
||||
$ git clone git://github.com/ruby-opencv/ruby-opencv.git
|
||||
$ cd ruby-opencv
|
||||
$ git checkout master # for OpenCV 2.3 or later. To use OpenCV 2.2, type "git checkout OpenCV_2.2" instead
|
||||
$ git checkout OpenCV_2.4
|
||||
$ 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 master # for OpenCV 2.3 or later. To use OpenCV 2.2, type "git checkout OpenCV_2.2" instead
|
||||
$ git checkout OpenCV_2.4
|
||||
$ 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 master # for OpenCV 2.3 or later. To use OpenCV 2.2, type "git checkout OpenCV_2.2" instead
|
||||
$ git checkout OpenCV_2.4
|
||||
$ 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.3.1
|
||||
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/opt/local/ ./OpenCV-2.4.0-beta2
|
||||
$ 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 master # for OpenCV 2.3 or later. To use OpenCV 2.2, type "git checkout OpenCV_2.2" instead
|
||||
$ git checkout OpenCV_2.4
|
||||
$ bundle install
|
||||
$ rake gem
|
||||
$ gem install pkg/opencv-*.gem -- --with-opencv-dir=/path/to/opencvdir
|
||||
|
|
|
@ -139,8 +139,6 @@ void define_ruby_class()
|
|||
REGISTER_CVERROR("CvStsAssert", CV_StsAssert);
|
||||
REGISTER_CVERROR("CvGpuNotSupported", CV_GpuNotSupported);
|
||||
REGISTER_CVERROR("CvGpuApiCallError", CV_GpuApiCallError);
|
||||
REGISTER_CVERROR("CvGpuNppCallError", CV_GpuNppCallError);
|
||||
REGISTER_CVERROR("CvGpuCufftCallError", CV_GpuCufftCallError);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
|
|
@ -141,9 +141,13 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|||
}
|
||||
font_option = FONT_OPTION(font_option);
|
||||
|
||||
int font_face = NUM2INT(face);
|
||||
if (FO_ITALIC(font_option)) {
|
||||
font_face |= CV_FONT_ITALIC;
|
||||
}
|
||||
try {
|
||||
cvInitFont(CVFONT(self),
|
||||
(FIX2INT(face) | FO_ITALIC(font_option)),
|
||||
font_face,
|
||||
FO_HSCALE(font_option),
|
||||
FO_VSCALE(font_option),
|
||||
FO_SHEAR(font_option),
|
||||
|
|
|
@ -5404,8 +5404,8 @@ rb_optical_flow_bm(int argc, VALUE *argv, VALUE self)
|
|||
int use_previous = 0;
|
||||
try {
|
||||
CvSize image_size = cvGetSize(self_ptr);
|
||||
CvSize velocity_size = cvSize((image_size.width - block_size.width) / shift_size.width,
|
||||
(image_size.height - block_size.height) / shift_size.height);
|
||||
CvSize velocity_size = cvSize((image_size.width - block_size.width + shift_size.width) / shift_size.width,
|
||||
(image_size.height - block_size.height + shift_size.height) / shift_size.height);
|
||||
CvMat *velx_ptr, *vely_ptr;
|
||||
if (NIL_P(velx) && NIL_P(vely)) {
|
||||
int type = CV_MAKETYPE(CV_32F, 1);
|
||||
|
|
|
@ -695,5 +695,7 @@ extern "C" {
|
|||
mOpenCV::mMachineLearning::define_ruby_module();
|
||||
*/
|
||||
#endif
|
||||
|
||||
cv::initModule_nonfree();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ extern "C" {
|
|||
#include "opencv2/video/tracking.hpp"
|
||||
#include "opencv2/video/background_segm.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#include "opencv2/flann/flann.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/objdetect/objdetect.hpp"
|
||||
|
@ -72,6 +73,7 @@ extern "C" {
|
|||
#include "opencv2/highgui/highgui_c.h"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/core/internal.hpp"
|
||||
#include "opencv2/photo/photo.hpp"
|
||||
|
||||
#ifdef HAVE_ML_H
|
||||
#include "opencv2/ml/ml.hpp"
|
||||
|
|
|
@ -18,16 +18,17 @@ opencv_headers = ["opencv2/core/core_c.h", "opencv2/core/core.hpp", "opencv2/img
|
|||
"opencv2/imgproc/imgproc.hpp", "opencv2/video/tracking.hpp", "opencv2/features2d/features2d.hpp",
|
||||
"opencv2/flann/flann.hpp", "opencv2/calib3d/calib3d.hpp", "opencv2/objdetect/objdetect.hpp",
|
||||
"opencv2/legacy/compat.hpp", "opencv2/legacy/legacy.hpp", "opencv2/highgui/highgui_c.h",
|
||||
"opencv2/highgui/highgui.hpp"]
|
||||
"opencv2/highgui/highgui.hpp", "opencv2/photo/photo.hpp", "opencv2/nonfree/nonfree.hpp"]
|
||||
|
||||
opencv_libraries = ["opencv_calib3d", "opencv_contrib", "opencv_core", "opencv_features2d",
|
||||
"opencv_flann", "opencv_gpu", "opencv_highgui", "opencv_imgproc",
|
||||
"opencv_legacy", "opencv_ml", "opencv_objdetect", "opencv_video"]
|
||||
"opencv_legacy", "opencv_ml", "opencv_objdetect", "opencv_video",
|
||||
"opencv_photo", "opencv_nonfree"]
|
||||
|
||||
|
||||
puts ">> Check the required libraries..."
|
||||
|
||||
OPENCV_VERSION_SUFFIX = '231'
|
||||
OPENCV_VERSION_SUFFIX = '240'
|
||||
case CONFIG["arch"]
|
||||
when /mswin32/
|
||||
opencv_libraries.map! {|lib| lib + OPENCV_VERSION_SUFFIX }
|
||||
|
|
|
@ -36,8 +36,8 @@ class TestCurve < OpenCVTestCase
|
|||
|
||||
def test_arc_length
|
||||
assert_in_delta(211.480, @contour2.arc_length, 0.001)
|
||||
assert_in_delta(18.071, @contour2.arc_length(CvSlice.new(0, 9), true), 0.001)
|
||||
assert_in_delta(18.071, @contour2.arc_length(0..10, true), 0.001)
|
||||
assert_in_delta(32.181, @contour2.arc_length(CvSlice.new(0, 9), true), 0.001)
|
||||
assert_in_delta(32.181, @contour2.arc_length(0..10, true), 0.001)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class TestCvError < OpenCVTestCase
|
|||
end
|
||||
|
||||
def test_subclass
|
||||
errors = [CvStsBackTrace, CvStsError, CvStsInternal, CvStsNoMem, CvStsBadArg, CvStsBadFunc, CvStsNoConv, CvStsAutoTrace, CvHeaderIsNull, CvBadImageSize, CvBadOffset, CvBadDataPtr, CvBadStep, CvBadModelOrChSeq, CvBadNumChannels, CvBadNumChannel1U, CvBadDepth, CvBadAlphaChannel, CvBadOrder, CvBadOrigin, CvBadAlign, CvBadCallBack, CvBadTileSize, CvBadCOI, CvBadROISize, CvMaskIsTiled, CvStsNullPtr, CvStsVecLengthErr, CvStsFilterStructContentErr, CvStsKernelStructContentErr, CvStsFilterOffsetErr, CvStsBadSize, CvStsDivByZero, CvStsInplaceNotSupported, CvStsObjectNotFound, CvStsUnmatchedFormats, CvStsBadFlag, CvStsBadPoint, CvStsBadMask, CvStsUnmatchedSizes, CvStsUnsupportedFormat, CvStsOutOfRange, CvStsParseError, CvStsNotImplemented, CvStsBadMemBlock, CvStsAssert, CvGpuNotSupported, CvGpuApiCallError, CvGpuNppCallError, CvGpuCufftCallError]
|
||||
errors = [CvStsBackTrace, CvStsError, CvStsInternal, CvStsNoMem, CvStsBadArg, CvStsBadFunc, CvStsNoConv, CvStsAutoTrace, CvHeaderIsNull, CvBadImageSize, CvBadOffset, CvBadDataPtr, CvBadStep, CvBadModelOrChSeq, CvBadNumChannels, CvBadNumChannel1U, CvBadDepth, CvBadAlphaChannel, CvBadOrder, CvBadOrigin, CvBadAlign, CvBadCallBack, CvBadTileSize, CvBadCOI, CvBadROISize, CvMaskIsTiled, CvStsNullPtr, CvStsVecLengthErr, CvStsFilterStructContentErr, CvStsKernelStructContentErr, CvStsFilterOffsetErr, CvStsBadSize, CvStsDivByZero, CvStsInplaceNotSupported, CvStsObjectNotFound, CvStsUnmatchedFormats, CvStsBadFlag, CvStsBadPoint, CvStsBadMask, CvStsUnmatchedSizes, CvStsUnsupportedFormat, CvStsOutOfRange, CvStsParseError, CvStsNotImplemented, CvStsBadMemBlock, CvStsAssert, CvGpuNotSupported, CvGpuApiCallError]
|
||||
|
||||
errors.each { |err|
|
||||
assert_equal(CvError, err.superclass)
|
||||
|
|
|
@ -9,10 +9,10 @@ include OpenCV
|
|||
class TestOpenCV < OpenCVTestCase
|
||||
def test_constants
|
||||
# OpenCV version
|
||||
assert_equal('2.3.1', CV_VERSION)
|
||||
assert_equal('2.4.0', CV_VERSION)
|
||||
assert_equal(2, CV_MAJOR_VERSION)
|
||||
assert_equal(3, CV_MINOR_VERSION)
|
||||
assert_equal(1, CV_SUBMINOR_VERSION)
|
||||
assert_equal(4, CV_MINOR_VERSION)
|
||||
assert_equal(0, CV_SUBMINOR_VERSION)
|
||||
|
||||
# Depths
|
||||
assert_equal(0, CV_8U)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue