Class: Gcloud::Vision::Annotation::Face::Features::Ears

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

Overview

# Ears

The landmarks for the ear tragions.

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 Gcloud::Vision::Annotation::Face::Features and Gcloud::Vision::Annotation::Face.

Examples:

require "gcloud"

gcloud = Gcloud.new
vision = gcloud.vision

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

ears = face.features.ears
ears.right
#=> #<Landmark (x: 303.81198, y: 88.5782, z: 77.719193)>

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, right) ⇒ Ears

Returns a new instance of Ears.



848
849
850
851
# File 'lib/gcloud/vision/annotation/face.rb', line 848

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

Instance Attribute Details

#leftLandmark (readonly)

The left ear tragion.

Returns:

  • (Landmark)

    the current value of left



843
844
845
# File 'lib/gcloud/vision/annotation/face.rb', line 843

def left
  @left
end

#rightLandmark (readonly)

The right ear tragion.

Returns:

  • (Landmark)

    the current value of right



843
844
845
# File 'lib/gcloud/vision/annotation/face.rb', line 843

def right
  @right
end

Instance Method Details

#inspectObject



895
896
897
# File 'lib/gcloud/vision/annotation/face.rb', line 895

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

#to_aArray

Returns the object’s property values as an array.

Returns:

  • (Array)


858
859
860
# File 'lib/gcloud/vision/annotation/face.rb', line 858

def to_a
  to_ary
end

#to_aryArray

Returns the object’s property values as an array.

Returns:

  • (Array)


867
868
869
# File 'lib/gcloud/vision/annotation/face.rb', line 867

def to_ary
  [left, right]
end

#to_hHash

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

Returns:

  • (Hash)


876
877
878
# File 'lib/gcloud/vision/annotation/face.rb', line 876

def to_h
  to_hash
end

#to_hashHash

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

Returns:

  • (Hash)


885
886
887
# File 'lib/gcloud/vision/annotation/face.rb', line 885

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

#to_sObject



890
891
892
# File 'lib/gcloud/vision/annotation/face.rb', line 890

def to_s
  "(left: #{left.inspect}, right: #{right.inspect})"
end