Class: Gcloud::Vision::Annotation::Face::Angles
- Inherits:
-
Object
- Object
- Gcloud::Vision::Annotation::Face::Angles
- Defined in:
- lib/gcloud/vision/annotation/face.rb
Overview
Instance Attribute Summary collapse
Class Method Summary collapse
-
.from_gapi(gapi) ⇒ Object
object.
Instance Method Summary collapse
-
#initialize ⇒ Angles
constructor
A new instance of Angles.
- #inspect ⇒ Object
-
#pitch ⇒ Float
(also: #tilt)
Pitch (tilt) angle.
-
#roll ⇒ Float
Roll angle.
-
#to_a ⇒ Array
Returns the object’s property values as an array.
-
#to_ary ⇒ Array
Returns the object’s property values as an array.
-
#to_h ⇒ Hash
Converts object to a hash.
-
#to_hash ⇒ Hash
Converts object to a hash.
- #to_s ⇒ Object
-
#yaw ⇒ Float
(also: #pan)
Yaw (pan) angle.
Constructor Details
#initialize ⇒ Angles
Returns a new instance of Angles.
160 161 162 |
# File 'lib/gcloud/vision/annotation/face.rb', line 160 def initialize @gapi = {} end |
Instance Attribute Details
#gapi ⇒ Object
156 157 158 |
# File 'lib/gcloud/vision/annotation/face.rb', line 156 def gapi @gapi end |
Class Method Details
.from_gapi(gapi) ⇒ Object
object.
248 249 250 |
# File 'lib/gcloud/vision/annotation/face.rb', line 248 def self.from_gapi gapi new.tap { |f| f.instance_variable_set :@gapi, gapi } end |
Instance Method Details
#inspect ⇒ Object
241 242 243 |
# File 'lib/gcloud/vision/annotation/face.rb', line 241 def inspect "#<Angles #{self}>" end |
#pitch ⇒ Float Also known as: tilt
Pitch (tilt) angle. Indicates the upwards/downwards angle that the face is pointing relative to the image’s horizontal plane.
193 194 195 |
# File 'lib/gcloud/vision/annotation/face.rb', line 193 def pitch @gapi["tiltAngle"] end |
#roll ⇒ Float
Roll angle. Indicates the amount of clockwise/anti-clockwise rotation of the face relative to the image vertical, about the axis perpendicular to the face.
171 172 173 |
# File 'lib/gcloud/vision/annotation/face.rb', line 171 def roll @gapi["rollAngle"] end |
#to_a ⇒ Array
Returns the object’s property values as an array.
203 204 205 |
# File 'lib/gcloud/vision/annotation/face.rb', line 203 def to_a to_ary end |
#to_ary ⇒ Array
Returns the object’s property values as an array.
212 213 214 |
# File 'lib/gcloud/vision/annotation/face.rb', line 212 def to_ary [roll, yaw, pitch] end |
#to_h ⇒ Hash
Converts object to a hash. All keys will be symbolized.
221 222 223 |
# File 'lib/gcloud/vision/annotation/face.rb', line 221 def to_h to_hash end |
#to_hash ⇒ Hash
Converts object to a hash. All keys will be symbolized.
230 231 232 |
# File 'lib/gcloud/vision/annotation/face.rb', line 230 def to_hash { roll: roll, yaw: yaw, pitch: pitch } end |
#to_s ⇒ Object
235 236 237 238 |
# File 'lib/gcloud/vision/annotation/face.rb', line 235 def to_s format "(roll: %s, yaw: %s, pitch: %s)", roll.inspect, yaw.inspect, pitch.inspect end |
#yaw ⇒ Float Also known as: pan
Yaw (pan) angle. Indicates the leftward/rightward angle that the face is pointing, relative to the vertical plane perpendicular to the image.
182 183 184 |
# File 'lib/gcloud/vision/annotation/face.rb', line 182 def yaw @gapi["panAngle"] end |