google-cloud-vision 0.31.0 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -9
- data/LICENSE +1 -1
- data/README.md +94 -0
- data/lib/google/cloud/vision.rb +200 -535
- data/lib/google/cloud/vision/v1.rb +129 -55
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +9 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +88 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +539 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +3 -3
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +2 -1
- data/lib/google/cloud/vision/{version.rb → v1/doc/google/protobuf/empty.rb} +13 -6
- data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +230 -0
- data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +109 -0
- data/lib/google/cloud/vision/v1/geometry_pb.rb +1 -0
- data/lib/google/cloud/vision/v1/helpers.rb +972 -0
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +4 -4
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +5 -0
- data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +2 -1
- data/lib/google/cloud/vision/v1/product_search_client.rb +1337 -0
- data/lib/google/cloud/vision/v1/product_search_client_config.json +116 -0
- data/lib/google/cloud/vision/v1/product_search_pb.rb +45 -0
- data/lib/google/cloud/vision/v1/product_search_service_pb.rb +191 -0
- data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +224 -0
- data/lib/google/cloud/vision/v1p3beta1.rb +233 -0
- data/lib/google/cloud/vision/v1p3beta1/credentials.rb +42 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +72 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +763 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +154 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +533 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +254 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +101 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +93 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +130 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +230 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +109 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +90 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +84 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +156 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +65 -0
- data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +43 -0
- data/lib/google/cloud/vision/v1p3beta1/helpers.rb +972 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +302 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +36 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +304 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +55 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +1351 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +116 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +64 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +191 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +222 -0
- data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +94 -0
- data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +51 -0
- metadata +53 -122
- data/AUTHENTICATION.md +0 -179
- data/CHANGELOG.md +0 -109
- data/CODE_OF_CONDUCT.md +0 -40
- data/CONTRIBUTING.md +0 -188
- data/LOGGING.md +0 -32
- data/OVERVIEW.md +0 -202
- data/TROUBLESHOOTING.md +0 -37
- data/lib/google-cloud-vision.rb +0 -146
- data/lib/google/cloud/vision/annotate.rb +0 -303
- data/lib/google/cloud/vision/annotation.rb +0 -553
- data/lib/google/cloud/vision/annotation/crop_hint.rb +0 -126
- data/lib/google/cloud/vision/annotation/entity.rb +0 -225
- data/lib/google/cloud/vision/annotation/face.rb +0 -1497
- data/lib/google/cloud/vision/annotation/normalized_vertex.rb +0 -76
- data/lib/google/cloud/vision/annotation/object_localization.rb +0 -115
- data/lib/google/cloud/vision/annotation/properties.rb +0 -220
- data/lib/google/cloud/vision/annotation/safe_search.rb +0 -153
- data/lib/google/cloud/vision/annotation/text.rb +0 -1015
- data/lib/google/cloud/vision/annotation/vertex.rb +0 -91
- data/lib/google/cloud/vision/annotation/web.rb +0 -420
- data/lib/google/cloud/vision/credentials.rb +0 -57
- data/lib/google/cloud/vision/image.rb +0 -832
- data/lib/google/cloud/vision/location.rb +0 -98
- data/lib/google/cloud/vision/project.rb +0 -367
- data/lib/google/cloud/vision/service.rb +0 -83
@@ -0,0 +1,233 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "google/cloud/vision/v1p3beta1/product_search_client"
|
17
|
+
require "google/cloud/vision/v1p3beta1/image_annotator_client"
|
18
|
+
require "google/cloud/vision/v1p3beta1/helpers"
|
19
|
+
require "google/cloud/vision/v1p3beta1/image_annotator_pb"
|
20
|
+
require "google/cloud/vision/v1p3beta1/product_search_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Vision
|
25
|
+
# rubocop:disable LineLength
|
26
|
+
|
27
|
+
##
|
28
|
+
# # Ruby Client for Cloud Vision API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
29
|
+
#
|
30
|
+
# [Cloud Vision API][Product Documentation]:
|
31
|
+
# Integrates Google Vision features, including image labeling, face, logo, and
|
32
|
+
# landmark detection, optical character recognition (OCR), and detection of
|
33
|
+
# explicit content, into applications.
|
34
|
+
# - [Product Documentation][]
|
35
|
+
#
|
36
|
+
# ## Quick Start
|
37
|
+
# In order to use this library, you first need to go through the following
|
38
|
+
# steps:
|
39
|
+
#
|
40
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
41
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
42
|
+
# 3. [Enable the Cloud Vision API.](https://console.cloud.google.com/apis/library/vision.googleapis.com)
|
43
|
+
# 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
44
|
+
#
|
45
|
+
# ### Installation
|
46
|
+
# ```
|
47
|
+
# $ gem install google-cloud-vision
|
48
|
+
# ```
|
49
|
+
#
|
50
|
+
# ### Preview
|
51
|
+
# #### ImageAnnotatorClient
|
52
|
+
# ```rb
|
53
|
+
# require "google/cloud/vision"
|
54
|
+
#
|
55
|
+
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1p3beta1)
|
56
|
+
# gcs_image_uri = "gs://gapic-toolkit/President_Barack_Obama.jpg"
|
57
|
+
# source = { gcs_image_uri: gcs_image_uri }
|
58
|
+
# image = { source: source }
|
59
|
+
# type = :FACE_DETECTION
|
60
|
+
# features_element = { type: type }
|
61
|
+
# features = [features_element]
|
62
|
+
# requests_element = { image: image, features: features }
|
63
|
+
# requests = [requests_element]
|
64
|
+
# response = image_annotator_client.batch_annotate_images(requests)
|
65
|
+
# ```
|
66
|
+
#
|
67
|
+
# ### Next Steps
|
68
|
+
# - Read the [Cloud Vision API Product documentation][Product Documentation]
|
69
|
+
# to learn more about the product and see How-to Guides.
|
70
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
71
|
+
# to see the full list of Cloud APIs that we cover.
|
72
|
+
#
|
73
|
+
# [Product Documentation]: https://cloud.google.com/vision
|
74
|
+
#
|
75
|
+
# ## Enabling Logging
|
76
|
+
#
|
77
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
78
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
79
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
80
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
81
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
82
|
+
#
|
83
|
+
# Configuring a Ruby stdlib logger:
|
84
|
+
#
|
85
|
+
# ```ruby
|
86
|
+
# require "logger"
|
87
|
+
#
|
88
|
+
# module MyLogger
|
89
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
90
|
+
# def logger
|
91
|
+
# LOGGER
|
92
|
+
# end
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
96
|
+
# module GRPC
|
97
|
+
# extend MyLogger
|
98
|
+
# end
|
99
|
+
# ```
|
100
|
+
#
|
101
|
+
module V1p3beta1
|
102
|
+
# rubocop:enable LineLength
|
103
|
+
|
104
|
+
module ProductSearch
|
105
|
+
##
|
106
|
+
# Manages Products and ProductSets of reference images for use in product
|
107
|
+
# search. It uses the following resource model:
|
108
|
+
#
|
109
|
+
# * The API has a collection of {Google::Cloud::Vision::V1p3beta1::ProductSet ProductSet} resources, named
|
110
|
+
# `projects/*/locations/*/productSets/*`, which acts as a way to put different
|
111
|
+
# products into groups to limit identification.
|
112
|
+
#
|
113
|
+
# In parallel,
|
114
|
+
#
|
115
|
+
# * The API has a collection of {Google::Cloud::Vision::V1p3beta1::Product Product} resources, named
|
116
|
+
# `projects/*/locations/*/products/*`
|
117
|
+
#
|
118
|
+
# * Each {Google::Cloud::Vision::V1p3beta1::Product Product} has a collection of {Google::Cloud::Vision::V1p3beta1::ReferenceImage ReferenceImage} resources, named
|
119
|
+
# `projects/*/locations/*/products/*/referenceImages/*`
|
120
|
+
#
|
121
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
122
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
123
|
+
# be many types.
|
124
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
125
|
+
# authenticating requests made by this client.
|
126
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
127
|
+
# credentials for this client.
|
128
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
129
|
+
# credentials for this client.
|
130
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
131
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
132
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
133
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
134
|
+
# metadata for requests, generally, to give OAuth credentials.
|
135
|
+
# @param scopes [Array<String>]
|
136
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
137
|
+
# an updater_proc is supplied.
|
138
|
+
# @param client_config [Hash]
|
139
|
+
# A Hash for call options for each method. See
|
140
|
+
# Google::Gax#construct_settings for the structure of
|
141
|
+
# this data. Falls back to the default config if not specified
|
142
|
+
# or the specified config is missing data points.
|
143
|
+
# @param timeout [Numeric]
|
144
|
+
# The default timeout, in seconds, for calls made through this client.
|
145
|
+
# @param metadata [Hash]
|
146
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
147
|
+
# @param exception_transformer [Proc]
|
148
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
149
|
+
# custom error handling.
|
150
|
+
def self.new \
|
151
|
+
credentials: nil,
|
152
|
+
scopes: nil,
|
153
|
+
client_config: nil,
|
154
|
+
timeout: nil,
|
155
|
+
metadata: nil,
|
156
|
+
exception_transformer: nil,
|
157
|
+
lib_name: nil,
|
158
|
+
lib_version: nil
|
159
|
+
kwargs = {
|
160
|
+
credentials: credentials,
|
161
|
+
scopes: scopes,
|
162
|
+
client_config: client_config,
|
163
|
+
timeout: timeout,
|
164
|
+
metadata: metadata,
|
165
|
+
exception_transformer: exception_transformer,
|
166
|
+
lib_name: lib_name,
|
167
|
+
lib_version: lib_version
|
168
|
+
}.select { |_, v| v != nil }
|
169
|
+
Google::Cloud::Vision::V1p3beta1::ProductSearchClient.new(**kwargs)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
module ImageAnnotator
|
174
|
+
##
|
175
|
+
# Service that performs Google Cloud Vision API detection tasks over client
|
176
|
+
# images, such as face, landmark, logo, label, and text detection. The
|
177
|
+
# ImageAnnotator service returns detected entities from the images.
|
178
|
+
#
|
179
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
180
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
181
|
+
# be many types.
|
182
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
183
|
+
# authenticating requests made by this client.
|
184
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
185
|
+
# credentials for this client.
|
186
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
187
|
+
# credentials for this client.
|
188
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
189
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
190
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
191
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
192
|
+
# metadata for requests, generally, to give OAuth credentials.
|
193
|
+
# @param scopes [Array<String>]
|
194
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
195
|
+
# an updater_proc is supplied.
|
196
|
+
# @param client_config [Hash]
|
197
|
+
# A Hash for call options for each method. See
|
198
|
+
# Google::Gax#construct_settings for the structure of
|
199
|
+
# this data. Falls back to the default config if not specified
|
200
|
+
# or the specified config is missing data points.
|
201
|
+
# @param timeout [Numeric]
|
202
|
+
# The default timeout, in seconds, for calls made through this client.
|
203
|
+
# @param metadata [Hash]
|
204
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
205
|
+
# @param exception_transformer [Proc]
|
206
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
207
|
+
# custom error handling.
|
208
|
+
def self.new \
|
209
|
+
credentials: nil,
|
210
|
+
scopes: nil,
|
211
|
+
client_config: nil,
|
212
|
+
timeout: nil,
|
213
|
+
metadata: nil,
|
214
|
+
exception_transformer: nil,
|
215
|
+
lib_name: nil,
|
216
|
+
lib_version: nil
|
217
|
+
kwargs = {
|
218
|
+
credentials: credentials,
|
219
|
+
scopes: scopes,
|
220
|
+
client_config: client_config,
|
221
|
+
timeout: timeout,
|
222
|
+
metadata: metadata,
|
223
|
+
exception_transformer: exception_transformer,
|
224
|
+
lib_name: lib_name,
|
225
|
+
lib_version: lib_version
|
226
|
+
}.select { |_, v| v != nil }
|
227
|
+
Google::Cloud::Vision::V1p3beta1::ImageAnnotatorClient.new(**kwargs)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "googleauth"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Vision
|
21
|
+
module V1p3beta1
|
22
|
+
class Credentials < Google::Auth::Credentials
|
23
|
+
SCOPE = [
|
24
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
25
|
+
"https://www.googleapis.com/auth/cloud-vision"
|
26
|
+
].freeze
|
27
|
+
PATH_ENV_VARS = %w(VISION_CREDENTIALS
|
28
|
+
VISION_KEYFILE
|
29
|
+
GOOGLE_CLOUD_CREDENTIALS
|
30
|
+
GOOGLE_CLOUD_KEYFILE
|
31
|
+
GCLOUD_KEYFILE)
|
32
|
+
JSON_ENV_VARS = %w(VISION_CREDENTIALS_JSON
|
33
|
+
VISION_KEYFILE_JSON
|
34
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
35
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
36
|
+
GCLOUD_KEYFILE_JSON)
|
37
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module Google
|
17
|
+
module Cloud
|
18
|
+
module Vision
|
19
|
+
module V1p3beta1
|
20
|
+
# A vertex represents a 2D point in the image.
|
21
|
+
# NOTE: the vertex coordinates are in the same scale as the original image.
|
22
|
+
# @!attribute [rw] x
|
23
|
+
# @return [Integer]
|
24
|
+
# X coordinate.
|
25
|
+
# @!attribute [rw] y
|
26
|
+
# @return [Integer]
|
27
|
+
# Y coordinate.
|
28
|
+
class Vertex; end
|
29
|
+
|
30
|
+
# A vertex represents a 2D point in the image.
|
31
|
+
# NOTE: the normalized vertex coordinates are relative to the original image
|
32
|
+
# and range from 0 to 1.
|
33
|
+
# @!attribute [rw] x
|
34
|
+
# @return [Float]
|
35
|
+
# X coordinate.
|
36
|
+
# @!attribute [rw] y
|
37
|
+
# @return [Float]
|
38
|
+
# Y coordinate.
|
39
|
+
class NormalizedVertex; end
|
40
|
+
|
41
|
+
# A bounding polygon for the detected image annotation.
|
42
|
+
# @!attribute [rw] vertices
|
43
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::Vertex>]
|
44
|
+
# The bounding polygon vertices.
|
45
|
+
# @!attribute [rw] normalized_vertices
|
46
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::NormalizedVertex>]
|
47
|
+
# The bounding polygon normalized vertices.
|
48
|
+
class BoundingPoly; end
|
49
|
+
|
50
|
+
# A normalized bounding polygon around a portion of an image.
|
51
|
+
# @!attribute [rw] vertices
|
52
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::NormalizedVertex>]
|
53
|
+
# Normalized vertices of the bounding polygon.
|
54
|
+
class NormalizedBoundingPoly; end
|
55
|
+
|
56
|
+
# A 3D position in the image, used primarily for Face detection landmarks.
|
57
|
+
# A valid Position must have both x and y coordinates.
|
58
|
+
# The position coordinates are in the same scale as the original image.
|
59
|
+
# @!attribute [rw] x
|
60
|
+
# @return [Float]
|
61
|
+
# X coordinate.
|
62
|
+
# @!attribute [rw] y
|
63
|
+
# @return [Float]
|
64
|
+
# Y coordinate.
|
65
|
+
# @!attribute [rw] z
|
66
|
+
# @return [Float]
|
67
|
+
# Z coordinate (or depth).
|
68
|
+
class Position; end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,763 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module Google
|
17
|
+
module Cloud
|
18
|
+
module Vision
|
19
|
+
module V1p3beta1
|
20
|
+
# The type of Google Cloud Vision API detection to perform, and the maximum
|
21
|
+
# number of results to return for that type. Multiple `Feature` objects can
|
22
|
+
# be specified in the `features` list.
|
23
|
+
# @!attribute [rw] type
|
24
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Feature::Type]
|
25
|
+
# The feature type.
|
26
|
+
# @!attribute [rw] max_results
|
27
|
+
# @return [Integer]
|
28
|
+
# Maximum number of results of this type. Does not apply to
|
29
|
+
# `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
|
30
|
+
# @!attribute [rw] model
|
31
|
+
# @return [String]
|
32
|
+
# Model to use for the feature.
|
33
|
+
# Supported values: "builtin/stable" (the default if unset) and
|
34
|
+
# "builtin/latest".
|
35
|
+
class Feature
|
36
|
+
# Type of Google Cloud Vision API feature to be extracted.
|
37
|
+
module Type
|
38
|
+
# Unspecified feature type.
|
39
|
+
TYPE_UNSPECIFIED = 0
|
40
|
+
|
41
|
+
# Run face detection.
|
42
|
+
FACE_DETECTION = 1
|
43
|
+
|
44
|
+
# Run landmark detection.
|
45
|
+
LANDMARK_DETECTION = 2
|
46
|
+
|
47
|
+
# Run logo detection.
|
48
|
+
LOGO_DETECTION = 3
|
49
|
+
|
50
|
+
# Run label detection.
|
51
|
+
LABEL_DETECTION = 4
|
52
|
+
|
53
|
+
# Run text detection / optical character recognition (OCR). Text detection
|
54
|
+
# is optimized for areas of text within a larger image; if the image is
|
55
|
+
# a document, use `DOCUMENT_TEXT_DETECTION` instead.
|
56
|
+
TEXT_DETECTION = 5
|
57
|
+
|
58
|
+
# Run dense text document OCR. Takes precedence when both
|
59
|
+
# `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present.
|
60
|
+
DOCUMENT_TEXT_DETECTION = 11
|
61
|
+
|
62
|
+
# Run Safe Search to detect potentially unsafe
|
63
|
+
# or undesirable content.
|
64
|
+
SAFE_SEARCH_DETECTION = 6
|
65
|
+
|
66
|
+
# Compute a set of image properties, such as the
|
67
|
+
# image's dominant colors.
|
68
|
+
IMAGE_PROPERTIES = 7
|
69
|
+
|
70
|
+
# Run crop hints.
|
71
|
+
CROP_HINTS = 9
|
72
|
+
|
73
|
+
# Run web detection.
|
74
|
+
WEB_DETECTION = 10
|
75
|
+
|
76
|
+
# Run Product Search.
|
77
|
+
PRODUCT_SEARCH = 12
|
78
|
+
|
79
|
+
# Run localizer for object detection.
|
80
|
+
OBJECT_LOCALIZATION = 19
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# External image source (Google Cloud Storage or web URL image location).
|
85
|
+
# @!attribute [rw] gcs_image_uri
|
86
|
+
# @return [String]
|
87
|
+
# **Use `image_uri` instead.**
|
88
|
+
#
|
89
|
+
# The Google Cloud Storage URI of the form
|
90
|
+
# `gs://bucket_name/object_name`. Object versioning is not supported. See
|
91
|
+
# [Google Cloud Storage Request
|
92
|
+
# URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
|
93
|
+
# @!attribute [rw] image_uri
|
94
|
+
# @return [String]
|
95
|
+
# The URI of the source image. Can be either:
|
96
|
+
#
|
97
|
+
# 1. A Google Cloud Storage URI of the form
|
98
|
+
# `gs://bucket_name/object_name`. Object versioning is not supported. See
|
99
|
+
# [Google Cloud Storage Request
|
100
|
+
# URIs](https://cloud.google.com/storage/docs/reference-uris) for more
|
101
|
+
# info.
|
102
|
+
#
|
103
|
+
# 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
|
104
|
+
# HTTP/HTTPS URLs, Google cannot guarantee that the request will be
|
105
|
+
# completed. Your request may fail if the specified host denies the
|
106
|
+
# request (e.g. due to request throttling or DOS prevention), or if Google
|
107
|
+
# throttles requests to the site for abuse prevention. You should not
|
108
|
+
# depend on externally-hosted images for production applications.
|
109
|
+
#
|
110
|
+
# When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
|
111
|
+
# precedence.
|
112
|
+
class ImageSource; end
|
113
|
+
|
114
|
+
# Client image to perform Google Cloud Vision API tasks over.
|
115
|
+
# @!attribute [rw] content
|
116
|
+
# @return [String]
|
117
|
+
# Image content, represented as a stream of bytes.
|
118
|
+
# Note: As with all `bytes` fields, protobuffers use a pure binary
|
119
|
+
# representation, whereas JSON representations use base64.
|
120
|
+
# @!attribute [rw] source
|
121
|
+
# @return [Google::Cloud::Vision::V1p3beta1::ImageSource]
|
122
|
+
# Google Cloud Storage image location, or publicly-accessible image
|
123
|
+
# URL. If both `content` and `source` are provided for an image, `content`
|
124
|
+
# takes precedence and is used to perform the image annotation request.
|
125
|
+
class Image; end
|
126
|
+
|
127
|
+
# A face annotation object contains the results of face detection.
|
128
|
+
# @!attribute [rw] bounding_poly
|
129
|
+
# @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
|
130
|
+
# The bounding polygon around the face. The coordinates of the bounding box
|
131
|
+
# are in the original image's scale, as returned in `ImageParams`.
|
132
|
+
# The bounding box is computed to "frame" the face in accordance with human
|
133
|
+
# expectations. It is based on the landmarker results.
|
134
|
+
# Note that one or more x and/or y coordinates may not be generated in the
|
135
|
+
# `BoundingPoly` (the polygon will be unbounded) if only a partial face
|
136
|
+
# appears in the image to be annotated.
|
137
|
+
# @!attribute [rw] fd_bounding_poly
|
138
|
+
# @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
|
139
|
+
# The `fd_bounding_poly` bounding polygon is tighter than the
|
140
|
+
# `boundingPoly`, and encloses only the skin part of the face. Typically, it
|
141
|
+
# is used to eliminate the face from any image analysis that detects the
|
142
|
+
# "amount of skin" visible in an image. It is not based on the
|
143
|
+
# landmarker results, only on the initial face detection, hence
|
144
|
+
# the <code>fd</code> (face detection) prefix.
|
145
|
+
# @!attribute [rw] landmarks
|
146
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::FaceAnnotation::Landmark>]
|
147
|
+
# Detected face landmarks.
|
148
|
+
# @!attribute [rw] roll_angle
|
149
|
+
# @return [Float]
|
150
|
+
# Roll angle, which indicates the amount of clockwise/anti-clockwise rotation
|
151
|
+
# of the face relative to the image vertical about the axis perpendicular to
|
152
|
+
# the face. Range [-180,180].
|
153
|
+
# @!attribute [rw] pan_angle
|
154
|
+
# @return [Float]
|
155
|
+
# Yaw angle, which indicates the leftward/rightward angle that the face is
|
156
|
+
# pointing relative to the vertical plane perpendicular to the image. Range
|
157
|
+
# [-180,180].
|
158
|
+
# @!attribute [rw] tilt_angle
|
159
|
+
# @return [Float]
|
160
|
+
# Pitch angle, which indicates the upwards/downwards angle that the face is
|
161
|
+
# pointing relative to the image's horizontal plane. Range [-180,180].
|
162
|
+
# @!attribute [rw] detection_confidence
|
163
|
+
# @return [Float]
|
164
|
+
# Detection confidence. Range [0, 1].
|
165
|
+
# @!attribute [rw] landmarking_confidence
|
166
|
+
# @return [Float]
|
167
|
+
# Face landmarking confidence. Range [0, 1].
|
168
|
+
# @!attribute [rw] joy_likelihood
|
169
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
170
|
+
# Joy likelihood.
|
171
|
+
# @!attribute [rw] sorrow_likelihood
|
172
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
173
|
+
# Sorrow likelihood.
|
174
|
+
# @!attribute [rw] anger_likelihood
|
175
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
176
|
+
# Anger likelihood.
|
177
|
+
# @!attribute [rw] surprise_likelihood
|
178
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
179
|
+
# Surprise likelihood.
|
180
|
+
# @!attribute [rw] under_exposed_likelihood
|
181
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
182
|
+
# Under-exposed likelihood.
|
183
|
+
# @!attribute [rw] blurred_likelihood
|
184
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
185
|
+
# Blurred likelihood.
|
186
|
+
# @!attribute [rw] headwear_likelihood
|
187
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
188
|
+
# Headwear likelihood.
|
189
|
+
class FaceAnnotation
|
190
|
+
# A face-specific landmark (for example, a face feature).
|
191
|
+
# @!attribute [rw] type
|
192
|
+
# @return [Google::Cloud::Vision::V1p3beta1::FaceAnnotation::Landmark::Type]
|
193
|
+
# Face landmark type.
|
194
|
+
# @!attribute [rw] position
|
195
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Position]
|
196
|
+
# Face landmark position.
|
197
|
+
class Landmark
|
198
|
+
# Face landmark (feature) type.
|
199
|
+
# Left and right are defined from the vantage of the viewer of the image
|
200
|
+
# without considering mirror projections typical of photos. So, `LEFT_EYE`,
|
201
|
+
# typically, is the person's right eye.
|
202
|
+
module Type
|
203
|
+
# Unknown face landmark detected. Should not be filled.
|
204
|
+
UNKNOWN_LANDMARK = 0
|
205
|
+
|
206
|
+
# Left eye.
|
207
|
+
LEFT_EYE = 1
|
208
|
+
|
209
|
+
# Right eye.
|
210
|
+
RIGHT_EYE = 2
|
211
|
+
|
212
|
+
# Left of left eyebrow.
|
213
|
+
LEFT_OF_LEFT_EYEBROW = 3
|
214
|
+
|
215
|
+
# Right of left eyebrow.
|
216
|
+
RIGHT_OF_LEFT_EYEBROW = 4
|
217
|
+
|
218
|
+
# Left of right eyebrow.
|
219
|
+
LEFT_OF_RIGHT_EYEBROW = 5
|
220
|
+
|
221
|
+
# Right of right eyebrow.
|
222
|
+
RIGHT_OF_RIGHT_EYEBROW = 6
|
223
|
+
|
224
|
+
# Midpoint between eyes.
|
225
|
+
MIDPOINT_BETWEEN_EYES = 7
|
226
|
+
|
227
|
+
# Nose tip.
|
228
|
+
NOSE_TIP = 8
|
229
|
+
|
230
|
+
# Upper lip.
|
231
|
+
UPPER_LIP = 9
|
232
|
+
|
233
|
+
# Lower lip.
|
234
|
+
LOWER_LIP = 10
|
235
|
+
|
236
|
+
# Mouth left.
|
237
|
+
MOUTH_LEFT = 11
|
238
|
+
|
239
|
+
# Mouth right.
|
240
|
+
MOUTH_RIGHT = 12
|
241
|
+
|
242
|
+
# Mouth center.
|
243
|
+
MOUTH_CENTER = 13
|
244
|
+
|
245
|
+
# Nose, bottom right.
|
246
|
+
NOSE_BOTTOM_RIGHT = 14
|
247
|
+
|
248
|
+
# Nose, bottom left.
|
249
|
+
NOSE_BOTTOM_LEFT = 15
|
250
|
+
|
251
|
+
# Nose, bottom center.
|
252
|
+
NOSE_BOTTOM_CENTER = 16
|
253
|
+
|
254
|
+
# Left eye, top boundary.
|
255
|
+
LEFT_EYE_TOP_BOUNDARY = 17
|
256
|
+
|
257
|
+
# Left eye, right corner.
|
258
|
+
LEFT_EYE_RIGHT_CORNER = 18
|
259
|
+
|
260
|
+
# Left eye, bottom boundary.
|
261
|
+
LEFT_EYE_BOTTOM_BOUNDARY = 19
|
262
|
+
|
263
|
+
# Left eye, left corner.
|
264
|
+
LEFT_EYE_LEFT_CORNER = 20
|
265
|
+
|
266
|
+
# Right eye, top boundary.
|
267
|
+
RIGHT_EYE_TOP_BOUNDARY = 21
|
268
|
+
|
269
|
+
# Right eye, right corner.
|
270
|
+
RIGHT_EYE_RIGHT_CORNER = 22
|
271
|
+
|
272
|
+
# Right eye, bottom boundary.
|
273
|
+
RIGHT_EYE_BOTTOM_BOUNDARY = 23
|
274
|
+
|
275
|
+
# Right eye, left corner.
|
276
|
+
RIGHT_EYE_LEFT_CORNER = 24
|
277
|
+
|
278
|
+
# Left eyebrow, upper midpoint.
|
279
|
+
LEFT_EYEBROW_UPPER_MIDPOINT = 25
|
280
|
+
|
281
|
+
# Right eyebrow, upper midpoint.
|
282
|
+
RIGHT_EYEBROW_UPPER_MIDPOINT = 26
|
283
|
+
|
284
|
+
# Left ear tragion.
|
285
|
+
LEFT_EAR_TRAGION = 27
|
286
|
+
|
287
|
+
# Right ear tragion.
|
288
|
+
RIGHT_EAR_TRAGION = 28
|
289
|
+
|
290
|
+
# Left eye pupil.
|
291
|
+
LEFT_EYE_PUPIL = 29
|
292
|
+
|
293
|
+
# Right eye pupil.
|
294
|
+
RIGHT_EYE_PUPIL = 30
|
295
|
+
|
296
|
+
# Forehead glabella.
|
297
|
+
FOREHEAD_GLABELLA = 31
|
298
|
+
|
299
|
+
# Chin gnathion.
|
300
|
+
CHIN_GNATHION = 32
|
301
|
+
|
302
|
+
# Chin left gonion.
|
303
|
+
CHIN_LEFT_GONION = 33
|
304
|
+
|
305
|
+
# Chin right gonion.
|
306
|
+
CHIN_RIGHT_GONION = 34
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
# Detected entity location information.
|
312
|
+
# @!attribute [rw] lat_lng
|
313
|
+
# @return [Google::Type::LatLng]
|
314
|
+
# lat/long location coordinates.
|
315
|
+
class LocationInfo; end
|
316
|
+
|
317
|
+
# A `Property` consists of a user-supplied name/value pair.
|
318
|
+
# @!attribute [rw] name
|
319
|
+
# @return [String]
|
320
|
+
# Name of the property.
|
321
|
+
# @!attribute [rw] value
|
322
|
+
# @return [String]
|
323
|
+
# Value of the property.
|
324
|
+
# @!attribute [rw] uint64_value
|
325
|
+
# @return [Integer]
|
326
|
+
# Value of numeric properties.
|
327
|
+
class Property; end
|
328
|
+
|
329
|
+
# Set of detected entity features.
|
330
|
+
# @!attribute [rw] mid
|
331
|
+
# @return [String]
|
332
|
+
# Opaque entity ID. Some IDs may be available in
|
333
|
+
# [Google Knowledge Graph Search
|
334
|
+
# API](https://developers.google.com/knowledge-graph/).
|
335
|
+
# @!attribute [rw] locale
|
336
|
+
# @return [String]
|
337
|
+
# The language code for the locale in which the entity textual
|
338
|
+
# `description` is expressed.
|
339
|
+
# @!attribute [rw] description
|
340
|
+
# @return [String]
|
341
|
+
# Entity textual description, expressed in its `locale` language.
|
342
|
+
# @!attribute [rw] score
|
343
|
+
# @return [Float]
|
344
|
+
# Overall score of the result. Range [0, 1].
|
345
|
+
# @!attribute [rw] confidence
|
346
|
+
# @return [Float]
|
347
|
+
# **Deprecated. Use `score` instead.**
|
348
|
+
# The accuracy of the entity detection in an image.
|
349
|
+
# For example, for an image in which the "Eiffel Tower" entity is detected,
|
350
|
+
# this field represents the confidence that there is a tower in the query
|
351
|
+
# image. Range [0, 1].
|
352
|
+
# @!attribute [rw] topicality
|
353
|
+
# @return [Float]
|
354
|
+
# The relevancy of the ICA (Image Content Annotation) label to the
|
355
|
+
# image. For example, the relevancy of "tower" is likely higher to an image
|
356
|
+
# containing the detected "Eiffel Tower" than to an image containing a
|
357
|
+
# detected distant towering building, even though the confidence that
|
358
|
+
# there is a tower in each image may be the same. Range [0, 1].
|
359
|
+
# @!attribute [rw] bounding_poly
|
360
|
+
# @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
|
361
|
+
# Image region to which this entity belongs. Not produced
|
362
|
+
# for `LABEL_DETECTION` features.
|
363
|
+
# @!attribute [rw] locations
|
364
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::LocationInfo>]
|
365
|
+
# The location information for the detected entity. Multiple
|
366
|
+
# `LocationInfo` elements can be present because one location may
|
367
|
+
# indicate the location of the scene in the image, and another location
|
368
|
+
# may indicate the location of the place where the image was taken.
|
369
|
+
# Location information is usually present for landmarks.
|
370
|
+
# @!attribute [rw] properties
|
371
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::Property>]
|
372
|
+
# Some entities may have optional user-supplied `Property` (name/value)
|
373
|
+
# fields, such a score or string that qualifies the entity.
|
374
|
+
class EntityAnnotation; end
|
375
|
+
|
376
|
+
# Set of detected objects with bounding boxes.
|
377
|
+
# @!attribute [rw] mid
|
378
|
+
# @return [String]
|
379
|
+
# Object ID that should align with EntityAnnotation mid.
|
380
|
+
# @!attribute [rw] language_code
|
381
|
+
# @return [String]
|
382
|
+
# The BCP-47 language code, such as "en-US" or "sr-Latn". For more
|
383
|
+
# information, see
|
384
|
+
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
|
385
|
+
# @!attribute [rw] name
|
386
|
+
# @return [String]
|
387
|
+
# Object name, expressed in its `language_code` language.
|
388
|
+
# @!attribute [rw] score
|
389
|
+
# @return [Float]
|
390
|
+
# Score of the result. Range [0, 1].
|
391
|
+
# @!attribute [rw] bounding_poly
|
392
|
+
# @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
|
393
|
+
# Image region to which this object belongs. This must be populated.
|
394
|
+
class LocalizedObjectAnnotation; end
|
395
|
+
|
396
|
+
# Set of features pertaining to the image, computed by computer vision
|
397
|
+
# methods over safe-search verticals (for example, adult, spoof, medical,
|
398
|
+
# violence).
|
399
|
+
# @!attribute [rw] adult
|
400
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
401
|
+
# Represents the adult content likelihood for the image. Adult content may
|
402
|
+
# contain elements such as nudity, pornographic images or cartoons, or
|
403
|
+
# sexual activities.
|
404
|
+
# @!attribute [rw] spoof
|
405
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
406
|
+
# Spoof likelihood. The likelihood that an modification
|
407
|
+
# was made to the image's canonical version to make it appear
|
408
|
+
# funny or offensive.
|
409
|
+
# @!attribute [rw] medical
|
410
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
411
|
+
# Likelihood that this is a medical image.
|
412
|
+
# @!attribute [rw] violence
|
413
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
414
|
+
# Likelihood that this image contains violent content.
|
415
|
+
# @!attribute [rw] racy
|
416
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Likelihood]
|
417
|
+
# Likelihood that the request image contains racy content. Racy content may
|
418
|
+
# include (but is not limited to) skimpy or sheer clothing, strategically
|
419
|
+
# covered nudity, lewd or provocative poses, or close-ups of sensitive
|
420
|
+
# body areas.
|
421
|
+
class SafeSearchAnnotation; end
|
422
|
+
|
423
|
+
# Rectangle determined by min and max `LatLng` pairs.
|
424
|
+
# @!attribute [rw] min_lat_lng
|
425
|
+
# @return [Google::Type::LatLng]
|
426
|
+
# Min lat/long pair.
|
427
|
+
# @!attribute [rw] max_lat_lng
|
428
|
+
# @return [Google::Type::LatLng]
|
429
|
+
# Max lat/long pair.
|
430
|
+
class LatLongRect; end
|
431
|
+
|
432
|
+
# Color information consists of RGB channels, score, and the fraction of
|
433
|
+
# the image that the color occupies in the image.
|
434
|
+
# @!attribute [rw] color
|
435
|
+
# @return [Google::Type::Color]
|
436
|
+
# RGB components of the color.
|
437
|
+
# @!attribute [rw] score
|
438
|
+
# @return [Float]
|
439
|
+
# Image-specific score for this color. Value in range [0, 1].
|
440
|
+
# @!attribute [rw] pixel_fraction
|
441
|
+
# @return [Float]
|
442
|
+
# The fraction of pixels the color occupies in the image.
|
443
|
+
# Value in range [0, 1].
|
444
|
+
class ColorInfo; end
|
445
|
+
|
446
|
+
# Set of dominant colors and their corresponding scores.
|
447
|
+
# @!attribute [rw] colors
|
448
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::ColorInfo>]
|
449
|
+
# RGB color values with their score and pixel fraction.
|
450
|
+
class DominantColorsAnnotation; end
|
451
|
+
|
452
|
+
# Stores image properties, such as dominant colors.
|
453
|
+
# @!attribute [rw] dominant_colors
|
454
|
+
# @return [Google::Cloud::Vision::V1p3beta1::DominantColorsAnnotation]
|
455
|
+
# If present, dominant colors completed successfully.
|
456
|
+
class ImageProperties; end
|
457
|
+
|
458
|
+
# Single crop hint that is used to generate a new crop when serving an image.
|
459
|
+
# @!attribute [rw] bounding_poly
|
460
|
+
# @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
|
461
|
+
# The bounding polygon for the crop region. The coordinates of the bounding
|
462
|
+
# box are in the original image's scale, as returned in `ImageParams`.
|
463
|
+
# @!attribute [rw] confidence
|
464
|
+
# @return [Float]
|
465
|
+
# Confidence of this being a salient region. Range [0, 1].
|
466
|
+
# @!attribute [rw] importance_fraction
|
467
|
+
# @return [Float]
|
468
|
+
# Fraction of importance of this salient region with respect to the original
|
469
|
+
# image.
|
470
|
+
class CropHint; end
|
471
|
+
|
472
|
+
# Set of crop hints that are used to generate new crops when serving images.
|
473
|
+
# @!attribute [rw] crop_hints
|
474
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::CropHint>]
|
475
|
+
# Crop hint results.
|
476
|
+
class CropHintsAnnotation; end
|
477
|
+
|
478
|
+
# Parameters for crop hints annotation request.
|
479
|
+
# @!attribute [rw] aspect_ratios
|
480
|
+
# @return [Array<Float>]
|
481
|
+
# Aspect ratios in floats, representing the ratio of the width to the height
|
482
|
+
# of the image. For example, if the desired aspect ratio is 4/3, the
|
483
|
+
# corresponding float value should be 1.33333. If not specified, the
|
484
|
+
# best possible crop is returned. The number of provided aspect ratios is
|
485
|
+
# limited to a maximum of 16; any aspect ratios provided after the 16th are
|
486
|
+
# ignored.
|
487
|
+
class CropHintsParams; end
|
488
|
+
|
489
|
+
# Parameters for web detection request.
|
490
|
+
# @!attribute [rw] include_geo_results
|
491
|
+
# @return [true, false]
|
492
|
+
# Whether to include results derived from the geo information in the image.
|
493
|
+
class WebDetectionParams; end
|
494
|
+
|
495
|
+
# Image context and/or feature-specific parameters.
|
496
|
+
# @!attribute [rw] lat_long_rect
|
497
|
+
# @return [Google::Cloud::Vision::V1p3beta1::LatLongRect]
|
498
|
+
# Not used.
|
499
|
+
# @!attribute [rw] language_hints
|
500
|
+
# @return [Array<String>]
|
501
|
+
# List of languages to use for TEXT_DETECTION. In most cases, an empty value
|
502
|
+
# yields the best results since it enables automatic language detection. For
|
503
|
+
# languages based on the Latin alphabet, setting `language_hints` is not
|
504
|
+
# needed. In rare cases, when the language of the text in the image is known,
|
505
|
+
# setting a hint will help get better results (although it will be a
|
506
|
+
# significant hindrance if the hint is wrong). Text detection returns an
|
507
|
+
# error if one or more of the specified languages is not one of the
|
508
|
+
# [supported languages](https://cloud.google.com/vision/docs/languages).
|
509
|
+
# @!attribute [rw] crop_hints_params
|
510
|
+
# @return [Google::Cloud::Vision::V1p3beta1::CropHintsParams]
|
511
|
+
# Parameters for crop hints annotation request.
|
512
|
+
# @!attribute [rw] product_search_params
|
513
|
+
# @return [Google::Cloud::Vision::V1p3beta1::ProductSearchParams]
|
514
|
+
# Parameters for product search.
|
515
|
+
# @!attribute [rw] web_detection_params
|
516
|
+
# @return [Google::Cloud::Vision::V1p3beta1::WebDetectionParams]
|
517
|
+
# Parameters for web detection.
|
518
|
+
class ImageContext; end
|
519
|
+
|
520
|
+
# Request for performing Google Cloud Vision API tasks over a user-provided
|
521
|
+
# image, with user-requested features.
|
522
|
+
# @!attribute [rw] image
|
523
|
+
# @return [Google::Cloud::Vision::V1p3beta1::Image]
|
524
|
+
# The image to be processed.
|
525
|
+
# @!attribute [rw] features
|
526
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::Feature>]
|
527
|
+
# Requested features.
|
528
|
+
# @!attribute [rw] image_context
|
529
|
+
# @return [Google::Cloud::Vision::V1p3beta1::ImageContext]
|
530
|
+
# Additional context that may accompany the image.
|
531
|
+
class AnnotateImageRequest; end
|
532
|
+
|
533
|
+
# If an image was produced from a file (e.g. a PDF), this message gives
|
534
|
+
# information about the source of that image.
|
535
|
+
# @!attribute [rw] uri
|
536
|
+
# @return [String]
|
537
|
+
# The URI of the file used to produce the image.
|
538
|
+
# @!attribute [rw] page_number
|
539
|
+
# @return [Integer]
|
540
|
+
# If the file was a PDF or TIFF, this field gives the page number within
|
541
|
+
# the file used to produce the image.
|
542
|
+
class ImageAnnotationContext; end
|
543
|
+
|
544
|
+
# Response to an image annotation request.
|
545
|
+
# @!attribute [rw] face_annotations
|
546
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::FaceAnnotation>]
|
547
|
+
# If present, face detection has completed successfully.
|
548
|
+
# @!attribute [rw] landmark_annotations
|
549
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::EntityAnnotation>]
|
550
|
+
# If present, landmark detection has completed successfully.
|
551
|
+
# @!attribute [rw] logo_annotations
|
552
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::EntityAnnotation>]
|
553
|
+
# If present, logo detection has completed successfully.
|
554
|
+
# @!attribute [rw] label_annotations
|
555
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::EntityAnnotation>]
|
556
|
+
# If present, label detection has completed successfully.
|
557
|
+
# @!attribute [rw] localized_object_annotations
|
558
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::LocalizedObjectAnnotation>]
|
559
|
+
# If present, localized object detection has completed successfully.
|
560
|
+
# This will be sorted descending by confidence score.
|
561
|
+
# @!attribute [rw] text_annotations
|
562
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::EntityAnnotation>]
|
563
|
+
# If present, text (OCR) detection has completed successfully.
|
564
|
+
# @!attribute [rw] full_text_annotation
|
565
|
+
# @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation]
|
566
|
+
# If present, text (OCR) detection or document (OCR) text detection has
|
567
|
+
# completed successfully.
|
568
|
+
# This annotation provides the structural hierarchy for the OCR detected
|
569
|
+
# text.
|
570
|
+
# @!attribute [rw] safe_search_annotation
|
571
|
+
# @return [Google::Cloud::Vision::V1p3beta1::SafeSearchAnnotation]
|
572
|
+
# If present, safe-search annotation has completed successfully.
|
573
|
+
# @!attribute [rw] image_properties_annotation
|
574
|
+
# @return [Google::Cloud::Vision::V1p3beta1::ImageProperties]
|
575
|
+
# If present, image properties were extracted successfully.
|
576
|
+
# @!attribute [rw] crop_hints_annotation
|
577
|
+
# @return [Google::Cloud::Vision::V1p3beta1::CropHintsAnnotation]
|
578
|
+
# If present, crop hints have completed successfully.
|
579
|
+
# @!attribute [rw] web_detection
|
580
|
+
# @return [Google::Cloud::Vision::V1p3beta1::WebDetection]
|
581
|
+
# If present, web detection has completed successfully.
|
582
|
+
# @!attribute [rw] product_search_results
|
583
|
+
# @return [Google::Cloud::Vision::V1p3beta1::ProductSearchResults]
|
584
|
+
# If present, product search has completed successfully.
|
585
|
+
# @!attribute [rw] error
|
586
|
+
# @return [Google::Rpc::Status]
|
587
|
+
# If set, represents the error message for the operation.
|
588
|
+
# Note that filled-in image annotations are guaranteed to be
|
589
|
+
# correct, even when `error` is set.
|
590
|
+
# @!attribute [rw] context
|
591
|
+
# @return [Google::Cloud::Vision::V1p3beta1::ImageAnnotationContext]
|
592
|
+
# If present, contextual information is needed to understand where this image
|
593
|
+
# comes from.
|
594
|
+
class AnnotateImageResponse; end
|
595
|
+
|
596
|
+
# Response to a single file annotation request. A file may contain one or more
|
597
|
+
# images, which individually have their own responses.
|
598
|
+
# @!attribute [rw] input_config
|
599
|
+
# @return [Google::Cloud::Vision::V1p3beta1::InputConfig]
|
600
|
+
# Information about the file for which this response is generated.
|
601
|
+
# @!attribute [rw] responses
|
602
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::AnnotateImageResponse>]
|
603
|
+
# Individual responses to images found within the file.
|
604
|
+
class AnnotateFileResponse; end
|
605
|
+
|
606
|
+
# Multiple image annotation requests are batched into a single service call.
|
607
|
+
# @!attribute [rw] requests
|
608
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::AnnotateImageRequest>]
|
609
|
+
# Individual image annotation requests for this batch.
|
610
|
+
class BatchAnnotateImagesRequest; end
|
611
|
+
|
612
|
+
# Response to a batch image annotation request.
|
613
|
+
# @!attribute [rw] responses
|
614
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::AnnotateImageResponse>]
|
615
|
+
# Individual responses to image annotation requests within the batch.
|
616
|
+
class BatchAnnotateImagesResponse; end
|
617
|
+
|
618
|
+
# An offline file annotation request.
|
619
|
+
# @!attribute [rw] input_config
|
620
|
+
# @return [Google::Cloud::Vision::V1p3beta1::InputConfig]
|
621
|
+
# Required. Information about the input file.
|
622
|
+
# @!attribute [rw] features
|
623
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::Feature>]
|
624
|
+
# Required. Requested features.
|
625
|
+
# @!attribute [rw] image_context
|
626
|
+
# @return [Google::Cloud::Vision::V1p3beta1::ImageContext]
|
627
|
+
# Additional context that may accompany the image(s) in the file.
|
628
|
+
# @!attribute [rw] output_config
|
629
|
+
# @return [Google::Cloud::Vision::V1p3beta1::OutputConfig]
|
630
|
+
# Required. The desired output location and metadata (e.g. format).
|
631
|
+
class AsyncAnnotateFileRequest; end
|
632
|
+
|
633
|
+
# The response for a single offline file annotation request.
|
634
|
+
# @!attribute [rw] output_config
|
635
|
+
# @return [Google::Cloud::Vision::V1p3beta1::OutputConfig]
|
636
|
+
# The output location and metadata from AsyncAnnotateFileRequest.
|
637
|
+
class AsyncAnnotateFileResponse; end
|
638
|
+
|
639
|
+
# Multiple async file annotation requests are batched into a single service
|
640
|
+
# call.
|
641
|
+
# @!attribute [rw] requests
|
642
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::AsyncAnnotateFileRequest>]
|
643
|
+
# Individual async file annotation requests for this batch.
|
644
|
+
class AsyncBatchAnnotateFilesRequest; end
|
645
|
+
|
646
|
+
# Response to an async batch file annotation request.
|
647
|
+
# @!attribute [rw] responses
|
648
|
+
# @return [Array<Google::Cloud::Vision::V1p3beta1::AsyncAnnotateFileResponse>]
|
649
|
+
# The list of file annotation responses, one for each request in
|
650
|
+
# AsyncBatchAnnotateFilesRequest.
|
651
|
+
class AsyncBatchAnnotateFilesResponse; end
|
652
|
+
|
653
|
+
# The desired input location and metadata.
|
654
|
+
# @!attribute [rw] gcs_source
|
655
|
+
# @return [Google::Cloud::Vision::V1p3beta1::GcsSource]
|
656
|
+
# The Google Cloud Storage location to read the input from.
|
657
|
+
# @!attribute [rw] mime_type
|
658
|
+
# @return [String]
|
659
|
+
# The type of the file. Currently only "application/pdf" and "image/tiff"
|
660
|
+
# are supported. Wildcards are not supported.
|
661
|
+
class InputConfig; end
|
662
|
+
|
663
|
+
# The desired output location and metadata.
|
664
|
+
# @!attribute [rw] gcs_destination
|
665
|
+
# @return [Google::Cloud::Vision::V1p3beta1::GcsDestination]
|
666
|
+
# The Google Cloud Storage location to write the output(s) to.
|
667
|
+
# @!attribute [rw] batch_size
|
668
|
+
# @return [Integer]
|
669
|
+
# The max number of response protos to put into each output JSON file on
|
670
|
+
# Google Cloud Storage.
|
671
|
+
# The valid range is [1, 100]. If not specified, the default value is 20.
|
672
|
+
#
|
673
|
+
# For example, for one pdf file with 100 pages, 100 response protos will
|
674
|
+
# be generated. If `batch_size` = 20, then 5 json files each
|
675
|
+
# containing 20 response protos will be written under the prefix
|
676
|
+
# `gcs_destination`.`uri`.
|
677
|
+
#
|
678
|
+
# Currently, batch_size only applies to GcsDestination, with potential future
|
679
|
+
# support for other output configurations.
|
680
|
+
class OutputConfig; end
|
681
|
+
|
682
|
+
# The Google Cloud Storage location where the input will be read from.
|
683
|
+
# @!attribute [rw] uri
|
684
|
+
# @return [String]
|
685
|
+
# Google Cloud Storage URI for the input file. This must only be a
|
686
|
+
# Google Cloud Storage object. Wildcards are not currently supported.
|
687
|
+
class GcsSource; end
|
688
|
+
|
689
|
+
# The Google Cloud Storage location where the output will be written to.
|
690
|
+
# @!attribute [rw] uri
|
691
|
+
# @return [String]
|
692
|
+
# Google Cloud Storage URI where the results will be stored. Results will
|
693
|
+
# be in JSON format and preceded by its corresponding input URI. This field
|
694
|
+
# can either represent a single file, or a prefix for multiple outputs.
|
695
|
+
# Prefixes must end in a `/`.
|
696
|
+
#
|
697
|
+
# Examples:
|
698
|
+
#
|
699
|
+
# * File: gs://bucket-name/filename.json
|
700
|
+
# * Prefix: gs://bucket-name/prefix/here/
|
701
|
+
# * File: gs://bucket-name/prefix/here
|
702
|
+
#
|
703
|
+
# If multiple outputs, each response is still AnnotateFileResponse, each of
|
704
|
+
# which contains some subset of the full list of AnnotateImageResponse.
|
705
|
+
# Multiple outputs can happen if, for example, the output JSON is too large
|
706
|
+
# and overflows into multiple sharded files.
|
707
|
+
class GcsDestination; end
|
708
|
+
|
709
|
+
# Contains metadata for the BatchAnnotateImages operation.
|
710
|
+
# @!attribute [rw] state
|
711
|
+
# @return [Google::Cloud::Vision::V1p3beta1::OperationMetadata::State]
|
712
|
+
# Current state of the batch operation.
|
713
|
+
# @!attribute [rw] create_time
|
714
|
+
# @return [Google::Protobuf::Timestamp]
|
715
|
+
# The time when the batch request was received.
|
716
|
+
# @!attribute [rw] update_time
|
717
|
+
# @return [Google::Protobuf::Timestamp]
|
718
|
+
# The time when the operation result was last updated.
|
719
|
+
class OperationMetadata
|
720
|
+
# Batch operation states.
|
721
|
+
module State
|
722
|
+
# Invalid.
|
723
|
+
STATE_UNSPECIFIED = 0
|
724
|
+
|
725
|
+
# Request is received.
|
726
|
+
CREATED = 1
|
727
|
+
|
728
|
+
# Request is actively being processed.
|
729
|
+
RUNNING = 2
|
730
|
+
|
731
|
+
# The batch processing is done.
|
732
|
+
DONE = 3
|
733
|
+
|
734
|
+
# The batch processing was cancelled.
|
735
|
+
CANCELLED = 4
|
736
|
+
end
|
737
|
+
end
|
738
|
+
|
739
|
+
# A bucketized representation of likelihood, which is intended to give clients
|
740
|
+
# highly stable results across model upgrades.
|
741
|
+
module Likelihood
|
742
|
+
# Unknown likelihood.
|
743
|
+
UNKNOWN = 0
|
744
|
+
|
745
|
+
# It is very unlikely that the image belongs to the specified vertical.
|
746
|
+
VERY_UNLIKELY = 1
|
747
|
+
|
748
|
+
# It is unlikely that the image belongs to the specified vertical.
|
749
|
+
UNLIKELY = 2
|
750
|
+
|
751
|
+
# It is possible that the image belongs to the specified vertical.
|
752
|
+
POSSIBLE = 3
|
753
|
+
|
754
|
+
# It is likely that the image belongs to the specified vertical.
|
755
|
+
LIKELY = 4
|
756
|
+
|
757
|
+
# It is very likely that the image belongs to the specified vertical.
|
758
|
+
VERY_LIKELY = 5
|
759
|
+
end
|
760
|
+
end
|
761
|
+
end
|
762
|
+
end
|
763
|
+
end
|