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

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

Overview

# Eyebrows

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

eyebrows = face.features.eyebrows

right_eyebrow = eyebrows.right
right_eyebrow.top
#=> #<Landmark (x: 256.3194, y: 58.222664, z: -17.299419)>

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, right) ⇒ Eyebrows

Returns a new instance of Eyebrows.



823
824
825
826
# File 'lib/google/cloud/vision/annotation/face.rb', line 823

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

Instance Attribute Details

#leftEyebrow (readonly)

The left eyebrow.

Returns:

  • (Eyebrow)

    the current value of left



818
819
820
# File 'lib/google/cloud/vision/annotation/face.rb', line 818

def left
  @left
end

#rightEyebrow (readonly)

The right eyebrow.

Returns:

  • (Eyebrow)

    the current value of right



818
819
820
# File 'lib/google/cloud/vision/annotation/face.rb', line 818

def right
  @right
end

Instance Method Details

#inspectObject



852
853
854
# File 'lib/google/cloud/vision/annotation/face.rb', line 852

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

#to_aArray

Returns the object’s property values as an array.

Returns:

  • (Array)


833
834
835
# File 'lib/google/cloud/vision/annotation/face.rb', line 833

def to_a
  [left, right]
end

#to_hHash

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

Returns:

  • (Hash)


842
843
844
# File 'lib/google/cloud/vision/annotation/face.rb', line 842

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

#to_sObject



847
848
849
# File 'lib/google/cloud/vision/annotation/face.rb', line 847

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