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

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

Overview

# Lips

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

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

lips = face.features.lips

lips.top
#=> #<Landmark (x: 228.54768, y: 143.2952, z: -5.6550336)>

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(top, bottom) ⇒ Lips

Returns a new instance of Lips.



1115
1116
1117
1118
# File 'lib/google/cloud/vision/annotation/face.rb', line 1115

def initialize top, bottom
  @top = top
  @bottom = bottom
end

Instance Attribute Details

#bottomLandmark (readonly) Also known as: lower

The lower lip.

Returns:

  • (Landmark)

    the current value of bottom



1107
1108
1109
# File 'lib/google/cloud/vision/annotation/face.rb', line 1107

def bottom
  @bottom
end

#topLandmark (readonly) Also known as: upper

The upper lip.

Returns:

  • (Landmark)

    the current value of top



1107
1108
1109
# File 'lib/google/cloud/vision/annotation/face.rb', line 1107

def top
  @top
end

Instance Method Details

#inspectObject



1144
1145
1146
# File 'lib/google/cloud/vision/annotation/face.rb', line 1144

def inspect
  "#<Lips #{self}>"
end

#to_aArray

Returns the object’s property values as an array.

Returns:

  • (Array)


1125
1126
1127
# File 'lib/google/cloud/vision/annotation/face.rb', line 1125

def to_a
  [top, bottom]
end

#to_hHash

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

Returns:

  • (Hash)


1134
1135
1136
# File 'lib/google/cloud/vision/annotation/face.rb', line 1134

def to_h
  { top: top.to_h, bottom: bottom.to_h }
end

#to_sObject



1139
1140
1141
# File 'lib/google/cloud/vision/annotation/face.rb', line 1139

def to_s
  "(top: #{top.inspect}, bottom: #{bottom.inspect})"
end