Class: Google::Cloud::Vision::Annotation::Face::Features::Eyes

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

Overview

Eyes

The landmarks of the eyes in the features of a face.

Left and right are defined from the vantage of the viewer of the image, without considering mirror projections typical of photos. So face.features.eyes.left typically is the person's right eye.

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

Examples:

require "google/cloud/vision"

vision = Google::Cloud::Vision.new

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

eyes = face.features.eyes

right_eye = eyes.right
right_eye.pupil
#<Landmark (x: 256.63464, y: 79.641411, z: -6.0731235)>

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#leftEye (readonly)

The left eye.

Returns:

  • (Eye)

    the current value of left



963
964
965
# File 'lib/google/cloud/vision/annotation/face.rb', line 963

def left
  @left
end

#rightEye (readonly)

The right eye.

Returns:

  • (Eye)

    the current value of right



963
964
965
# File 'lib/google/cloud/vision/annotation/face.rb', line 963

def right
  @right
end

Instance Method Details

#to_aArray

Returns the object's property values as an array.

Returns:

  • (Array)


978
979
980
# File 'lib/google/cloud/vision/annotation/face.rb', line 978

def to_a
  [left, right]
end

#to_hHash

Deeply converts object to a hash. All keys will be symbolized.

Returns:

  • (Hash)


987
988
989
# File 'lib/google/cloud/vision/annotation/face.rb', line 987

def to_h
  { left: left.to_h, right: right.to_h }
end