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

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

Overview

# Chin

The landmarks of the chin 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

chin = face.features.chin

chin.center
#=> #<Landmark (x: 233.21977, y: 189.47475, z: 19.487228)>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, center, right) ⇒ Chin

Returns a new instance of Chin.



683
684
685
686
687
# File 'lib/google/cloud/vision/annotation/face.rb', line 683

def initialize left, center, right
  @left   = left
  @center = center
  @right  = right
end

Instance Attribute Details

#centerLandmark (readonly)

The chin, gnathion.

Returns:

  • (Landmark)

    the current value of center



678
679
680
# File 'lib/google/cloud/vision/annotation/face.rb', line 678

def center
  @center
end

#leftLandmark (readonly)

The chin, left gonion.

Returns:

  • (Landmark)

    the current value of left



678
679
680
# File 'lib/google/cloud/vision/annotation/face.rb', line 678

def left
  @left
end

#rightLandmark (readonly)

The chin, right gonion.

Returns:

  • (Landmark)

    the current value of right



678
679
680
# File 'lib/google/cloud/vision/annotation/face.rb', line 678

def right
  @right
end

Instance Method Details

#inspectObject



714
715
716
# File 'lib/google/cloud/vision/annotation/face.rb', line 714

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

#to_aArray

Returns the object’s property values as an array.

Returns:

  • (Array)


694
695
696
# File 'lib/google/cloud/vision/annotation/face.rb', line 694

def to_a
  [left, center, right]
end

#to_hHash

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

Returns:

  • (Hash)


703
704
705
# File 'lib/google/cloud/vision/annotation/face.rb', line 703

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

#to_sObject



708
709
710
711
# File 'lib/google/cloud/vision/annotation/face.rb', line 708

def to_s
  format "(left: %s, center: %s, right: %s)", left.inspect,
         center.inspect, right.inspect
end