paperclip-facecrop 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/opencv_ext.rb +13 -0
- data/lib/paperclip-facecrop.rb +2 -1
- data/paperclip-facecrop.gemspec +1 -1
- metadata +3 -3
data/lib/opencv_ext.rb
CHANGED
@@ -11,6 +11,19 @@ class OpenCV::CvAvgComp
|
|
11
11
|
return false
|
12
12
|
end
|
13
13
|
|
14
|
+
def >(comp)
|
15
|
+
self.area > comp.area
|
16
|
+
end
|
17
|
+
|
18
|
+
def <(comp)
|
19
|
+
self.area < comp.area
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def area
|
24
|
+
return self.width * self.height
|
25
|
+
end
|
26
|
+
|
14
27
|
def to_s
|
15
28
|
"#{self.x},#{self.y}-#{self.width}x#{self.height}"
|
16
29
|
end
|
data/lib/paperclip-facecrop.rb
CHANGED
@@ -26,7 +26,8 @@ module Paperclip
|
|
26
26
|
|
27
27
|
faces_regions.reject! do |face_region|
|
28
28
|
region = faces_parts_regions.detect do |part_region|
|
29
|
-
|
29
|
+
# part of a face can't be bigger than the face itself
|
30
|
+
face_region.collide?(part_region) && face_region > part_region
|
30
31
|
end
|
31
32
|
|
32
33
|
region.nil?
|
data/paperclip-facecrop.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "paperclip-facecrop"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.6"
|
7
7
|
s.authors = ["Borja Martín"]
|
8
8
|
s.description = %q{Paperclip processor that is aware of the faces detected on the image so that they don't get cropped or aren't shown too small while generating the thumbnails}
|
9
9
|
s.summary = %q{Paperclip processor that is aware of the faces found on the image}
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Borja Mart\xC3\xADn"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-05-
|
17
|
+
date: 2011-05-12 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|