Class: Google::Cloud::Vision::Annotation::Web::Image

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

Overview

Image

Metadata for online images.

See Google::Cloud::Vision::Annotation::Web.

Examples:

require "google/cloud/vision"

vision = Google::Cloud::Vision.new

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

web = image.web

full_matching_image = web.full_matching_images.first
full_matching_image.url #=> "http://example.com/images/123.jpg"
full_matching_image.score #=> 0.10226666927337646

Instance Method Summary collapse

Instance Method Details

#scoreFloat

Overall relevancy score for the image. Not normalized and not comparable across different image queries.

Returns:

  • (Float)


291
292
293
# File 'lib/google/cloud/vision/annotation/web.rb', line 291

def score
  @grpc.score
end

#to_aArray

Returns the object's property values as an array.

Returns:

  • (Array)


300
301
302
# File 'lib/google/cloud/vision/annotation/web.rb', line 300

def to_a
  [url, score]
end

#to_hHash

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

Returns:

  • (Hash)


309
310
311
# File 'lib/google/cloud/vision/annotation/web.rb', line 309

def to_h
  { url: url, score: score }
end

#urlString

The result image URL.

Returns:

  • (String)


281
282
283
# File 'lib/google/cloud/vision/annotation/web.rb', line 281

def url
  @grpc.url
end