Class: Google::Cloud::Vision::Annotation::Face::Features::Landmark
- Inherits:
-
Object
- Object
- Google::Cloud::Vision::Annotation::Face::Features::Landmark
- Defined in:
- lib/google/cloud/vision/annotation/face.rb
Overview
# Landmark
A face-specific landmark (for example, a face feature). Landmark positions may fall outside the bounds of the image when the face is near one or more edges of the image. Therefore it is NOT guaranteed that ‘0 <= x < width` or `0 <= y < height`.
See Google::Cloud::Vision::Annotation::Face::Features and Google::Cloud::Vision::Annotation::Face.
Instance Attribute Summary collapse
Class Method Summary collapse
-
.from_grpc(grpc) ⇒ Object
object.
Instance Method Summary collapse
-
#initialize ⇒ Landmark
constructor
A new instance of Landmark.
- #inspect ⇒ Object
-
#to_a ⇒ Array
Returns the object’s property values as an array.
-
#to_h ⇒ Hash
Converts object to a hash.
- #to_s ⇒ Object
-
#type ⇒ String
The landmark type code.
-
#x ⇒ Float
The X (horizontal) coordinate.
-
#y ⇒ Float
The Y (vertical) coordinate.
-
#z ⇒ Float
The Z (depth) coordinate.
Constructor Details
#initialize ⇒ Landmark
Returns a new instance of Landmark.
558 559 560 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 558 def initialize @grpc = nil end |
Instance Attribute Details
#grpc ⇒ Object
554 555 556 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 554 def grpc @grpc end |
Class Method Details
.from_grpc(grpc) ⇒ Object
object.
645 646 647 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 645 def self.from_grpc grpc new.tap { |f| f.instance_variable_set :@grpc, grpc } end |
Instance Method Details
#inspect ⇒ Object
638 639 640 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 638 def inspect "#<Landmark #{self}>" end |
#to_a ⇒ Array
Returns the object’s property values as an array.
619 620 621 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 619 def to_a [x, y, z] end |
#to_h ⇒ Hash
Converts object to a hash. All keys will be symbolized.
628 629 630 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 628 def to_h { x: x, y: y, z: z } end |
#to_s ⇒ Object
633 634 635 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 633 def to_s "(x: #{x.inspect}, y: #{y.inspect}, z: #{z.inspect})" end |
#type ⇒ String
The landmark type code.
580 581 582 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 580 def type @grpc.type end |
#x ⇒ Float
The X (horizontal) coordinate.
589 590 591 592 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 589 def x return nil unless @grpc.position @grpc.position.x end |
#y ⇒ Float
The Y (vertical) coordinate.
599 600 601 602 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 599 def y return nil unless @grpc.position @grpc.position.y end |
#z ⇒ Float
The Z (depth) coordinate.
609 610 611 612 |
# File 'lib/google/cloud/vision/annotation/face.rb', line 609 def z return nil unless @grpc.position @grpc.position.z end |