Class: Google::Cloud::Vision::Annotation::Face

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

Overview

Face

The results of face detection.

See #faces and #face.

Examples:

require "google/cloud/vision"

vision = Google::Cloud::Vision.new

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

face = image.face
face.confidence #=> 0.86162376

Defined Under Namespace

Classes: Angles, Bounds, Features, Likelihood

Instance Method Summary collapse

Instance Method Details

#anglesAngles

The angles of the face, including roll, yaw, and pitch.

Returns:



55
56
57
# File 'lib/google/cloud/vision/annotation/face.rb', line 55

def angles
  @angles ||= Angles.from_grpc @grpc
end

#boundsBounds

The bounds of the face, including the polygons for the head and face.

Returns:



65
66
67
# File 'lib/google/cloud/vision/annotation/face.rb', line 65

def bounds
  @bounds ||= Bounds.from_grpc @grpc
end

#confidenceFloat

The confidence of the facial detection.

Returns:

  • (Float)

    A value in the range [0, 1].



94
95
96
# File 'lib/google/cloud/vision/annotation/face.rb', line 94

def confidence
  @grpc.detection_confidence
end

#featuresFeatures

The landmarks of the face, including the points for the eyes, ears, nose and mouth.

Returns:



75
76
77
# File 'lib/google/cloud/vision/annotation/face.rb', line 75

def features
  @features ||= Features.from_grpc @grpc
end

#likelihoodLikelihood

The likelihood of the facial detection, including joy, sorrow, anger, surprise, under_exposed, blurred, and headwear.

Returns:



85
86
87
# File 'lib/google/cloud/vision/annotation/face.rb', line 85

def likelihood
  @likelihood ||= Likelihood.from_grpc @grpc
end

#to_hHash

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

Returns:

  • (Hash)


103
104
105
106
# File 'lib/google/cloud/vision/annotation/face.rb', line 103

def to_h
  { angles: angles.to_h, bounds: bounds.to_h, features: features.to_h,
    likelihood: likelihood.to_h }
end