morandi 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d118f4078309003e8bd209e5c48bb8ad8c941db5
4
- data.tar.gz: efb35e2dd6f24382283e8ca637224cc381b7997a
3
+ metadata.gz: 6509e684d2ddcb40e40bd4e354a61ce7f1e5bcc3
4
+ data.tar.gz: 415f941df4d9440901415f2906862ef7a8730721
5
5
  SHA512:
6
- metadata.gz: e0dde0ed3cdea1ad9457d2a7f4d0526d71d67966a7b7cc2cef37e8b8acfcf9d78e02dbd6a3ed4d5786a89c479c92636bdeb71c9405257287e778a2f961f6f0e7
7
- data.tar.gz: f0e581e193edf104e48eef1857c842bcc2ca0c8e28712a15e09ad6b23f4922ded337d0551072113b9b06cd788d7bccedbee7508717ec8e9cf06d5b90f99af13d
6
+ metadata.gz: 020dd16c067e38f99d80cf4b3429ca956ec5999f0e0cc8f7f7298e81c356640451ad54c09a698330b1b8e9976cc802625c10776a585574ea9da8c1706eef6da8
7
+ data.tar.gz: 76f2c80deafe8bea29fc8e5a38c953437a1b85c13de94377a9952fa9f1b6f1e6f2ef2a5db3b869d3e640818d25bd76934d26be6d38c35c25c97bef8a9ca75be7
@@ -263,35 +263,6 @@ class Gamma < ImageOp
263
263
  end
264
264
  end
265
265
 
266
- class RedEyeOp < ImageOp
267
- attr_reader :x1, :y1, :x2, :y2, :sensitivity, :no_eyes
268
- attr_accessor :order
269
- def initialize(x1, y1, x2, y2, sensitivity, no_eyes)
270
- super()
271
- require 'redeye'
272
- x1, x2 = x2, x1 if x1 > x2
273
- y1, y2 = y2, y1 if y1 > y2
274
- @x1, @y1, @x2, @y2, @sensitivity, @no_eyes =
275
- x1, y1, x2, y2, sensitivity, no_eyes
276
- end
277
- def call(image, pixbuf)
278
- @x2 = pixbuf.width if @x2 >= pixbuf.width
279
- @y2 = pixbuf.height if @y2 >= pixbuf.height
280
- @x1 = @x2 - 1 if @x1 >= @x2
281
- @y1 = @y2 - 1 if @y1 >= @y2
282
- redeye = ::RedEye.new(pixbuf.dup, @x1, @y1, @x2, @y2)
283
- blobs = redeye.identify_blobs(@sensitivity).reject { |i|
284
- i.noPixels < 2 or ! i.squareish?(0.5, 0.4)
285
- }.sort_by { |i| i.noPixels }
286
- biggest = blobs.size > @no_eyes ? blobs[-1 * @no_eyes..-1] : blobs
287
- biggest.each { |blob| redeye.correct_blob(blob.id) }
288
- redeye.pixbuf
289
- end
290
- def priority
291
- 20 + @order
292
- end
293
- end
294
-
295
266
  class Colourify < ImageOp
296
267
  attr_reader :op
297
268
  def initialize(op, alpha=255)
@@ -1,5 +1,14 @@
1
1
  require 'redeye'
2
2
 
3
+ module Morandi
4
+ module RedEye
5
+ # The parameter determines how many reddish pixels needs to be in the area to consider it a valid red eye
6
+ # The reason for its existence is to prevent the situations when the bigger red area causes an excessive correction
7
+ # e.g. continuous red eyeglasses frame or sunburnt person's skin around eyes forming an area
8
+ RED_AREA_DENSITY_THRESHOLD = 0.3
9
+ end
10
+ end
11
+
3
12
  module Morandi
4
13
  module RedEye
5
14
  module TapRedEye
@@ -14,20 +23,16 @@ module TapRedEye
14
23
  redeye = ::RedEye.new(pb, x1, y1, x2, y2)
15
24
 
16
25
  sensitivity = 2
17
- blobs = redeye.identify_blobs(sensitivity).reject { |i|
18
- i.noPixels < 4 or ! i.squareish?(0.5, 0.4)
19
- }.sort_by { |i|
20
- i.area_min_x = x1
21
- i.area_min_y = y1
26
+ blobs = redeye.identify_blobs(sensitivity).reject { |region|
27
+ region.noPixels < 4 || !region.squareish?(0.5, RED_AREA_DENSITY_THRESHOLD)
28
+ }.sort_by { |region|
29
+ region.area_min_x = x1
30
+ region.area_min_y = y1
22
31
 
23
32
  # Higher is better
24
- score = (i.noPixels) / (i.distance_from(x, y) ** 2)
33
+ score = (region.noPixels) / (region.distance_from(x, y) ** 2)
25
34
  }
26
35
 
27
- #blobs.each do |blob|
28
- # p [ [x, y], blob.centre(), blob.distance_from(x, y), blob]
29
- #end
30
-
31
36
  blob = blobs.last
32
37
  redeye.correct_blob(blob.id) if blob
33
38
  pb = redeye.pixbuf
@@ -1,3 +1,3 @@
1
1
  module Morandi
2
- VERSION = "0.10.2"
2
+ VERSION = '0.10.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morandi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - |+
@@ -11,146 +11,146 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-02-03 00:00:00.000000000 Z
14
+ date: 2018-10-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gtk2
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: gdk_pixbuf2
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '>='
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: cairo
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: pixbufutils
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - '>='
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: redeye
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: pango
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: colorscore
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - '>='
104
+ - - ">="
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  type: :runtime
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: bundler
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ~>
118
+ - - "~>"
119
119
  - !ruby/object:Gem::Version
120
120
  version: '1.5'
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ~>
125
+ - - "~>"
126
126
  - !ruby/object:Gem::Version
127
127
  version: '1.5'
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: rake
130
130
  requirement: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - '>='
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  type: :development
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - '>='
139
+ - - ">="
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: rspec
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - '>='
146
+ - - ">="
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  type: :development
150
150
  prerelease: false
151
151
  version_requirements: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - '>='
153
+ - - ">="
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  description: Apply simple edits to images
@@ -160,8 +160,8 @@ executables: []
160
160
  extensions: []
161
161
  extra_rdoc_files: []
162
162
  files:
163
- - .gitignore
164
- - .rspec
163
+ - ".gitignore"
164
+ - ".rspec"
165
165
  - Gemfile
166
166
  - LICENSE.txt
167
167
  - README.md
@@ -187,17 +187,17 @@ require_paths:
187
187
  - lib
188
188
  required_ruby_version: !ruby/object:Gem::Requirement
189
189
  requirements:
190
- - - '>='
190
+ - - ">="
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - '>='
195
+ - - ">="
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  requirements: []
199
199
  rubyforge_project:
200
- rubygems_version: 2.2.1
200
+ rubygems_version: 2.5.2.2
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Simple Image Edits