Class: Gcloud::Vision::Annotation::Face
- Inherits:
-
Object
- Object
- Gcloud::Vision::Annotation::Face
- Defined in:
- lib/gcloud/vision/annotation/face.rb
Overview
Defined Under Namespace
Classes: Angles, Bounds, Features, Likelihood
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#angles ⇒ Angles
The angles of the face, including roll, yaw, and pitch.
-
#bounds ⇒ Bounds
The bounds of the face, including the polygons for the head and face.
-
#confidence ⇒ Float
The confidence of the facial detection.
-
#features ⇒ Features
The landmarks of the face, including the points for the eyes, ears, nose and mouth.
-
#initialize ⇒ Face
constructor
A new instance of Face.
- #inspect ⇒ Object
-
#likelihood ⇒ Likelihood
The likelihood of the facial detection, including joy, sorrow, anger, surprise, under_exposed, blurred, and headwear.
-
#to_h ⇒ Hash
Deeply converts object to a hash.
-
#to_hash ⇒ Hash
Deeply converts object to a hash.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Face
Returns a new instance of Face.
46 47 48 |
# File 'lib/gcloud/vision/annotation/face.rb', line 46 def initialize @gapi = {} end |
Instance Attribute Details
#gapi ⇒ Object
42 43 44 |
# File 'lib/gcloud/vision/annotation/face.rb', line 42 def gapi @gapi end |
Class Method Details
.from_gapi(gapi) ⇒ Object
129 130 131 |
# File 'lib/gcloud/vision/annotation/face.rb', line 129 def self.from_gapi gapi new.tap { |f| f.instance_variable_set :@gapi, gapi } end |
Instance Method Details
#angles ⇒ Angles
The angles of the face, including roll, yaw, and pitch.
55 56 57 |
# File 'lib/gcloud/vision/annotation/face.rb', line 55 def angles @angles ||= Angles.from_gapi @gapi end |
#bounds ⇒ Bounds
The bounds of the face, including the polygons for the head and face.
64 65 66 |
# File 'lib/gcloud/vision/annotation/face.rb', line 64 def bounds @bounds ||= Bounds.from_gapi @gapi end |
#confidence ⇒ Float
The confidence of the facial detection.
93 94 95 |
# File 'lib/gcloud/vision/annotation/face.rb', line 93 def confidence @gapi.detection_confidence end |
#features ⇒ Features
The landmarks of the face, including the points for the eyes, ears, nose and mouth.
74 75 76 |
# File 'lib/gcloud/vision/annotation/face.rb', line 74 def features @features ||= Features.from_gapi @gapi end |
#inspect ⇒ Object
123 124 125 |
# File 'lib/gcloud/vision/annotation/face.rb', line 123 def inspect "#<#{self.class.name} #{self}>" end |
#likelihood ⇒ Likelihood
The likelihood of the facial detection, including joy, sorrow, anger, surprise, under_exposed, blurred, and headwear.
84 85 86 |
# File 'lib/gcloud/vision/annotation/face.rb', line 84 def likelihood @likelihood ||= Likelihood.from_gapi @gapi end |
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
102 103 104 |
# File 'lib/gcloud/vision/annotation/face.rb', line 102 def to_h to_hash end |
#to_hash ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
111 112 113 114 |
# File 'lib/gcloud/vision/annotation/face.rb', line 111 def to_hash { angles: angles.to_h, bounds: bounds.to_h, features: features.to_h, likelihood: likelihood.to_h } end |
#to_s ⇒ Object
117 118 119 120 |
# File 'lib/gcloud/vision/annotation/face.rb', line 117 def to_s # Keep console output low by not showing all sub-objects. "(angles, bounds, features, likelihood)" end |