Class: Gcloud::Vision::Annotation::Face::Features::Landmark
- Inherits:
-
Object
- Object
- Gcloud::Vision::Annotation::Face::Features::Landmark
- Defined in:
- lib/gcloud/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 Gcloud::Vision::Annotation::Face::Features and Gcloud::Vision::Annotation::Face.
Instance Attribute Summary collapse
Class Method Summary collapse
-
.from_gapi(gapi) ⇒ 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_ary ⇒ Array
Returns the object’s property values as an array.
-
#to_h ⇒ Hash
Converts object to a hash.
-
#to_hash ⇒ 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
614 615 616 |
# File 'lib/gcloud/vision/annotation/face.rb', line 614 def initialize @gapi = {} end |
Instance Attribute Details
#gapi ⇒ Object
610 611 612 |
# File 'lib/gcloud/vision/annotation/face.rb', line 610 def gapi @gapi end |
Class Method Details
.from_gapi(gapi) ⇒ Object
object.
720 721 722 |
# File 'lib/gcloud/vision/annotation/face.rb', line 720 def self.from_gapi gapi new.tap { |f| f.instance_variable_set :@gapi, gapi } end |
Instance Method Details
#inspect ⇒ Object
713 714 715 |
# File 'lib/gcloud/vision/annotation/face.rb', line 713 def inspect "#<Landmark #{self}>" end |
#to_a ⇒ Array
Returns the object’s property values as an array.
676 677 678 |
# File 'lib/gcloud/vision/annotation/face.rb', line 676 def to_a to_ary end |
#to_ary ⇒ Array
Returns the object’s property values as an array.
685 686 687 |
# File 'lib/gcloud/vision/annotation/face.rb', line 685 def to_ary [x, y, z] end |
#to_h ⇒ Hash
Converts object to a hash. All keys will be symbolized.
694 695 696 |
# File 'lib/gcloud/vision/annotation/face.rb', line 694 def to_h to_hash end |
#to_hash ⇒ Hash
Converts object to a hash. All keys will be symbolized.
703 704 705 |
# File 'lib/gcloud/vision/annotation/face.rb', line 703 def to_hash { x: x, y: y, z: z } end |
#to_s ⇒ Object
708 709 710 |
# File 'lib/gcloud/vision/annotation/face.rb', line 708 def to_s "(x: #{x.inspect}, y: #{y.inspect}, z: #{z.inspect})" end |
#type ⇒ String
The landmark type code.
637 638 639 |
# File 'lib/gcloud/vision/annotation/face.rb', line 637 def type @gapi.type end |
#x ⇒ Float
The X (horizontal) coordinate.
646 647 648 649 |
# File 'lib/gcloud/vision/annotation/face.rb', line 646 def x return nil unless @gapi.position @gapi.position.x end |
#y ⇒ Float
The Y (vertical) coordinate.
656 657 658 659 |
# File 'lib/gcloud/vision/annotation/face.rb', line 656 def y return nil unless @gapi.position @gapi.position.y end |
#z ⇒ Float
The Z (depth) coordinate.
666 667 668 669 |
# File 'lib/gcloud/vision/annotation/face.rb', line 666 def z return nil unless @gapi.position @gapi.position.z end |