google-cloud-vision 0.37.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +343 -0
  6. data/README.md +35 -49
  7. data/lib/{google/cloud/vision/v1/doc/google/protobuf/wrappers.rb → google-cloud-vision.rb} +5 -12
  8. data/lib/google/cloud/vision.rb +132 -215
  9. data/lib/google/cloud/vision/version.rb +6 -2
  10. metadata +74 -102
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/vision/v1.rb +0 -249
  13. data/lib/google/cloud/vision/v1/credentials.rb +0 -42
  14. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +0 -66
  15. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +0 -923
  16. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +0 -115
  17. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +0 -569
  18. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +0 -254
  19. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +0 -102
  20. data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +0 -51
  21. data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +0 -131
  22. data/lib/google/cloud/vision/v1/doc/google/protobuf/empty.rb +0 -29
  23. data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +0 -222
  24. data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +0 -113
  25. data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +0 -87
  26. data/lib/google/cloud/vision/v1/doc/google/type/color.rb +0 -161
  27. data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +0 -31
  28. data/lib/google/cloud/vision/v1/geometry_pb.rb +0 -39
  29. data/lib/google/cloud/vision/v1/helpers.rb +0 -1154
  30. data/lib/google/cloud/vision/v1/image_annotator_client.rb +0 -516
  31. data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -46
  32. data/lib/google/cloud/vision/v1/image_annotator_pb.rb +0 -344
  33. data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +0 -74
  34. data/lib/google/cloud/vision/v1/product_search_client.rb +0 -1490
  35. data/lib/google/cloud/vision/v1/product_search_client_config.json +0 -121
  36. data/lib/google/cloud/vision/v1/product_search_pb.rb +0 -54
  37. data/lib/google/cloud/vision/v1/product_search_service_pb.rb +0 -207
  38. data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +0 -233
  39. data/lib/google/cloud/vision/v1/text_annotation_pb.rb +0 -94
  40. data/lib/google/cloud/vision/v1/web_detection_pb.rb +0 -51
  41. data/lib/google/cloud/vision/v1p3beta1.rb +0 -253
  42. data/lib/google/cloud/vision/v1p3beta1/credentials.rb +0 -42
  43. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +0 -72
  44. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +0 -763
  45. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +0 -156
  46. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +0 -538
  47. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +0 -255
  48. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +0 -101
  49. data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +0 -51
  50. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +0 -131
  51. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +0 -29
  52. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +0 -222
  53. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +0 -113
  54. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +0 -26
  55. data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +0 -87
  56. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +0 -161
  57. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +0 -31
  58. data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +0 -43
  59. data/lib/google/cloud/vision/v1p3beta1/helpers.rb +0 -1154
  60. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +0 -312
  61. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +0 -36
  62. data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +0 -304
  63. data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +0 -55
  64. data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +0 -1419
  65. data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +0 -116
  66. data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +0 -64
  67. data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +0 -191
  68. data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +0 -226
  69. data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -94
  70. data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -51
