red-opencv 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c9d2608ac2515ed40d37b68ed88b4ac3e5e65ec31506e0126e1b299a8b94921d
4
+ data.tar.gz: 8cf1e8569b66ec6d03182968d8f2a1b69f1febae6a5f0d419a12b88ddc68e129
5
+ SHA512:
6
+ metadata.gz: 45ca241200cb566441fe39dcf45496f208f29ecafb0c5acda51a37876b16f293bd7b6a4390d961aefcc03dbe90840e12d868a6a917ad2abba27f8fab17df2c01
7
+ data.tar.gz: d5995f078b48d067958117288977c3cf61e6375a9119c61b078d1d52474c395b98e13fb0f78d1e17e74b578f55b0cfc6c2eba8d3b60012b1b7f0d3ff9bb1d397
@@ -0,0 +1,6 @@
1
+ --output-dir doc/reference/en
2
+ --markup markdown
3
+ --markup-provider kramdown
4
+ lib/**/*.rb
5
+ -
6
+ doc/text/**/*
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # -*- ruby -*-
2
+
3
+ source "https://rubygems.org/"
4
+
5
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2018 Kouhei Sutou <kou@clear-code.com>
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions
5
+ are met:
6
+ 1. Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ 2. Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ 3. Neither the name of the University nor the names of its contributors
12
+ may be used to endorse or promote products derived from this software
13
+ without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
+ SUCH DAMAGE.
@@ -0,0 +1,67 @@
1
+ # README
2
+
3
+ ## Name
4
+
5
+ Red OpenCV
6
+
7
+ ## Description
8
+
9
+ Red OpenCV is a Ruby bindings of OpenCV. Red OpenCV is based on GObject Introspection.
10
+
11
+ [OpenCV][opencv] is a computer vision library.
12
+
13
+ [GObject Introspection][gobject-introspection] is a middleware for language bindings of C library. GObject Introspection can generate language bindings automatically at runtime.
14
+
15
+ Red OpenCV uses [OpenCV GLib][opencv-glib] and [gobject-introspection gem][gobject-introspection-gem] to generate Ruby bindings of OpenCV.
16
+
17
+ OpenCV GLib is a C wrapper for OpenCV. GObject Introspection can't use OpenCV directly because OpenCV uses C++. OpenCV GLib is a bridge between OpenCV and GObject Introspection.
18
+
19
+ gobject-introspection gem is a Ruby bindings of GObject Introspection. Red OpenCV uses GObject Introspection via gobject-introspection gem.
20
+
21
+ ## Install
22
+
23
+ Install OpenCV GLib before install Red OpenCV. Use [packages.red-data-tools.org][packages-red-data-tools-org] for installing OopenCV GLib.
24
+
25
+ Install Red OpenCV after you install OpenCV GLib:
26
+
27
+ ```text
28
+ % gem install red-opencv
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ```ruby
34
+ require "cv"
35
+
36
+ # TODO
37
+ ```
38
+
39
+ ## Dependencies
40
+
41
+ * [OpenCV][opencv]
42
+
43
+ * [OpenCV GLib][opencv-glib]
44
+
45
+
46
+ ## Authors
47
+
48
+ * Kouhei Sutou \<kou@clear-code.com\>
49
+
50
+ ## License
51
+
52
+ [The 3-Clause BSD license][bsd-3-clause]. See LICENSE for details.
53
+
54
+ (Kouhei Sutou has a right to change the license including contributed
55
+ patches.)
56
+
57
+ [opencv]:https://opencv.org/
58
+
59
+ [gobject-introspection]:https://wiki.gnome.org/action/show/Projects/GObjectIntrospection
60
+
61
+ [opencv-glib]:https://github.com/red-data-tools/opencv-glib
62
+
63
+ [gobject-introspection-gem]:https://rubygems.org/gems/gobject-introspection
64
+
65
+ [packages-red-data-tools-org]:https://github.com/red-data-tools/packages.red-data-tools.org
66
+
67
+ [bsd-3-clause]:https://opensource.org/licenses/BSD-3-Clause
@@ -0,0 +1,33 @@
1
+ # -*- ruby -*-
2
+
3
+ require "rubygems"
4
+ require "bundler/gem_helper"
5
+ require "packnga"
6
+
7
+ base_dir = __dir__
8
+
9
+ helper = Bundler::GemHelper.new(base_dir)
10
+ def helper.version_tag
11
+ version
12
+ end
13
+
14
+ helper.install
15
+ spec = helper.gemspec
16
+
17
+ Packnga::DocumentTask.new(spec) do |task|
18
+ task.original_language = "en"
19
+ task.translate_language = "ja"
20
+ end
21
+
22
+ Packnga::ReleaseTask.new(spec) do
23
+ end
24
+
25
+ desc "Run tests"
26
+ task :test do
27
+ cd("dependency-check") do
28
+ ruby("-S", "rake")
29
+ end
30
+ ruby("test/run-test.rb")
31
+ end
32
+
33
+ task default: :test
@@ -0,0 +1,25 @@
1
+ # -*- ruby -*-
2
+
3
+ require "pkg-config"
4
+ require "native-package-installer"
5
+
6
+ case RUBY_PLATFORM
7
+ when /mingw|mswin/
8
+ task :default => "nothing"
9
+ else
10
+ task :default => "dependency:check"
11
+ end
12
+
13
+ task :nothing do
14
+ end
15
+
16
+ namespace :dependency do
17
+ desc "Check dependency"
18
+ task :check do
19
+ unless PKGConfig.check_version?("opencv-glib")
20
+ unless NativePackageInstaller.install(:debian => "libopencv-glib-dev")
21
+ exit(false)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,12 @@
1
+ require "gobject-introspection"
2
+
3
+ require "cv/version"
4
+
5
+ require "cv/loader"
6
+
7
+ module CV
8
+ class Error < StandardError
9
+ end
10
+
11
+ Loader.load
12
+ end
@@ -0,0 +1,12 @@
1
+ module CV
2
+ class Image
3
+ class << self
4
+ alias_method :read_raw, :read
5
+ def read(filename, flags=nil)
6
+ filename = filename.to_path if filename.respond_to?(:to_path)
7
+ flags ||= [:any_depth, :any_color]
8
+ read_raw(filename, flags)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ module CV
2
+ class Loader < GObjectIntrospection::Loader
3
+ class << self
4
+ def load
5
+ super("CV", CV)
6
+ end
7
+ end
8
+
9
+ private
10
+ def post_load(repository, namespace)
11
+ require "cv/image"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module CV
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,39 @@
1
+ # -*- ruby -*-
2
+
3
+ clean_white_space = lambda do |entry|
4
+ entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
5
+ end
6
+
7
+ $LOAD_PATH.unshift(File.join(__dir__, "lib"))
8
+ require "cv/version"
9
+
10
+ Gem::Specification.new do |spec|
11
+ spec.name = "red-opencv"
12
+ spec.version = CV::VERSION
13
+ spec.homepage = "https://github.com/red-data-tools/red-opencv"
14
+ spec.authors = ["Kouhei Sutou"]
15
+ spec.email = ["kou@clear-code.com"]
16
+
17
+ readme = File.read("README.md")
18
+ readme.force_encoding("UTF-8")
19
+ entries = readme.split(/^\#\#\s(.*)$/)
20
+ clean_white_space.call(entries[entries.index("Description") + 1])
21
+ description = clean_white_space.call(entries[entries.index("Description") + 1])
22
+ spec.summary, spec.description, = description.split(/\n\n+/, 3)
23
+ spec.license = "BSD-3-Clause"
24
+ spec.files = ["README.md", "LICENSE", "Rakefile", "Gemfile"]
25
+ spec.files += ["#{spec.name}.gemspec"]
26
+ spec.files += [".yardopts"]
27
+ spec.files += Dir.glob("lib/**/*.rb")
28
+ spec.files += Dir.glob("doc/text/*")
29
+ spec.test_files += Dir.glob("test/**/*")
30
+ spec.extensions = ["dependency-check/Rakefile"]
31
+
32
+ spec.add_runtime_dependency("gobject-introspection")
33
+
34
+ spec.add_development_dependency("bundler")
35
+ spec.add_development_dependency("rake")
36
+ spec.add_development_dependency("test-unit")
37
+ spec.add_development_dependency("packnga")
38
+ spec.add_development_dependency("kramdown")
39
+ end
@@ -0,0 +1,5 @@
1
+ require "cv"
2
+
3
+ require_relative "helper/fixture"
4
+
5
+ require "test-unit"
@@ -0,0 +1,7 @@
1
+ module Helper
2
+ module Fixture
3
+ def fixture_path(*components)
4
+ Pathname.new(__dir__).join("..", "fixture").join(*components)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $VERBOSE = true
4
+
5
+ require "pathname"
6
+
7
+ base_dir = Pathname.new(__dir__).parent.expand_path
8
+
9
+ lib_dir = base_dir + "lib"
10
+ test_dir = base_dir + "test"
11
+
12
+ $LOAD_PATH.unshift(lib_dir.to_s)
13
+
14
+ require_relative "helper"
15
+
16
+ exit(Test::Unit::AutoRunner.run(true, test_dir.to_s))
@@ -0,0 +1,10 @@
1
+ class TestImage < Test::Unit::TestCase
2
+ include Helper::Fixture
3
+
4
+ def test_read
5
+ image = CV::Image.read(fixture_path("mail-forward.png"))
6
+ assert do
7
+ not image.empty?
8
+ end
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: red-opencv
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kouhei Sutou
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-06-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gobject-introspection
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: packnga
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: kramdown
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: "[OpenCV][opencv] is a computer vision library."
98
+ email:
99
+ - kou@clear-code.com
100
+ executables: []
101
+ extensions:
102
+ - dependency-check/Rakefile
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".yardopts"
106
+ - Gemfile
107
+ - LICENSE
108
+ - README.md
109
+ - Rakefile
110
+ - dependency-check/Rakefile
111
+ - lib/cv.rb
112
+ - lib/cv/image.rb
113
+ - lib/cv/loader.rb
114
+ - lib/cv/version.rb
115
+ - red-opencv.gemspec
116
+ - test/fixture/mail-forward.png
117
+ - test/helper.rb
118
+ - test/helper/fixture.rb
119
+ - test/run-test.rb
120
+ - test/test-image.rb
121
+ homepage: https://github.com/red-data-tools/red-opencv
122
+ licenses:
123
+ - BSD-3-Clause
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.7.6
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Red OpenCV is a Ruby bindings of OpenCV. Red OpenCV is based on GObject Introspection.
145
+ test_files:
146
+ - test/fixture/mail-forward.png
147
+ - test/test-image.rb
148
+ - test/helper.rb
149
+ - test/run-test.rb
150
+ - test/helper/fixture.rb