Class: Google::Cloud::Vision::Annotation::Web
- Inherits:
-
Object
- Object
- Google::Cloud::Vision::Annotation::Web
- Defined in:
- lib/google/cloud/vision/annotation/web.rb
Overview
Defined Under Namespace
Instance Method Summary collapse
-
#entities ⇒ Array<Google::Cloud::Vision::Annotation::Web::Entity>
Deduced entities from similar images on the Internet.
-
#full_matching_images ⇒ Array<Google::Cloud::Vision::Annotation::Web::Image>
Fully matching images from the Internet.
-
#pages_with_matching_images ⇒ Array<Google::Cloud::Vision::Annotation::Web::Page>
Web pages containing the matching images from the Internet.
-
#partial_matching_images ⇒ Array<Google::Cloud::Vision::Annotation::Web::Image>
Partial matching images from the Internet.
-
#to_h ⇒ Hash
Deeply converts object to a hash.
Instance Method Details
#entities ⇒ Array<Google::Cloud::Vision::Annotation::Web::Entity>
Deduced entities from similar images on the Internet.
67 68 69 70 71 |
# File 'lib/google/cloud/vision/annotation/web.rb', line 67 def entities @entities ||= Array(@grpc.web_entities).map do |e| Entity.from_grpc e end end |
#full_matching_images ⇒ Array<Google::Cloud::Vision::Annotation::Web::Image>
Fully matching images from the Internet. They're definite neardups and most often a copy of the query image with merely a size change.
79 80 81 82 83 84 |
# File 'lib/google/cloud/vision/annotation/web.rb', line 79 def full_matching_images images = @grpc.full_matching_images @full_matching_images ||= Array(images).map do |i| Image.from_grpc i end end |
#pages_with_matching_images ⇒ Array<Google::Cloud::Vision::Annotation::Web::Page>
Web pages containing the matching images from the Internet.
105 106 107 108 109 110 |
# File 'lib/google/cloud/vision/annotation/web.rb', line 105 def pages_with_matching_images pages = @grpc.pages_with_matching_images @pages_with_matching_images ||= Array(pages).map do |p| Page.from_grpc p end end |
#partial_matching_images ⇒ Array<Google::Cloud::Vision::Annotation::Web::Image>
Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops.
93 94 95 96 97 98 |
# File 'lib/google/cloud/vision/annotation/web.rb', line 93 def partial_matching_images images = @grpc.partial_matching_images @partial_matching_images ||= Array(images).map do |i| Image.from_grpc i end end |
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
117 118 119 120 121 122 123 124 |
# File 'lib/google/cloud/vision/annotation/web.rb', line 117 def to_h { entities: entities.map(&:to_h), full_matching_images: full_matching_images.map(&:to_h), partial_matching_images: partial_matching_images.map(&:to_h), pages_with_matching_images: pages_with_matching_images.map(&:to_h) } end |