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/vision"

vision = Google::Cloud::Vision.new

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

text.bounds.count #=> 4
vertex = text.bounds.first
vertex.x #=> 1
vertex.y #=> 0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xInteger (readonly)

The X coordinate.

Returns:

  • (Integer)

    the current value of x



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

def x
  @x
end

#yInteger (readonly)

The Y coordinate.

Returns:

  • (Integer)

    the current value of y



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

def y
  @y
end

Instance Method Details

#to_aArray

Returns the object's property values as an array.

Returns:

  • (Array)


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

def to_a
  [x, y]
end

#to_hHash

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

Returns:

  • (Hash)


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

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