Class: Google::Cloud::Vision::Annotation::Face::Angles

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/vision/annotation/face.rb

Overview

Angles

The orientation of the face relative to the image.

See Google::Cloud::Vision::Annotation::Face.

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
vision = gcloud.vision

image = vision.image "path/to/face.jpg"
face = image.face

face.angles.roll #=> -5.1492119
face.angles.yaw #=> -4.0695682
face.angles.pitch #=> -13.083284

Instance Method Summary collapse

Instance Method Details

#pitchFloat Also known as: tilt

Pitch (tilt) angle. Indicates the upwards/downwards angle that the face is pointing relative to the image's horizontal plane.

Returns:

  • (Float)

    A value in the range [-180,180].



186
187
188
# File 'lib/google/cloud/vision/annotation/face.rb', line 186

def pitch
  @gapi.tilt_angle
end

#rollFloat

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.

Returns:

  • (Float)

    A value in the range [-180,180].



164
165
166
# File 'lib/google/cloud/vision/annotation/face.rb', line 164

def roll
  @gapi.roll_angle
end

#to_aArray

Returns the object's property values as an array.

Returns:

  • (Array)


196
197
198
# File 'lib/google/cloud/vision/annotation/face.rb', line 196

def to_a
  [roll, yaw, pitch]
end

#to_hHash

Converts object to a hash. All keys will be symbolized.

Returns:

  • (Hash)


205
206
207
# File 'lib/google/cloud/vision/annotation/face.rb', line 205

def to_h
  { roll: roll, yaw: yaw, pitch: pitch }
end

#yawFloat 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.

Returns:

  • (Float)

    A value in the range [-180,180].



175
176
177
# File 'lib/google/cloud/vision/annotation/face.rb', line 175

def yaw
  @gapi.pan_angle
end