@@ -1,249 +0,0 @@
1
- # Copyright 2019 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/v1/image_annotator_client"
17
- require "google/cloud/vision/v1/helpers"
18
- require "google/cloud/vision/v1/product_search_client"
19
- require "google/cloud/vision/v1/product_search_service_pb"
20
- require "google/cloud/vision/v1/image_annotator_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,
32
- # and landmark detection, optical character recognition (OCR), and detection
33
- # of 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.dev/ruby/google-cloud-vision/latest/file.AUTHENTICATION.html)
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: :v1)
56
- # gcs_image_uri = "gs://cloud-samples-data/vision/face_detection/celebrity_recognition/sergey.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.dev/ruby/google-cloud-logging/latest)
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 V1
102
- # rubocop:enable LineLength
103
-
104
- module ImageAnnotator
105
- ##
106
- # Service that performs Google Cloud Vision API detection tasks over client
107
- # images, such as face, landmark, logo, label, and text detection. The
108
- # ImageAnnotator service returns detected entities from the images.
109
- #
110
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
111
- # Provides the means for authenticating requests made by the client. This parameter can
112
- # be many types.
113
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
114
- # authenticating requests made by this client.
115
- # A `String` will be treated as the path to the keyfile to be used for the construction of
116
- # credentials for this client.
117
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
118
- # credentials for this client.
119
- # A `GRPC::Core::Channel` will be used to make calls through.
120
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
121
- # should already be composed with a `GRPC::Core::CallCredentials` object.
122
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
123
- # metadata for requests, generally, to give OAuth credentials.
124
- # @param scopes [Array<String>]
125
- # The OAuth scopes for this service. This parameter is ignored if
126
- # an updater_proc is supplied.
127
- # @param client_config [Hash]
128
- # A Hash for call options for each method. See
129
- # Google::Gax#construct_settings for the structure of
130
- # this data. Falls back to the default config if not specified
131
- # or the specified config is missing data points.
132
- # @param timeout [Numeric]
133
- # The default timeout, in seconds, for calls made through this client.
134
- # @param metadata [Hash]
135
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
136
- # @param service_address [String]
137
- # Override for the service hostname, or `nil` to leave as the default.
138
- # @param service_port [Integer]
139
- # Override for the service port, or `nil` to leave as the default.
140
- # @param exception_transformer [Proc]
141
- # An optional proc that intercepts any exceptions raised during an API call to inject
142
- # custom error handling.
143
- def self.new \
144
- credentials: nil,
145
- scopes: nil,
146
- client_config: nil,
147
- timeout: nil,
148
- metadata: nil,
149
- service_address: nil,
150
- service_port: nil,
151
- exception_transformer: nil,
152
- lib_name: nil,
153
- lib_version: nil
154
- kwargs = {
155
- credentials: credentials,
156
- scopes: scopes,
157
- client_config: client_config,
158
- timeout: timeout,
159
- metadata: metadata,
160
- exception_transformer: exception_transformer,
161
- lib_name: lib_name,
162
- service_address: service_address,
163
- service_port: service_port,
164
- lib_version: lib_version
165
- }.select { |_, v| v != nil }
166
- Google::Cloud::Vision::V1::ImageAnnotatorClient.new(**kwargs)
167
- end
168
- end
169
-
170
- module ProductSearch
171
- ##
172
- # Manages Products and ProductSets of reference images for use in product
173
- # search. It uses the following resource model:
174
- #
175
- # * The API has a collection of {Google::Cloud::Vision::V1::ProductSet ProductSet} resources, named
176
- # `projects/*/locations/*/productSets/*`, which acts as a way to put different
177
- # products into groups to limit identification.
178
- #
179
- # In parallel,
180
- #
181
- # * The API has a collection of {Google::Cloud::Vision::V1::Product Product} resources, named
182
- # `projects/*/locations/*/products/*`
183
- #
184
- # * Each {Google::Cloud::Vision::V1::Product Product} has a collection of {Google::Cloud::Vision::V1::ReferenceImage ReferenceImage} resources, named
185
- # `projects/*/locations/*/products/*/referenceImages/*`
186
- #
187
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
188
- # Provides the means for authenticating requests made by the client. This parameter can
189
- # be many types.
190
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
191
- # authenticating requests made by this client.
192
- # A `String` will be treated as the path to the keyfile to be used for the construction of
193
- # credentials for this client.
194
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
195
- # credentials for this client.
196
- # A `GRPC::Core::Channel` will be used to make calls through.
197
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
198
- # should already be composed with a `GRPC::Core::CallCredentials` object.
199
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
200
- # metadata for requests, generally, to give OAuth credentials.
201
- # @param scopes [Array<String>]
202
- # The OAuth scopes for this service. This parameter is ignored if
203
- # an updater_proc is supplied.
204
- # @param client_config [Hash]
205
- # A Hash for call options for each method. See
206
- # Google::Gax#construct_settings for the structure of
207
- # this data. Falls back to the default config if not specified
208
- # or the specified config is missing data points.
209
- # @param timeout [Numeric]
210
- # The default timeout, in seconds, for calls made through this client.
211
- # @param metadata [Hash]
212
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
213
- # @param service_address [String]
214
- # Override for the service hostname, or `nil` to leave as the default.
215
- # @param service_port [Integer]
216
- # Override for the service port, or `nil` to leave as the default.
217
- # @param exception_transformer [Proc]
218
- # An optional proc that intercepts any exceptions raised during an API call to inject
219
- # custom error handling.
220
- def self.new \
221
- credentials: nil,
222
- scopes: nil,
223
- client_config: nil,
224
- timeout: nil,
225
- metadata: nil,
226
- service_address: nil,
227
- service_port: nil,
228
- exception_transformer: nil,
229
- lib_name: nil,
230
- lib_version: nil
231
- kwargs = {
232
- credentials: credentials,
233
- scopes: scopes,
234
- client_config: client_config,
235
- timeout: timeout,
236
- metadata: metadata,
237
- exception_transformer: exception_transformer,
238
- lib_name: lib_name,
239
- service_address: service_address,
240
- service_port: service_port,
241
- lib_version: lib_version
242
- }.select { |_, v| v != nil }
243
- Google::Cloud::Vision::V1::ProductSearchClient.new(**kwargs)
244
- end
245
- end
246
- end
247
- end
248
- end
249
- end
@@ -1,42 +0,0 @@
1
- # Copyright 2019 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 V1
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
@@ -1,66 +0,0 @@
1
- # Copyright 2019 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 V1
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::V1::Vertex>]
44
- # The bounding polygon vertices.
45
- # @!attribute [rw] normalized_vertices
46
- # @return [Array<Google::Cloud::Vision::V1::NormalizedVertex>]
47
- # The bounding polygon normalized vertices.
48
- class BoundingPoly; end
49
-
50
- # A 3D position in the image, used primarily for Face detection landmarks.
51
- # A valid Position must have both x and y coordinates.
52
- # The position coordinates are in the same scale as the original image.
53
- # @!attribute [rw] x
54
- # @return [Float]
55
- # X coordinate.
56
- # @!attribute [rw] y
57
- # @return [Float]
58
- # Y coordinate.
59
- # @!attribute [rw] z
60
- # @return [Float]
61
- # Z coordinate (or depth).
62
- class Position; end
63
- end
64
- end
65
- end
66
- end
@@ -1,923 +0,0 @@
1
- # Copyright 2019 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 V1
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::V1::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::V1::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::V1::BoundingPoly]
130
- # The bounding polygon around the face. The coordinates of the bounding box
131
- # are in the original image's scale.
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::V1::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::V1::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::V1::Likelihood]
170
- # Joy likelihood.
171
- # @!attribute [rw] sorrow_likelihood
172
- # @return [Google::Cloud::Vision::V1::Likelihood]
173
- # Sorrow likelihood.
174
- # @!attribute [rw] anger_likelihood
175
- # @return [Google::Cloud::Vision::V1::Likelihood]
176
- # Anger likelihood.
177
- # @!attribute [rw] surprise_likelihood
178
- # @return [Google::Cloud::Vision::V1::Likelihood]
179
- # Surprise likelihood.
180
- # @!attribute [rw] under_exposed_likelihood
181
- # @return [Google::Cloud::Vision::V1::Likelihood]
182
- # Under-exposed likelihood.
183
- # @!attribute [rw] blurred_likelihood
184
- # @return [Google::Cloud::Vision::V1::Likelihood]
185
- # Blurred likelihood.
186
- # @!attribute [rw] headwear_likelihood
187
- # @return [Google::Cloud::Vision::V1::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::V1::FaceAnnotation::Landmark::Type]
193
- # Face landmark type.
194
- # @!attribute [rw] position
195
- # @return [Google::Cloud::Vision::V1::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::V1::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::V1::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::V1::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::V1::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::V1::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::V1::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::V1::Likelihood]
411
- # Likelihood that this is a medical image.
412
- # @!attribute [rw] violence
413
- # @return [Google::Cloud::Vision::V1::Likelihood]
414
- # Likelihood that this image contains violent content.
415
- # @!attribute [rw] racy
416
- # @return [Google::Cloud::Vision::V1::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
- # @!attribute [rw] adult_confidence
422
- # @return [Float]
423
- # Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means
424
- # very confident.
425
- # @!attribute [rw] spoof_confidence
426
- # @return [Float]
427
- # Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means
428
- # very confident.
429
- # @!attribute [rw] medical_confidence
430
- # @return [Float]
431
- # Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means
432
- # very confident.
433
- # @!attribute [rw] violence_confidence
434
- # @return [Float]
435
- # Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means
436
- # very confident.
437
- # @!attribute [rw] racy_confidence
438
- # @return [Float]
439
- # Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very
440
- # confident.
441
- # @!attribute [rw] nsfw_confidence
442
- # @return [Float]
443
- # Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very
444
- # confident.
445
- class SafeSearchAnnotation; end
446
-
447
- # Rectangle determined by min and max `LatLng` pairs.
448
- # @!attribute [rw] min_lat_lng
449
- # @return [Google::Type::LatLng]
450
- # Min lat/long pair.
451
- # @!attribute [rw] max_lat_lng
452
- # @return [Google::Type::LatLng]
453
- # Max lat/long pair.
454
- class LatLongRect; end
455
-
456
- # Color information consists of RGB channels, score, and the fraction of
457
- # the image that the color occupies in the image.
458
- # @!attribute [rw] color
459
- # @return [Google::Type::Color]
460
- # RGB components of the color.
461
- # @!attribute [rw] score
462
- # @return [Float]
463
- # Image-specific score for this color. Value in range [0, 1].
464
- # @!attribute [rw] pixel_fraction
465
- # @return [Float]
466
- # The fraction of pixels the color occupies in the image.
467
- # Value in range [0, 1].
468
- class ColorInfo; end
469
-
470
- # Set of dominant colors and their corresponding scores.
471
- # @!attribute [rw] colors
472
- # @return [Array<Google::Cloud::Vision::V1::ColorInfo>]
473
- # RGB color values with their score and pixel fraction.
474
- class DominantColorsAnnotation; end
475
-
476
- # Stores image properties, such as dominant colors.
477
- # @!attribute [rw] dominant_colors
478
- # @return [Google::Cloud::Vision::V1::DominantColorsAnnotation]
479
- # If present, dominant colors completed successfully.
480
- class ImageProperties; end
481
-
482
- # Single crop hint that is used to generate a new crop when serving an image.
483
- # @!attribute [rw] bounding_poly
484
- # @return [Google::Cloud::Vision::V1::BoundingPoly]
485
- # The bounding polygon for the crop region. The coordinates of the bounding
486
- # box are in the original image's scale.
487
- # @!attribute [rw] confidence
488
- # @return [Float]
489
- # Confidence of this being a salient region. Range [0, 1].
490
- # @!attribute [rw] importance_fraction
491
- # @return [Float]
492
- # Fraction of importance of this salient region with respect to the original
493
- # image.
494
- class CropHint; end
495
-
496
- # Set of crop hints that are used to generate new crops when serving images.
497
- # @!attribute [rw] crop_hints
498
- # @return [Array<Google::Cloud::Vision::V1::CropHint>]
499
- # Crop hint results.
500
- class CropHintsAnnotation; end
501
-
502
- # Parameters for crop hints annotation request.
503
- # @!attribute [rw] aspect_ratios
504
- # @return [Array<Float>]
505
- # Aspect ratios in floats, representing the ratio of the width to the height
506
- # of the image. For example, if the desired aspect ratio is 4/3, the
507
- # corresponding float value should be 1.33333. If not specified, the
508
- # best possible crop is returned. The number of provided aspect ratios is
509
- # limited to a maximum of 16; any aspect ratios provided after the 16th are
510
- # ignored.
511
- class CropHintsParams; end
512
-
513
- # Parameters for web detection request.
514
- # @!attribute [rw] include_geo_results
515
- # @return [true, false]
516
- # Whether to include results derived from the geo information in the image.
517
- class WebDetectionParams; end
518
-
519
- # Image context and/or feature-specific parameters.
520
- # @!attribute [rw] lat_long_rect
521
- # @return [Google::Cloud::Vision::V1::LatLongRect]
522
- # Not used.
523
- # @!attribute [rw] language_hints
524
- # @return [Array<String>]
525
- # List of languages to use for TEXT_DETECTION. In most cases, an empty value
526
- # yields the best results since it enables automatic language detection. For
527
- # languages based on the Latin alphabet, setting `language_hints` is not
528
- # needed. In rare cases, when the language of the text in the image is known,
529
- # setting a hint will help get better results (although it will be a
530
- # significant hindrance if the hint is wrong). Text detection returns an
531
- # error if one or more of the specified languages is not one of the
532
- # [supported languages](https://cloud.google.com/vision/docs/languages).
533
- # @!attribute [rw] crop_hints_params
534
- # @return [Google::Cloud::Vision::V1::CropHintsParams]
535
- # Parameters for crop hints annotation request.
536
- # @!attribute [rw] product_search_params
537
- # @return [Google::Cloud::Vision::V1::ProductSearchParams]
538
- # Parameters for product search.
539
- # @!attribute [rw] web_detection_params
540
- # @return [Google::Cloud::Vision::V1::WebDetectionParams]
541
- # Parameters for web detection.
542
- class ImageContext; end
543
-
544
- # Request for performing Google Cloud Vision API tasks over a user-provided
545
- # image, with user-requested features, and with context information.
546
- # @!attribute [rw] image
547
- # @return [Google::Cloud::Vision::V1::Image]
548
- # The image to be processed.
549
- # @!attribute [rw] features
550
- # @return [Array<Google::Cloud::Vision::V1::Feature>]
551
- # Requested features.
552
- # @!attribute [rw] image_context
553
- # @return [Google::Cloud::Vision::V1::ImageContext]
554
- # Additional context that may accompany the image.
555
- class AnnotateImageRequest; end
556
-
557
- # If an image was produced from a file (e.g. a PDF), this message gives
558
- # information about the source of that image.
559
- # @!attribute [rw] uri
560
- # @return [String]
561
- # The URI of the file used to produce the image.
562
- # @!attribute [rw] page_number
563
- # @return [Integer]
564
- # If the file was a PDF or TIFF, this field gives the page number within
565
- # the file used to produce the image.
566
- class ImageAnnotationContext; end
567
-
568
- # Response to an image annotation request.
569
- # @!attribute [rw] face_annotations
570
- # @return [Array<Google::Cloud::Vision::V1::FaceAnnotation>]
571
- # If present, face detection has completed successfully.
572
- # @!attribute [rw] landmark_annotations
573
- # @return [Array<Google::Cloud::Vision::V1::EntityAnnotation>]
574
- # If present, landmark detection has completed successfully.
575
- # @!attribute [rw] logo_annotations
576
- # @return [Array<Google::Cloud::Vision::V1::EntityAnnotation>]
577
- # If present, logo detection has completed successfully.
578
- # @!attribute [rw] label_annotations
579
- # @return [Array<Google::Cloud::Vision::V1::EntityAnnotation>]
580
- # If present, label detection has completed successfully.
581
- # @!attribute [rw] localized_object_annotations
582
- # @return [Array<Google::Cloud::Vision::V1::LocalizedObjectAnnotation>]
583
- # If present, localized object detection has completed successfully.
584
- # This will be sorted descending by confidence score.
585
- # @!attribute [rw] text_annotations
586
- # @return [Array<Google::Cloud::Vision::V1::EntityAnnotation>]
587
- # If present, text (OCR) detection has completed successfully.
588
- # @!attribute [rw] full_text_annotation
589
- # @return [Google::Cloud::Vision::V1::TextAnnotation]
590
- # If present, text (OCR) detection or document (OCR) text detection has
591
- # completed successfully.
592
- # This annotation provides the structural hierarchy for the OCR detected
593
- # text.
594
- # @!attribute [rw] safe_search_annotation
595
- # @return [Google::Cloud::Vision::V1::SafeSearchAnnotation]
596
- # If present, safe-search annotation has completed successfully.
597
- # @!attribute [rw] image_properties_annotation
598
- # @return [Google::Cloud::Vision::V1::ImageProperties]
599
- # If present, image properties were extracted successfully.
600
- # @!attribute [rw] crop_hints_annotation
601
- # @return [Google::Cloud::Vision::V1::CropHintsAnnotation]
602
- # If present, crop hints have completed successfully.
603
- # @!attribute [rw] web_detection
604
- # @return [Google::Cloud::Vision::V1::WebDetection]
605
- # If present, web detection has completed successfully.
606
- # @!attribute [rw] product_search_results
607
- # @return [Google::Cloud::Vision::V1::ProductSearchResults]
608
- # If present, product search has completed successfully.
609
- # @!attribute [rw] error
610
- # @return [Google::Rpc::Status]
611
- # If set, represents the error message for the operation.
612
- # Note that filled-in image annotations are guaranteed to be
613
- # correct, even when `error` is set.
614
- # @!attribute [rw] context
615
- # @return [Google::Cloud::Vision::V1::ImageAnnotationContext]
616
- # If present, contextual information is needed to understand where this image
617
- # comes from.
618
- class AnnotateImageResponse; end
619
-
620
- # Multiple image annotation requests are batched into a single service call.
621
- # @!attribute [rw] requests
622
- # @return [Array<Google::Cloud::Vision::V1::AnnotateImageRequest>]
623
- # Required. Individual image annotation requests for this batch.
624
- # @!attribute [rw] parent
625
- # @return [String]
626
- # Optional. Target project and location to make a call.
627
- #
628
- # Format: `projects/{project-id}/locations/{location-id}`.
629
- #
630
- # If no parent is specified, a region will be chosen automatically.
631
- #
632
- # Supported location-ids:
633
- # `us`: USA country only,
634
- # `asia`: East asia areas, like Japan, Taiwan,
635
- # `eu`: The European Union.
636
- #
637
- # Example: `projects/project-A/locations/eu`.
638
- class BatchAnnotateImagesRequest; end
639
-
640
- # Response to a batch image annotation request.
641
- # @!attribute [rw] responses
642
- # @return [Array<Google::Cloud::Vision::V1::AnnotateImageResponse>]
643
- # Individual responses to image annotation requests within the batch.
644
- class BatchAnnotateImagesResponse; end
645
-
646
- # A request to annotate one single file, e.g. a PDF, TIFF or GIF file.
647
- # @!attribute [rw] input_config
648
- # @return [Google::Cloud::Vision::V1::InputConfig]
649
- # Required. Information about the input file.
650
- # @!attribute [rw] features
651
- # @return [Array<Google::Cloud::Vision::V1::Feature>]
652
- # Required. Requested features.
653
- # @!attribute [rw] image_context
654
- # @return [Google::Cloud::Vision::V1::ImageContext]
655
- # Additional context that may accompany the image(s) in the file.
656
- # @!attribute [rw] pages
657
- # @return [Array<Integer>]
658
- # Pages of the file to perform image annotation.
659
- #
660
- # Pages starts from 1, we assume the first page of the file is page 1.
661
- # At most 5 pages are supported per request. Pages can be negative.
662
- #
663
- # Page 1 means the first page.
664
- # Page 2 means the second page.
665
- # Page -1 means the last page.
666
- # Page -2 means the second to the last page.
667
- #
668
- # If the file is GIF instead of PDF or TIFF, page refers to GIF frames.
669
- #
670
- # If this field is empty, by default the service performs image annotation
671
- # for the first 5 pages of the file.
672
- class AnnotateFileRequest; end
673
-
674
- # Response to a single file annotation request. A file may contain one or more
675
- # images, which individually have their own responses.
676
- # @!attribute [rw] input_config
677
- # @return [Google::Cloud::Vision::V1::InputConfig]
678
- # Information about the file for which this response is generated.
679
- # @!attribute [rw] responses
680
- # @return [Array<Google::Cloud::Vision::V1::AnnotateImageResponse>]
681
- # Individual responses to images found within the file. This field will be
682
- # empty if the `error` field is set.
683
- # @!attribute [rw] total_pages
684
- # @return [Integer]
685
- # This field gives the total number of pages in the file.
686
- # @!attribute [rw] error
687
- # @return [Google::Rpc::Status]
688
- # If set, represents the error message for the failed request. The
689
- # `responses` field will not be set in this case.
690
- class AnnotateFileResponse; end
691
-
692
- # A list of requests to annotate files using the BatchAnnotateFiles API.
693
- # @!attribute [rw] requests
694
- # @return [Array<Google::Cloud::Vision::V1::AnnotateFileRequest>]
695
- # Required. The list of file annotation requests. Right now we support only one
696
- # AnnotateFileRequest in BatchAnnotateFilesRequest.
697
- # @!attribute [rw] parent
698
- # @return [String]
699
- # Optional. Target project and location to make a call.
700
- #
701
- # Format: `projects/{project-id}/locations/{location-id}`.
702
- #
703
- # If no parent is specified, a region will be chosen automatically.
704
- #
705
- # Supported location-ids:
706
- # `us`: USA country only,
707
- # `asia`: East asia areas, like Japan, Taiwan,
708
- # `eu`: The European Union.
709
- #
710
- # Example: `projects/project-A/locations/eu`.
711
- class BatchAnnotateFilesRequest; end
712
-
713
- # A list of file annotation responses.
714
- # @!attribute [rw] responses
715
- # @return [Array<Google::Cloud::Vision::V1::AnnotateFileResponse>]
716
- # The list of file annotation responses, each response corresponding to each
717
- # AnnotateFileRequest in BatchAnnotateFilesRequest.
718
- class BatchAnnotateFilesResponse; end
719
-
720
- # An offline file annotation request.
721
- # @!attribute [rw] input_config
722
- # @return [Google::Cloud::Vision::V1::InputConfig]
723
- # Required. Information about the input file.
724
- # @!attribute [rw] features
725
- # @return [Array<Google::Cloud::Vision::V1::Feature>]
726
- # Required. Requested features.
727
- # @!attribute [rw] image_context
728
- # @return [Google::Cloud::Vision::V1::ImageContext]
729
- # Additional context that may accompany the image(s) in the file.
730
- # @!attribute [rw] output_config
731
- # @return [Google::Cloud::Vision::V1::OutputConfig]
732
- # Required. The desired output location and metadata (e.g. format).
733
- class AsyncAnnotateFileRequest; end
734
-
735
- # The response for a single offline file annotation request.
736
- # @!attribute [rw] output_config
737
- # @return [Google::Cloud::Vision::V1::OutputConfig]
738
- # The output location and metadata from AsyncAnnotateFileRequest.
739
- class AsyncAnnotateFileResponse; end
740
-
741
- # Request for async image annotation for a list of images.
742
- # @!attribute [rw] requests
743
- # @return [Array<Google::Cloud::Vision::V1::AnnotateImageRequest>]
744
- # Required. Individual image annotation requests for this batch.
745
- # @!attribute [rw] output_config
746
- # @return [Google::Cloud::Vision::V1::OutputConfig]
747
- # Required. The desired output location and metadata (e.g. format).
748
- # @!attribute [rw] parent
749
- # @return [String]
750
- # Optional. Target project and location to make a call.
751
- #
752
- # Format: `projects/{project-id}/locations/{location-id}`.
753
- #
754
- # If no parent is specified, a region will be chosen automatically.
755
- #
756
- # Supported location-ids:
757
- # `us`: USA country only,
758
- # `asia`: East asia areas, like Japan, Taiwan,
759
- # `eu`: The European Union.
760
- #
761
- # Example: `projects/project-A/locations/eu`.
762
- class AsyncBatchAnnotateImagesRequest; end
763
-
764
- # Response to an async batch image annotation request.
765
- # @!attribute [rw] output_config
766
- # @return [Google::Cloud::Vision::V1::OutputConfig]
767
- # The output location and metadata from AsyncBatchAnnotateImagesRequest.
768
- class AsyncBatchAnnotateImagesResponse; end
769
-
770
- # Multiple async file annotation requests are batched into a single service
771
- # call.
772
- # @!attribute [rw] requests
773
- # @return [Array<Google::Cloud::Vision::V1::AsyncAnnotateFileRequest>]
774
- # Required. Individual async file annotation requests for this batch.
775
- # @!attribute [rw] parent
776
- # @return [String]
777
- # Optional. Target project and location to make a call.
778
- #
779
- # Format: `projects/{project-id}/locations/{location-id}`.
780
- #
781
- # If no parent is specified, a region will be chosen automatically.
782
- #
783
- # Supported location-ids:
784
- # `us`: USA country only,
785
- # `asia`: East asia areas, like Japan, Taiwan,
786
- # `eu`: The European Union.
787
- #
788
- # Example: `projects/project-A/locations/eu`.
789
- class AsyncBatchAnnotateFilesRequest; end
790
-
791
- # Response to an async batch file annotation request.
792
- # @!attribute [rw] responses
793
- # @return [Array<Google::Cloud::Vision::V1::AsyncAnnotateFileResponse>]
794
- # The list of file annotation responses, one for each request in
795
- # AsyncBatchAnnotateFilesRequest.
796
- class AsyncBatchAnnotateFilesResponse; end
797
-
798
- # The desired input location and metadata.
799
- # @!attribute [rw] gcs_source
800
- # @return [Google::Cloud::Vision::V1::GcsSource]
801
- # The Google Cloud Storage location to read the input from.
802
- # @!attribute [rw] content
803
- # @return [String]
804
- # File content, represented as a stream of bytes.
805
- # Note: As with all `bytes` fields, protobuffers use a pure binary
806
- # representation, whereas JSON representations use base64.
807
- #
808
- # Currently, this field only works for BatchAnnotateFiles requests. It does
809
- # not work for AsyncBatchAnnotateFiles requests.
810
- # @!attribute [rw] mime_type
811
- # @return [String]
812
- # The type of the file. Currently only "application/pdf", "image/tiff" and
813
- # "image/gif" are supported. Wildcards are not supported.
814
- class InputConfig; end
815
-
816
- # The desired output location and metadata.
817
- # @!attribute [rw] gcs_destination
818
- # @return [Google::Cloud::Vision::V1::GcsDestination]
819
- # The Google Cloud Storage location to write the output(s) to.
820
- # @!attribute [rw] batch_size
821
- # @return [Integer]
822
- # The max number of response protos to put into each output JSON file on
823
- # Google Cloud Storage.
824
- # The valid range is [1, 100]. If not specified, the default value is 20.
825
- #
826
- # For example, for one pdf file with 100 pages, 100 response protos will
827
- # be generated. If `batch_size` = 20, then 5 json files each
828
- # containing 20 response protos will be written under the prefix
829
- # `gcs_destination`.`uri`.
830
- #
831
- # Currently, batch_size only applies to GcsDestination, with potential future
832
- # support for other output configurations.
833
- class OutputConfig; end
834
-
835
- # The Google Cloud Storage location where the input will be read from.
836
- # @!attribute [rw] uri
837
- # @return [String]
838
- # Google Cloud Storage URI for the input file. This must only be a
839
- # Google Cloud Storage object. Wildcards are not currently supported.
840
- class GcsSource; end
841
-
842
- # The Google Cloud Storage location where the output will be written to.
843
- # @!attribute [rw] uri
844
- # @return [String]
845
- # Google Cloud Storage URI prefix where the results will be stored. Results
846
- # will be in JSON format and preceded by its corresponding input URI prefix.
847
- # This field can either represent a gcs file prefix or gcs directory. In
848
- # either case, the uri should be unique because in order to get all of the
849
- # output files, you will need to do a wildcard gcs search on the uri prefix
850
- # you provide.
851
- #
852
- # Examples:
853
- #
854
- # * File Prefix: gs://bucket-name/here/filenameprefix The output files
855
- # will be created in gs://bucket-name/here/ and the names of the
856
- # output files will begin with "filenameprefix".
857
- #
858
- # * Directory Prefix: gs://bucket-name/some/location/ The output files
859
- # will be created in gs://bucket-name/some/location/ and the names of the
860
- # output files could be anything because there was no filename prefix
861
- # specified.
862
- #
863
- # If multiple outputs, each response is still AnnotateFileResponse, each of
864
- # which contains some subset of the full list of AnnotateImageResponse.
865
- # Multiple outputs can happen if, for example, the output JSON is too large
866
- # and overflows into multiple sharded files.
867
- class GcsDestination; end
868
-
869
- # Contains metadata for the BatchAnnotateImages operation.
870
- # @!attribute [rw] state
871
- # @return [Google::Cloud::Vision::V1::OperationMetadata::State]
872
- # Current state of the batch operation.
873
- # @!attribute [rw] create_time
874
- # @return [Google::Protobuf::Timestamp]
875
- # The time when the batch request was received.
876
- # @!attribute [rw] update_time
877
- # @return [Google::Protobuf::Timestamp]
878
- # The time when the operation result was last updated.
879
- class OperationMetadata
880
- # Batch operation states.
881
- module State
882
- # Invalid.
883
- STATE_UNSPECIFIED = 0
884
-
885
- # Request is received.
886
- CREATED = 1
887
-
888
- # Request is actively being processed.
889
- RUNNING = 2
890
-
891
- # The batch processing is done.
892
- DONE = 3
893
-
894
- # The batch processing was cancelled.
895
- CANCELLED = 4
896
- end
897
- end
898
-
899
- # A bucketized representation of likelihood, which is intended to give clients
900
- # highly stable results across model upgrades.
901
- module Likelihood
902
- # Unknown likelihood.
903
- UNKNOWN = 0
904
-
905
- # It is very unlikely.
906
- VERY_UNLIKELY = 1
907
-
908
- # It is unlikely.
909
- UNLIKELY = 2
910
-
911
- # It is possible.
912
- POSSIBLE = 3
913
-
914
- # It is likely.
915
- LIKELY = 4
916
-
917
- # It is very likely.
918
- VERY_LIKELY = 5
919
- end
920
- end
921
- end
922
- end
923
- end