Class: Google::Cloud::Vision::Annotation::Vertex

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

Overview

Vertex

A vertex in a set of bounding polygon vertices.

See Face::Bounds and Text.

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
vision = gcloud.vision

image = vision.image "path/to/text.png"
text = image.text

text.bounds.count #=> 4
vertex = text.bounds.first
vertex.x #=> 13
vertex.y #=> 8

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xInteger (readonly)

The X coordinate.

Returns:

  • (Integer)

    the current value of x



44
45
46
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 44

def x
  @x
end

#yInteger (readonly)

The Y coordinate.

Returns:

  • (Integer)

    the current value of y



44
45
46
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 44

def y
  @y
end

Instance Method Details

#to_aArray

Returns the object's property values as an array.

Returns:

  • (Array)


59
60
61
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 59

def to_a
  [x, y]
end

#to_hHash

Converts object to a hash. All keys will be symbolized.

Returns:

  • (Hash)


68
69
70
# File 'lib/google/cloud/vision/annotation/vertex.rb', line 68

def to_h
  { x: x, y: y }
end