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

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

Overview

# Eyebrow

The landmarks of an eyebrow 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 Eyebrows, 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, top, right) ⇒ Eyebrow

Returns a new instance of Eyebrow.



894
895
896
897
898
# File 'lib/google/cloud/vision/annotation/face.rb', line 894

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

Instance Attribute Details

#leftLandmark (readonly)

The eyebrow, left.

Returns:

  • (Landmark)

    the current value of left



889
890
891
# File 'lib/google/cloud/vision/annotation/face.rb', line 889

def left
  @left
end

#rightLandmark (readonly)

The eyebrow, right.

Returns:

  • (Landmark)

    the current value of right



889
890
891
# File 'lib/google/cloud/vision/annotation/face.rb', line 889

def right
  @right
end

#topLandmark (readonly)

The eyebrow, upper midpoint.

Returns:

  • (Landmark)

    the current value of top



889
890
891
# File 'lib/google/cloud/vision/annotation/face.rb', line 889

def top
  @top
end

Instance Method Details

#inspectObject



925
926
927
# File 'lib/google/cloud/vision/annotation/face.rb', line 925

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

#to_aArray

Returns the object’s property values as an array.

Returns:

  • (Array)


905
906
907
# File 'lib/google/cloud/vision/annotation/face.rb', line 905

def to_a
  [left, top, right]
end

#to_hHash

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

Returns:

  • (Hash)


914
915
916
# File 'lib/google/cloud/vision/annotation/face.rb', line 914

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

#to_sObject



919
920
921
922
# File 'lib/google/cloud/vision/annotation/face.rb', line 919

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