ropencv 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/License.txt ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2013, Alexander Duda All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ * The names of its contributors may not be used to endorse or promote products
14
+ derived from this software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,33 +1,54 @@
1
- # ffi ruby bindings for OpenCV
2
- Automated ffi ruby bindings for OpenCV 2.4.4 and higher. For wrapping
3
- all marked OpenCV C++ methods the OpenCV hdr parser is used to parse the OpenCV
4
- header files. From there rbind generates a C interface and ruby classes. The
5
- ruby classes are using the C interface via ffi to give the user the same object
6
- oriented experience on the ruby side like he has on the c++ side.
1
+ # Ruby Bindings for OpenCV
2
+ ROpenCV is a ffi ruby binding for the Open Source Computer Vision Library
3
+ [OpenCV](http://opencv.org/opencv-java-api.html).
4
+
5
+ Unlike other OpenCV ruby binding projects like
6
+ [ruby-opencv](https://github.com/ruby-opencv/ruby-opencv/) or
7
+ [opencv-ffi](https://github.com/amarburg/opencv-ffi) this binding is
8
+ automatically generated by parsing the OpenCV C++ headers having the following
9
+ advantages:
10
+
11
+ * automatically up-to-date
12
+ * full API coverage
13
+ * closely match the original C++ interface
7
14
 
8
15
  ## State:
9
16
  - All marked methods in the OpenCV C++ header are wrapped
10
17
  - Memory management needs review
11
18
  - Currently, no support for multi threading or GPU
12
19
 
13
- ## Supported OpenCV versions:
14
- - 2.4.4
15
- - 2.4.5
16
- - 2.4.6
17
- - 2.4.9
20
+ ## License
21
+ ROpenCV is released under a BSD license, it is free for both academic and
22
+ commercial use.
23
+
24
+ ## Compatibility Notes
25
+ ROpenCV should run on any platform which supports Ruby and OpenCV 2.4.4 or
26
+ higher. It has been successfully tested on the following platforms.
18
27
 
19
- # Installation
20
- You have to install opencv 2.4.4 - 2.4.6 or 2.4.9 first. Afterward, you can install opencv ruby bindings via:
21
- - gem install ropencv
28
+ * Linux with Ruby 1.9.3 and OpenCV 2.4.4 - 2.4.6
29
+ * Mac OSX with Ruby 1.9.3 and OpenCV 2.4.4 - 2.4.6
22
30
 
23
- # Example1
31
+ ## Installation
32
+ After running the following commands, ROpenCV and all the mandatory
33
+ dependencies should be installed:
34
+
35
+ ### Ubuntu / Debian
36
+ * [Install OpenCV 2.4.4 or newer.](http://opencv.org/downloads.html)
37
+ * sudo apt-get install ruby rubygems cmake g++
38
+ * sudo gem install ropencv
39
+
40
+ ### Usage
24
41
 
25
42
  require 'ropencv'
26
43
  include OpenCV
44
+ m = cv::Mat.new(3,3,cv::CV_64FC1)
27
45
 
28
- mat = cv::imread("logo.png")
29
- cv.blur(mat,mat,cv::Size.new(10,10))
46
+ # Example
30
47
 
48
+ require 'ropencv'
49
+ include OpenCV
50
+
51
+ mat = cv::imread("logo.png")
31
52
  detector = cv::FeatureDetector::create("SURF")
32
53
  keypoints = Std::Vector.new(cv::KeyPoint)
33
54
  detector.detect(mat,keypoints)
@@ -38,33 +59,3 @@ You have to install opencv 2.4.4 - 2.4.6 or 2.4.9 first. Afterward, you can inst
38
59
  cv::draw_keypoints(mat,keypoints,mat)
39
60
  cv::imshow("key_points",mat)
40
61
  cv::wait_key(-1)
41
-
42
- # Example2
43
-
44
- require 'ropencv'
45
- include OpenCV
46
-
47
- mat1 = cv::imread("image1.png")
48
- mat2 = cv::imread("image2.png")
49
-
50
- detector = cv::FeatureDetector::create("SURF")
51
- extractor = cv::DescriptorExtractor::create("SURF")
52
- matcher = cv::DescriptorMatcher::create("BruteForce")
53
-
54
- features1 = Std::Vector.new(cv::KeyPoint.new)
55
- features2 = Std::Vector.new(cv::KeyPoint.new)
56
- detector.detect mat1,features1
57
- detector.detect mat2,features2
58
-
59
- descriptor1 = cv::Mat.new
60
- descriptor2 = cv::Mat.new
61
- extractor.compute(mat1,features1,descriptor1)
62
- extractor.compute(mat2,features2,descriptor2)
63
-
64
- matches = Std::Vector(cv::DMatch.new)
65
- matcher.match(descriptor1,descriptor2,matches)
66
-
67
- result = cv::Mat.new
68
- cv::draw_matches(mat_last,features1,mat,features2,matches,result)
69
- cv::imshow("result",result)
70
- cv::wait_key(-1)
data/ext/opencv.yml CHANGED
@@ -13723,7 +13723,7 @@ cv::CvMat: |-
13723
13723
  `CV_MAT_ELEM(matrix, type, i, j*nchannels + channel_idx)`.
13724
13724
 
13725
13725
  `CvMat` is now obsolete; consider using :ocvMat instead.
13726
- cv::CvMatND: `CvMatND` is now obsolete; consider using :ocvMat instead.
13726
+ cv::CvMatND: CvMatND is now obsolete; consider using :ocvMat instead.
13727
13727
  cv::IplImage: |-
13728
13728
  The `IplImage` is taken from the Intel Image Processing Library, in
13729
13729
  which the format is native. OpenCV only supports a subset of possible
data/ext/rbind.rb CHANGED
@@ -59,19 +59,28 @@ rbind.parser.type("std::vector<Point3f>")
59
59
  rbind.parser.type("std::vector<Point3d>")
60
60
  rbind.parser.type("std::vector<Vec4i>")
61
61
 
62
+ # add some extra documentation
63
+ rbind.parser.doc = "ROpenCV API Documentation for OpenCV #{opencv_version}"
64
+ rbind.parser.cv.doc = "ROpenCV API Documentation for OpenCV #{opencv_version}"
65
+
62
66
  # add opencv docu
63
- #@doc = YAML.load(File.open(File.join(File.dirname(__FILE__),'opencv.yml')).read)
64
- #rbind.parser.each_type do |t|
65
- # if @doc.has_key?(t.full_name)
66
- # t.doc = @doc[t.full_name]
67
- # end
68
- # next unless t.is_a?(Rbind::RNamespace)
69
- # t.each_operation do |op|
70
- # if @doc.has_key?(op.full_name)
71
- # op.doc = @doc[op.full_name]
72
- # end
73
- # end
74
- #end
67
+ # this is disabled by default because yard takes ages to parse
68
+ # the ruby files
69
+ if ARGV.include?("--doc")
70
+ Rbind.log.info "processing opencv.yml"
71
+ @doc = YAML.load(File.open(File.join(File.dirname(__FILE__),'opencv.yml'),"r:ascii").read)
72
+ rbind.parser.each_type do |t|
73
+ if @doc.has_key?(t.full_name)
74
+ t.doc = @doc[t.full_name]
75
+ end
76
+ next unless t.is_a?(Rbind::RNamespace)
77
+ t.each_operation do |op|
78
+ if @doc.has_key?(op.full_name)
79
+ op.doc = @doc[op.full_name]
80
+ end
81
+ end
82
+ end
83
+ end
75
84
 
76
85
  # generate files
77
86
  rbind.generator_ruby.file_prefix = "ropencv"
@@ -41,9 +41,9 @@ else()
41
41
  FIND_PACKAGE(Ruby)
42
42
  IF(NOT RUBY_INCLUDE_PATH)
43
43
  MESSAGE(STATUS "Ruby library not found. Cannot install ruby extensions")
44
- ELSEIF(RUBY_EXTENSIONS_AVAILABLE)
44
+ ELSE(NOT RUBY_INCLUDE_PATH)
45
45
  STRING(REGEX REPLACE ".*lib(32|64)?/?" "lib/" RUBY_LIBRARY_INSTALL_DIR ${RUBY_RUBY_LIB_PATH})
46
- INSTALL(DIRECTORY ${ROOT_FOLDER}/lib/ruby/ DESTINATION ${RUBY_LIBRARY_INSTALL_DIR}
46
+ INSTALL(DIRECTORY ${ROOT_FOLDER}/lib/ DESTINATION ${RUBY_LIBRARY_INSTALL_DIR}
47
47
  FILES_MATCHING PATTERN "*.rb")
48
48
  ENDIF(NOT RUBY_INCLUDE_PATH)
49
49
  endif()
@@ -7,22 +7,26 @@ module OpenCV
7
7
  end
8
8
  end
9
9
 
10
- class Std::Vector::Cv_Mat
11
- def self.to_native(obj,context)
12
- if obj.is_a?(Vector::Std_Vector_Cv_Point2f)
13
- t = Vector::Cv_Mat.new
14
- obj.each do |e|
15
- t << cv::Mat.new(e.size,2,cv::CV_32FC1,e.data,cv::Mat::AUTO_STEP)
16
- end
17
- t.__obj_ptr__
18
- elsif obj.is_a?(Vector::Std_Vector_Cv_Point)
19
- t = Vector::Cv_Mat.new
20
- obj.each do |e|
21
- t << cv::Mat.new(e.size,2,cv::CV_32SC1,e.data,cv::Mat::AUTO_STEP)
10
+ module Std
11
+ class Vector
12
+ class Cv_Mat
13
+ def self.to_native(obj,context)
14
+ if obj.is_a?(Vector::Std_Vector_Cv_Point2f)
15
+ t = Vector::Cv_Mat.new
16
+ obj.each do |e|
17
+ t << cv::Mat.new(e.size,2,cv::CV_32FC1,e.data,cv::Mat::AUTO_STEP)
18
+ end
19
+ t.__obj_ptr__
20
+ elsif obj.is_a?(Vector::Std_Vector_Cv_Point)
21
+ t = Vector::Cv_Mat.new
22
+ obj.each do |e|
23
+ t << cv::Mat.new(e.size,2,cv::CV_32SC1,e.data,cv::Mat::AUTO_STEP)
24
+ end
25
+ t.__obj_ptr__
26
+ else
27
+ rbind_to_native(obj,context)
28
+ end
22
29
  end
23
- t.__obj_ptr__
24
- else
25
- rbind_to_native(obj,context)
26
30
  end
27
31
  end
28
32
  end
@@ -152,7 +156,7 @@ module OpenCV
152
156
  [obj.size,1,obj.first]
153
157
  end
154
158
  setter,step,type = if e.is_a? Fixnum
155
- [:put_array_of_uint8,w,CV_8UC1]
159
+ [:put_array_of_int32,4*w,CV_32SC1]
156
160
  elsif e.is_a? Float
157
161
  [:put_array_of_float64,8*w,CV_64FC1]
158
162
  else
@@ -205,8 +209,6 @@ module OpenCV
205
209
  data.get_int32(i*step+j*4)
206
210
  when CV_32F
207
211
  data.get_float32(i*step+j*4)
208
- when CV_32F
209
- data.get_float32(i*step+j*4)
210
212
  when CV_64F
211
213
  data.get_float64(i*step+j*8)
212
214
  else
@@ -260,11 +262,11 @@ module OpenCV
260
262
  when CV_8U
261
263
  data.put_uint8(i*step+j,val)
262
264
  when CV_16U
263
- data.put_uint16(i*step+j,val*2)
265
+ data.put_uint16(i*step+j*2,val)
264
266
  when CV_16S
265
- data.put_int16(i*step+j,val*2)
267
+ data.put_int16(i*step+j*2,val)
266
268
  when CV_32S
267
- data.put_int32(i*step+j,val*4)
269
+ data.put_int32(i*step+j*4,val)
268
270
  when CV_32F
269
271
  data.put_float32(i*step+j*4,val)
270
272
  when CV_64F
data/ropencv.gemspec CHANGED
@@ -1,20 +1,18 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ropencv'
3
- s.version = '0.0.10'
4
- s.date = '2013-08-15'
3
+ s.version = '0.0.11'
4
+ s.date = '2013-08-21'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Alexander Duda']
7
7
  s.email = ['Alexander.Duda@dfki.de']
8
- s.homepage = 'http://github.com/D-Alex/ropencv'
9
- s.summary = 'Automated ffi-bindings for opencv 2.4.4 and higher'
10
- s.description = 'For wrapping all marked OpenCV C++ methods the OpenCV hdr parser is used to parse the OpenCV '\
11
- 'header files. From there rbind generates a C interface and ruby classes. The '\
12
- 'ruby classes are using the C interface via ffi to give the user the same object '\
13
- 'oriented experience on the ruby side like he has on the c++ side.'
8
+ s.homepage = 'http://www.ropencv.aduda.eu'
9
+ s.summary = 'Ruby bindings for opencv 2.4.4 and higher'
10
+ s.description = 'ROpenCV is a ffi ruby binding for the Open Source Computer Vision Library OpenCV 2.4.4 and higher'
14
11
  s.files = `git ls-files`.split("\n") + ["lib/ropencv/ropencv_types.rb","lib/ropencv/ropencv_ruby.rb"]
15
12
  s.require_path = 'lib'
16
13
  s.required_rubygems_version = ">= 1.3.6"
17
- s.add_runtime_dependency "rbind", "~> 0.0.17"
14
+ s.add_runtime_dependency "rbind", "~> 0.0.21"
18
15
  s.add_runtime_dependency "ffi", "~> 1.9.0"
19
16
  s.extensions = ['ext/extconf.rb']
17
+ s.license = 'BSD'
20
18
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ropencv
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alexander Duda
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2013-08-15 00:00:00 Z
13
+ date: 2013-08-21 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rbind
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.0.17
23
+ version: 0.0.21
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: 1.9.0
35
35
  type: :runtime
36
36
  version_requirements: *id002
37
- description: For wrapping all marked OpenCV C++ methods the OpenCV hdr parser is used to parse the OpenCV header files. From there rbind generates a C interface and ruby classes. The ruby classes are using the C interface via ffi to give the user the same object oriented experience on the ruby side like he has on the c++ side.
37
+ description: ROpenCV is a ffi ruby binding for the Open Source Computer Vision Library OpenCV 2.4.4 and higher
38
38
  email:
39
39
  - Alexander.Duda@dfki.de
40
40
  executables: []
@@ -47,6 +47,7 @@ files:
47
47
  - .gitignore
48
48
  - .yardopts
49
49
  - CMakeLists.txt
50
+ - License.txt
50
51
  - README.md
51
52
  - examples/find_keypoints.rb
52
53
  - examples/logo.png
@@ -75,9 +76,9 @@ files:
75
76
  - test/test_vec.rb
76
77
  - test/test_vector.rb
77
78
  - lib/ropencv/ropencv_types.rb
78
- homepage: http://github.com/D-Alex/ropencv
79
- licenses: []
80
-
79
+ homepage: http://www.ropencv.aduda.eu
80
+ licenses:
81
+ - BSD
81
82
  post_install_message:
82
83
  rdoc_options: []
83
84
 
@@ -101,7 +102,7 @@ rubyforge_project:
101
102
  rubygems_version: 1.8.23
102
103
  signing_key:
103
104
  specification_version: 3
104
- summary: Automated ffi-bindings for opencv 2.4.4 and higher
105
+ summary: Ruby bindings for opencv 2.4.4 and higher
105
106
  test_files: []
106
107
 
107
108
  has_rdoc: