eikon 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +0 -0
- data/.github/workflows/main.yml +27 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +57 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +183 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/tapioca +27 -0
- data/eikon-0.1.0.gem +0 -0
- data/eikon.gemspec +34 -0
- data/lib/eikon/comparator.rb +17 -0
- data/lib/eikon/image_processor.rb +48 -0
- data/lib/eikon/version.rb +4 -0
- data/lib/eikon/video_processor.rb +72 -0
- data/lib/eikon.rb +35 -0
- data/sorbet/config +2 -0
- data/sorbet/rbi/gems/byebug.rbi +1041 -0
- data/sorbet/rbi/gems/climate_control.rbi +46 -0
- data/sorbet/rbi/gems/coderay.rbi +92 -0
- data/sorbet/rbi/gems/eikon.rbi +21 -0
- data/sorbet/rbi/gems/ffi.rbi +560 -0
- data/sorbet/rbi/gems/method_source.rbi +64 -0
- data/sorbet/rbi/gems/minitest.rbi +422 -0
- data/sorbet/rbi/gems/pry.rbi +1949 -0
- data/sorbet/rbi/gems/rake.rbi +645 -0
- data/sorbet/rbi/gems/ruby-vips.rbi +656 -0
- data/sorbet/rbi/gems/ruby_jard.rbi +681 -0
- data/sorbet/rbi/gems/terrapin.rbi +116 -0
- data/sorbet/rbi/gems/tty-screen.rbi +66 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +34134 -0
- data/sorbet/rbi/hidden-definitions/hidden.rbi +17393 -0
- data/sorbet/rbi/sorbet-typed/lib/actionpack/all/actionpack.rbi +1138 -0
- data/sorbet/rbi/sorbet-typed/lib/actionview/all/actionview.rbi +408 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6/activesupport.rbi +37 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1850 -0
- data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +108 -0
- data/sorbet/rbi/sorbet-typed/lib/railties/>=6.1/railties.rbi +15 -0
- data/sorbet/rbi/sorbet-typed/lib/railties/all/railties.rbi +110 -0
- data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +276 -0
- data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +645 -0
- data/sorbet/rbi/sorbet-typed/lib/rubocop/>=1.8/rubocop.rbi +12 -0
- data/sorbet/rbi/sorbet-typed/lib/rubocop-performance/~>1.6/rubocop-performance.rbi +149 -0
- data/sorbet/rbi/sorbet-typed/lib/rubocop-rails/~>2.5/rubocop-rails.rbi +328 -0
- data/sorbet/rbi/sorbet-typed/lib/thor/all/thor.rbi +905 -0
- data/sorbet/rbi/sorbet-typed/lib/yard/all/yard.rbi +32 -0
- data/sorbet/rbi/todo.rbi +15 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 36e8f745d6f84055279d0d9adf4b76a5b7e6648ce38734f2827731eea2645edf
|
4
|
+
data.tar.gz: 99f6ff6e356b12111e3727cd177f86394ec0b71152da5424a9abf070c4fb2fb5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 12b9fe397af70be1011ecbd5ef8496f92002000baa11d5c3d8bfb667788d55243e25faf87d6f5285b3b11be1d7754be8552f5cf35b75e3de941760cfdc2addb4
|
7
|
+
data.tar.gz: 355edc37cd034eed86209ad6ea97d2d58727997bc049ae278a3ebb9a40e490a6547a88e9bee8a53d278260298f49de6c7cd1a94d242713d87490081055af85b4
|
data/.gitattributes
ADDED
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push,pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
lint:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 3.1.1
|
14
|
+
bundler-cache: true
|
15
|
+
- name: Lint with Rubocop
|
16
|
+
run: bundle exec rubocop
|
17
|
+
type-check:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: 3.1.1
|
25
|
+
bundler-cache: true
|
26
|
+
- name: Type check with Sorbet
|
27
|
+
run: bundle exec srb tc --ignore "/vendor"
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rails
|
3
|
+
- rubocop-performance
|
4
|
+
|
5
|
+
inherit_gem:
|
6
|
+
rubocop-rails_config:
|
7
|
+
- config/rails.yml
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
Exclude:
|
11
|
+
- db/schema.rb
|
12
|
+
- 'node_modules/**/*'
|
13
|
+
- 'redis-stable/**/*'
|
14
|
+
- 'bin/**/*'
|
15
|
+
- 'vendor/**/*'
|
16
|
+
TargetRubyVersion: 3.1
|
17
|
+
|
18
|
+
# This sets us to use the standard Rails format instead of Rubocop's
|
19
|
+
# opinionated Ruby style.
|
20
|
+
Style/FrozenStringLiteralComment:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# This sets us to use the standard Rails format instead of Rubocop's
|
24
|
+
# opinionated Ruby style.
|
25
|
+
Style/ClassAndModuleChildren:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
# Temporarily turn this off
|
29
|
+
Metrics/AbcSize:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Metrics/ClassLength:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Lint/RescueException:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
Lint/Debugger:
|
39
|
+
Enabled: true
|
40
|
+
|
41
|
+
Rails/HasManyOrHasOneDependent:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
Rails/HasAndBelongsToMany:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
Style/NumericPredicate:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
Style/HashSyntax:
|
51
|
+
EnforcedShorthandSyntax: 'never'
|
52
|
+
|
53
|
+
# This sets us to use the standard Rails format instead of Rubocop's
|
54
|
+
# opinionated Ruby style.
|
55
|
+
Layout/EmptyLinesAroundAccessModifier:
|
56
|
+
Enabled: true
|
57
|
+
EnforcedStyle: 'around'
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at cguess@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in eikón.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem "rake", "~> 12.0"
|
7
|
+
gem "minitest", "~> 5.0"
|
8
|
+
gem "ruby-vips"
|
9
|
+
gem "byebug"
|
10
|
+
gem "ruby_jard"
|
11
|
+
|
12
|
+
gem "rubocop", "~> 1.27", require: false
|
13
|
+
gem "rubocop-rails", require: false # Rails specific styles
|
14
|
+
gem "rubocop-rails_config", require: false # More Rails stuff
|
15
|
+
|
16
|
+
gem "sorbet-static-and-runtime"
|
17
|
+
|
18
|
+
group :development do
|
19
|
+
gem "tapioca", require: false
|
20
|
+
end
|
21
|
+
|
22
|
+
gem "terrapin"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
eikon (0.1.1)
|
5
|
+
ruby-vips (~> 2.1)
|
6
|
+
sorbet-runtime (>= 0.5.9204)
|
7
|
+
terrapin (~> 0.6.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actionpack (7.0.2.3)
|
13
|
+
actionview (= 7.0.2.3)
|
14
|
+
activesupport (= 7.0.2.3)
|
15
|
+
rack (~> 2.0, >= 2.2.0)
|
16
|
+
rack-test (>= 0.6.3)
|
17
|
+
rails-dom-testing (~> 2.0)
|
18
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
19
|
+
actionview (7.0.2.3)
|
20
|
+
activesupport (= 7.0.2.3)
|
21
|
+
builder (~> 3.1)
|
22
|
+
erubi (~> 1.4)
|
23
|
+
rails-dom-testing (~> 2.0)
|
24
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
25
|
+
activesupport (7.0.2.3)
|
26
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
|
+
i18n (>= 1.6, < 2)
|
28
|
+
minitest (>= 5.1)
|
29
|
+
tzinfo (~> 2.0)
|
30
|
+
ast (2.4.2)
|
31
|
+
builder (3.2.4)
|
32
|
+
byebug (11.1.3)
|
33
|
+
climate_control (0.2.0)
|
34
|
+
coderay (1.1.3)
|
35
|
+
concurrent-ruby (1.1.10)
|
36
|
+
crass (1.0.6)
|
37
|
+
diff-lcs (1.5.0)
|
38
|
+
erubi (1.10.0)
|
39
|
+
ffi (1.15.5)
|
40
|
+
i18n (1.10.0)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
loofah (2.16.0)
|
43
|
+
crass (~> 1.0.2)
|
44
|
+
nokogiri (>= 1.5.9)
|
45
|
+
method_source (1.0.0)
|
46
|
+
mini_portile2 (2.8.0)
|
47
|
+
minitest (5.15.0)
|
48
|
+
nokogiri (1.13.4)
|
49
|
+
mini_portile2 (~> 2.8.0)
|
50
|
+
racc (~> 1.4)
|
51
|
+
parallel (1.22.1)
|
52
|
+
parser (3.1.2.0)
|
53
|
+
ast (~> 2.4.1)
|
54
|
+
pry (0.13.1)
|
55
|
+
coderay (~> 1.1)
|
56
|
+
method_source (~> 1.0)
|
57
|
+
racc (1.6.0)
|
58
|
+
rack (2.2.3)
|
59
|
+
rack-test (1.1.0)
|
60
|
+
rack (>= 1.0, < 3)
|
61
|
+
rails-dom-testing (2.0.3)
|
62
|
+
activesupport (>= 4.2.0)
|
63
|
+
nokogiri (>= 1.6)
|
64
|
+
rails-html-sanitizer (1.4.2)
|
65
|
+
loofah (~> 2.3)
|
66
|
+
railties (7.0.2.3)
|
67
|
+
actionpack (= 7.0.2.3)
|
68
|
+
activesupport (= 7.0.2.3)
|
69
|
+
method_source
|
70
|
+
rake (>= 12.2)
|
71
|
+
thor (~> 1.0)
|
72
|
+
zeitwerk (~> 2.5)
|
73
|
+
rainbow (3.1.1)
|
74
|
+
rake (12.3.3)
|
75
|
+
rbi (0.0.14)
|
76
|
+
ast
|
77
|
+
parser (>= 2.6.4.0)
|
78
|
+
sorbet-runtime (>= 0.5.9204)
|
79
|
+
unparser
|
80
|
+
regexp_parser (2.3.0)
|
81
|
+
rexml (3.2.5)
|
82
|
+
rubocop (1.27.0)
|
83
|
+
parallel (~> 1.10)
|
84
|
+
parser (>= 3.1.0.0)
|
85
|
+
rainbow (>= 2.2.2, < 4.0)
|
86
|
+
regexp_parser (>= 1.8, < 3.0)
|
87
|
+
rexml
|
88
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
89
|
+
ruby-progressbar (~> 1.7)
|
90
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
91
|
+
rubocop-ast (1.17.0)
|
92
|
+
parser (>= 3.1.1.0)
|
93
|
+
rubocop-minitest (0.19.1)
|
94
|
+
rubocop (>= 0.90, < 2.0)
|
95
|
+
rubocop-packaging (0.5.1)
|
96
|
+
rubocop (>= 0.89, < 2.0)
|
97
|
+
rubocop-performance (1.13.3)
|
98
|
+
rubocop (>= 1.7.0, < 2.0)
|
99
|
+
rubocop-ast (>= 0.4.0)
|
100
|
+
rubocop-rails (2.14.2)
|
101
|
+
activesupport (>= 4.2.0)
|
102
|
+
rack (>= 1.1)
|
103
|
+
rubocop (>= 1.7.0, < 2.0)
|
104
|
+
rubocop-rails_config (1.9.2)
|
105
|
+
railties (>= 5.0)
|
106
|
+
rubocop (>= 1.25.1)
|
107
|
+
rubocop-ast (>= 1.0.1)
|
108
|
+
rubocop-minitest (~> 0.15)
|
109
|
+
rubocop-packaging (~> 0.5)
|
110
|
+
rubocop-performance (~> 1.11)
|
111
|
+
rubocop-rails (~> 2.0)
|
112
|
+
ruby-progressbar (1.11.0)
|
113
|
+
ruby-vips (2.1.4)
|
114
|
+
ffi (~> 1.12)
|
115
|
+
ruby_jard (0.3.1)
|
116
|
+
byebug (>= 9.1, < 12.0)
|
117
|
+
pry (~> 0.13.0)
|
118
|
+
tty-screen (~> 0.8.1)
|
119
|
+
sorbet (0.5.9905)
|
120
|
+
sorbet-static (= 0.5.9905)
|
121
|
+
sorbet-runtime (0.5.9905)
|
122
|
+
sorbet-static (0.5.9905-universal-darwin-14)
|
123
|
+
sorbet-static (0.5.9905-universal-darwin-15)
|
124
|
+
sorbet-static (0.5.9905-universal-darwin-16)
|
125
|
+
sorbet-static (0.5.9905-universal-darwin-17)
|
126
|
+
sorbet-static (0.5.9905-universal-darwin-18)
|
127
|
+
sorbet-static (0.5.9905-universal-darwin-19)
|
128
|
+
sorbet-static (0.5.9905-universal-darwin-20)
|
129
|
+
sorbet-static (0.5.9905-universal-darwin-21)
|
130
|
+
sorbet-static (0.5.9905-x86_64-linux)
|
131
|
+
sorbet-static-and-runtime (0.5.9905)
|
132
|
+
sorbet (= 0.5.9905)
|
133
|
+
sorbet-runtime (= 0.5.9905)
|
134
|
+
spoom (1.1.11)
|
135
|
+
sorbet (>= 0.5.9204)
|
136
|
+
sorbet-runtime (>= 0.5.9204)
|
137
|
+
thor (>= 0.19.2)
|
138
|
+
tapioca (0.7.1)
|
139
|
+
bundler (>= 1.17.3)
|
140
|
+
pry (>= 0.12.2)
|
141
|
+
rbi (~> 0.0.0, >= 0.0.14)
|
142
|
+
sorbet-runtime (>= 0.5.9204)
|
143
|
+
sorbet-static (>= 0.5.9204)
|
144
|
+
spoom (~> 1.1.0, >= 1.1.4)
|
145
|
+
thor (>= 1.2.0)
|
146
|
+
yard-sorbet
|
147
|
+
terrapin (0.6.0)
|
148
|
+
climate_control (>= 0.0.3, < 1.0)
|
149
|
+
thor (1.2.1)
|
150
|
+
tty-screen (0.8.1)
|
151
|
+
tzinfo (2.0.4)
|
152
|
+
concurrent-ruby (~> 1.0)
|
153
|
+
unicode-display_width (2.1.0)
|
154
|
+
unparser (0.6.5)
|
155
|
+
diff-lcs (~> 1.3)
|
156
|
+
parser (>= 3.1.0)
|
157
|
+
webrick (1.7.0)
|
158
|
+
yard (0.9.27)
|
159
|
+
webrick (~> 1.7.0)
|
160
|
+
yard-sorbet (0.6.1)
|
161
|
+
sorbet-runtime (>= 0.5)
|
162
|
+
yard (>= 0.9)
|
163
|
+
zeitwerk (2.5.4)
|
164
|
+
|
165
|
+
PLATFORMS
|
166
|
+
ruby
|
167
|
+
|
168
|
+
DEPENDENCIES
|
169
|
+
byebug
|
170
|
+
eikon!
|
171
|
+
minitest (~> 5.0)
|
172
|
+
rake (~> 12.0)
|
173
|
+
rubocop (~> 1.27)
|
174
|
+
rubocop-rails
|
175
|
+
rubocop-rails_config
|
176
|
+
ruby-vips
|
177
|
+
ruby_jard
|
178
|
+
sorbet-static-and-runtime
|
179
|
+
tapioca
|
180
|
+
terrapin
|
181
|
+
|
182
|
+
BUNDLED WITH
|
183
|
+
2.3.11
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Christopher Guess
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Eikón
|
2
|
+
|
3
|
+
This is an implementation of the DHash image matching algorithm in pure Ruby, as described here
|
4
|
+
https://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html. Its main use is reverse
|
5
|
+
image searching.
|
6
|
+
|
7
|
+
This library is fully types in Sorbet.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
This gem requires [libvips](https://www.libvips.org) for image processing and [ffmpeg](https://ffmpeg.org) for video work. On MacOS you can install them using [HomeBrew](https://brew.sh) quite easily. On Linux your distro's package manager should have them. On Windows it's probably more difficult, but I don't have access to a machine to test that.
|
12
|
+
|
13
|
+
Once both libraries are installed you can install the gem with one of the following methods:
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'eikon'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle install
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install eikon
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
To process a still image and get a DHash
|
32
|
+
`Eikon.dhash_for_image("./test/images/00001.jpg")`
|
33
|
+
|
34
|
+
To process a video and get an array of DHashes:
|
35
|
+
`Eikon.dhash_for_video("./test/videos/pexels-ron-lach-7121125.mp4")`
|
36
|
+
|
37
|
+
## Development
|
38
|
+
|
39
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
40
|
+
|
41
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/eikon. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/eikon/blob/master/CODE_OF_CONDUCT.md).
|
46
|
+
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
51
|
+
|
52
|
+
## Code of Conduct
|
53
|
+
|
54
|
+
Everyone interacting in the Eikon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/eikon/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "eikon"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/tapioca
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'tapioca' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("tapioca", "tapioca")
|
data/eikon-0.1.0.gem
ADDED
Binary file
|
data/eikon.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative "lib/eikon/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "eikon"
|
5
|
+
spec.version = Eikon::VERSION
|
6
|
+
spec.authors = ["Christopher Guess"]
|
7
|
+
spec.email = ["cguess@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "A small pure-Ruby (for now) implementation of DHash"
|
10
|
+
spec.description = "A small pure-Ruby (for now) implementation of DHash"
|
11
|
+
spec.homepage = "https://www.github.com/cguess/eikon"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://www.github.com/cguess/eikon"
|
19
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
|
24
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_runtime_dependency "ruby-vips", "~> 2.1"
|
32
|
+
spec.add_runtime_dependency "terrapin", "~> 0.6.0"
|
33
|
+
spec.add_runtime_dependency "sorbet-runtime", ">= 0.5.9204"
|
34
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# typed: strict
|
2
|
+
require "sorbet-runtime"
|
3
|
+
|
4
|
+
module Eikon
|
5
|
+
class Comparator
|
6
|
+
extend T::Sig
|
7
|
+
sig { params(dhash_1: String, dhash_2: String).returns(Integer) }
|
8
|
+
def self.compare(dhash_1, dhash_2)
|
9
|
+
hamming_distance = 0
|
10
|
+
dhash_1.chars.each_with_index do |character, index|
|
11
|
+
hamming_distance += 1 if character != dhash_2.chars[index]
|
12
|
+
end
|
13
|
+
|
14
|
+
hamming_distance + (dhash_1.length - dhash_2.length).abs
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# typed: strict
|
2
|
+
require "sorbet-runtime"
|
3
|
+
|
4
|
+
module Eikon
|
5
|
+
class ImageProcessor
|
6
|
+
# This is an implementation of the algorithm described at http://hackerfactor.com/blog/index.php?/archives/529-Kind-of-Like-That.html
|
7
|
+
|
8
|
+
extend T::Sig
|
9
|
+
|
10
|
+
sig { returns(String) }
|
11
|
+
attr_reader :byte_array
|
12
|
+
|
13
|
+
sig { returns(String) }
|
14
|
+
attr_reader :filename
|
15
|
+
|
16
|
+
sig { params(filename: String).void }
|
17
|
+
def initialize(filename)
|
18
|
+
@filename = filename
|
19
|
+
@image = T.let(Vips::Image.new_from_file(filename), Vips::Image)
|
20
|
+
@byte_array = T.let("", String)
|
21
|
+
end
|
22
|
+
|
23
|
+
sig { returns(NilClass) }
|
24
|
+
def preprocess_image
|
25
|
+
# Black and white
|
26
|
+
@image = T.unsafe(@image).colourspace "b-w"
|
27
|
+
# For some reason thumbnail is only created via a buffer, so we save one quick
|
28
|
+
image_buffer = @image.write_to_buffer ".tiff"
|
29
|
+
# shrink image
|
30
|
+
@image = T.unsafe(Vips::Image).thumbnail_buffer(image_buffer, 9, height: 8, size: :force)
|
31
|
+
image_buffer = @image.write_to_buffer ".tiff"
|
32
|
+
@image = Vips::Image.new_from_buffer(image_buffer, "")
|
33
|
+
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
sig { returns(NilClass) }
|
38
|
+
def generate_byte_array
|
39
|
+
for y in 0..7 do
|
40
|
+
for x in 0..7 do
|
41
|
+
@byte_array += T.unsafe(@image).getpoint(x, y)[0] < T.unsafe(@image).getpoint((x + 1), y)[0] ? "1" : "0"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|