Class: Sightengine::Api::FaceAttributes::Face
- Inherits:
-
Object
- Object
- Sightengine::Api::FaceAttributes::Face
- Defined in:
- lib/sightengine/api/face_attributes.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#features ⇒ Object
Returns the value of attribute features.
-
#x1 ⇒ Object
Returns the value of attribute x1.
-
#x2 ⇒ Object
Returns the value of attribute x2.
-
#y1 ⇒ Object
Returns the value of attribute y1.
-
#y2 ⇒ Object
Returns the value of attribute y2.
Instance Method Summary collapse
- #coordinates ⇒ Object
- #female?(min_prob = 0.8) ⇒ Boolean
-
#initialize(hash) ⇒ Face
constructor
A new instance of Face.
- #male?(min_prob = 0.8) ⇒ Boolean
- #minor?(min_prob = 0.8) ⇒ Boolean
- #sunglasses?(min_prob = 0.8) ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ Face
Returns a new instance of Face.
9 10 11 12 13 |
# File 'lib/sightengine/api/face_attributes.rb', line 9 def initialize(hash) hash.each do |k, v| send("#{k}=", v) end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/sightengine/api/face_attributes.rb', line 7 def attributes @attributes end |
#features ⇒ Object
Returns the value of attribute features.
6 7 8 |
# File 'lib/sightengine/api/face_attributes.rb', line 6 def features @features end |
#x1 ⇒ Object
Returns the value of attribute x1.
5 6 7 |
# File 'lib/sightengine/api/face_attributes.rb', line 5 def x1 @x1 end |
#x2 ⇒ Object
Returns the value of attribute x2.
5 6 7 |
# File 'lib/sightengine/api/face_attributes.rb', line 5 def x2 @x2 end |
#y1 ⇒ Object
Returns the value of attribute y1.
5 6 7 |
# File 'lib/sightengine/api/face_attributes.rb', line 5 def y1 @y1 end |
#y2 ⇒ Object
Returns the value of attribute y2.
5 6 7 |
# File 'lib/sightengine/api/face_attributes.rb', line 5 def y2 @y2 end |
Instance Method Details
#coordinates ⇒ Object
15 16 17 |
# File 'lib/sightengine/api/face_attributes.rb', line 15 def coordinates [x1, y1, x2, y2] end |
#female?(min_prob = 0.8) ⇒ Boolean
19 20 21 |
# File 'lib/sightengine/api/face_attributes.rb', line 19 def female?(min_prob = 0.8) attributes["female"].to_f > min_prob end |
#male?(min_prob = 0.8) ⇒ Boolean
23 24 25 |
# File 'lib/sightengine/api/face_attributes.rb', line 23 def male?(min_prob = 0.8) attributes["male"].to_f > min_prob end |
#minor?(min_prob = 0.8) ⇒ Boolean
27 28 29 |
# File 'lib/sightengine/api/face_attributes.rb', line 27 def minor?(min_prob = 0.8) attributes["minor"].to_f > min_prob end |
#sunglasses?(min_prob = 0.8) ⇒ Boolean
31 32 33 |
# File 'lib/sightengine/api/face_attributes.rb', line 31 def sunglasses?(min_prob = 0.8) attributes["minor"].to_f > min_prob end |