blob: 03fd05b7a4f1b314bb4a608738c8307ce1dbd5f7 [file] [log] [blame]
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="vision_v1p2beta1.html">Cloud Vision API</a> . <a href="vision_v1p2beta1.images.html">images</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070078 <code><a href="#annotate">annotate(body=None, x__xgafv=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070079<p class="firstline">Run image detection and annotation for a batch of images.</p>
80<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070081 <code><a href="#asyncBatchAnnotate">asyncBatchAnnotate(body=None, x__xgafv=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070082<p class="firstline">Run asynchronous image detection and annotation for a list of images.</p>
83<h3>Method Details</h3>
84<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -070085 <code class="details" id="annotate">annotate(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070086 <pre>Run image detection and annotation for a batch of images.
87
88Args:
Dan O'Mearadd494642020-05-01 07:42:23 -070089 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070090 The object takes the form of:
91
92{ # Multiple image annotation requests are batched into a single service call.
Bu Sun Kim65020912020-05-20 12:08:20 -070093 &quot;requests&quot;: [ # Required. Individual image annotation requests for this batch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070094 { # Request for performing Google Cloud Vision API tasks over a user-provided
95 # image, with user-requested features, and with context information.
Bu Sun Kim65020912020-05-20 12:08:20 -070096 &quot;image&quot;: { # Client image to perform Google Cloud Vision API tasks over. # The image to be processed.
97 &quot;content&quot;: &quot;A String&quot;, # Image content, represented as a stream of bytes.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070098 # Note: As with all `bytes` fields, protobuffers use a pure binary
99 # representation, whereas JSON representations use base64.
Bu Sun Kim65020912020-05-20 12:08:20 -0700100 &quot;source&quot;: { # External image source (Google Cloud Storage or web URL image location). # Google Cloud Storage image location, or publicly-accessible image
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700101 # URL. If both `content` and `source` are provided for an image, `content`
102 # takes precedence and is used to perform the image annotation request.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700103 &quot;gcsImageUri&quot;: &quot;A String&quot;, # **Use `image_uri` instead.**
104 #
105 # The Google Cloud Storage URI of the form
106 # `gs://bucket_name/object_name`. Object versioning is not supported. See
107 # [Google Cloud Storage Request
108 # URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
Bu Sun Kim65020912020-05-20 12:08:20 -0700109 &quot;imageUri&quot;: &quot;A String&quot;, # The URI of the source image. Can be either:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700110 #
111 # 1. A Google Cloud Storage URI of the form
112 # `gs://bucket_name/object_name`. Object versioning is not supported. See
113 # [Google Cloud Storage Request
114 # URIs](https://cloud.google.com/storage/docs/reference-uris) for more
115 # info.
116 #
117 # 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
118 # HTTP/HTTPS URLs, Google cannot guarantee that the request will be
119 # completed. Your request may fail if the specified host denies the
120 # request (e.g. due to request throttling or DOS prevention), or if Google
121 # throttles requests to the site for abuse prevention. You should not
122 # depend on externally-hosted images for production applications.
123 #
124 # When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
125 # precedence.
126 },
127 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700128 &quot;features&quot;: [ # Requested features.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700129 { # The type of Google Cloud Vision API detection to perform, and the maximum
130 # number of results to return for that type. Multiple `Feature` objects can
131 # be specified in the `features` list.
Bu Sun Kim65020912020-05-20 12:08:20 -0700132 &quot;type&quot;: &quot;A String&quot;, # The feature type.
133 &quot;maxResults&quot;: 42, # Maximum number of results of this type. Does not apply to
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700134 # `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
Bu Sun Kim65020912020-05-20 12:08:20 -0700135 &quot;model&quot;: &quot;A String&quot;, # Model to use for the feature.
136 # Supported values: &quot;builtin/stable&quot; (the default if unset) and
137 # &quot;builtin/latest&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700138 },
139 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700140 &quot;imageContext&quot;: { # Image context and/or feature-specific parameters. # Additional context that may accompany the image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700141 &quot;cropHintsParams&quot;: { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request.
142 &quot;aspectRatios&quot;: [ # Aspect ratios in floats, representing the ratio of the width to the height
143 # of the image. For example, if the desired aspect ratio is 4/3, the
144 # corresponding float value should be 1.33333. If not specified, the
145 # best possible crop is returned. The number of provided aspect ratios is
146 # limited to a maximum of 16; any aspect ratios provided after the 16th are
147 # ignored.
148 3.14,
149 ],
150 },
151 &quot;productSearchParams&quot;: { # Parameters for a product search request. # Parameters for product search.
Bu Sun Kim65020912020-05-20 12:08:20 -0700152 &quot;productCategories&quot;: [ # The list of product categories to search in. Currently, we only consider
153 # the first category, and either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, &quot;toys-v2&quot;,
154 # &quot;packagedgoods-v1&quot;, or &quot;general-v1&quot; should be specified. The legacy
155 # categories &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported but will
156 # be deprecated. For new products, please use &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;,
157 # or &quot;toys-v2&quot; for better product search accuracy. It is recommended to
158 # migrate existing products to these categories as well.
159 &quot;A String&quot;,
160 ],
161 &quot;filter&quot;: &quot;A String&quot;, # The filtering expression. This can be used to restrict search results based
162 # on Product labels. We currently support an AND of OR of key-value
163 # expressions, where each expression within an OR must have the same key. An
164 # &#x27;=&#x27; should be used to connect the key and value.
165 #
166 # For example, &quot;(color = red OR color = blue) AND brand = Google&quot; is
167 # acceptable, but &quot;(color = red OR brand = Google)&quot; is not acceptable.
168 # &quot;color: red&quot; is not acceptable because it uses a &#x27;:&#x27; instead of an &#x27;=&#x27;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700169 &quot;productSet&quot;: &quot;A String&quot;, # The resource name of a ProductSet to be searched for similar images.
170 #
171 # Format is:
172 # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
173 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image.
174 # If it is not specified, system discretion will be applied.
175 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
176 { # A vertex represents a 2D point in the image.
177 # NOTE: the normalized vertex coordinates are relative to the original image
178 # and range from 0 to 1.
179 &quot;x&quot;: 3.14, # X coordinate.
180 &quot;y&quot;: 3.14, # Y coordinate.
181 },
182 ],
183 &quot;vertices&quot;: [ # The bounding polygon vertices.
184 { # A vertex represents a 2D point in the image.
185 # NOTE: the vertex coordinates are in the same scale as the original image.
186 &quot;y&quot;: 42, # Y coordinate.
187 &quot;x&quot;: 42, # X coordinate.
188 },
189 ],
190 },
191 },
192 &quot;languageHints&quot;: [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value
193 # yields the best results since it enables automatic language detection. For
194 # languages based on the Latin alphabet, setting `language_hints` is not
195 # needed. In rare cases, when the language of the text in the image is known,
196 # setting a hint will help get better results (although it will be a
197 # significant hindrance if the hint is wrong). Text detection returns an
198 # error if one or more of the specified languages is not one of the
199 # [supported languages](https://cloud.google.com/vision/docs/languages).
200 &quot;A String&quot;,
201 ],
202 &quot;webDetectionParams&quot;: { # Parameters for web detection request. # Parameters for web detection.
203 &quot;includeGeoResults&quot;: True or False, # Whether to include results derived from the geo information in the image.
204 },
205 &quot;latLongRect&quot;: { # Rectangle determined by min and max `LatLng` pairs. # Not used.
206 &quot;maxLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair.
207 # of doubles representing degrees latitude and degrees longitude. Unless
208 # specified otherwise, this must conform to the
209 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
210 # standard&lt;/a&gt;. Values must be within normalized ranges.
211 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
212 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
213 },
214 &quot;minLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair.
215 # of doubles representing degrees latitude and degrees longitude. Unless
216 # specified otherwise, this must conform to the
217 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
218 # standard&lt;/a&gt;. Values must be within normalized ranges.
219 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
220 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
221 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700222 },
223 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700224 },
225 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700226 &quot;parent&quot;: &quot;A String&quot;, # Optional. Target project and location to make a call.
227 #
228 # Format: `projects/{project-id}/locations/{location-id}`.
229 #
230 # If no parent is specified, a region will be chosen automatically.
231 #
232 # Supported location-ids:
233 # `us`: USA country only,
234 # `asia`: East asia areas, like Japan, Taiwan,
235 # `eu`: The European Union.
236 #
237 # Example: `projects/project-A/locations/eu`.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700238 }
239
240 x__xgafv: string, V1 error format.
241 Allowed values
242 1 - v1 error format
243 2 - v2 error format
244
245Returns:
246 An object of the form:
247
248 { # Response to a batch image annotation request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700249 &quot;responses&quot;: [ # Individual responses to image annotation requests within the batch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700250 { # Response to an image annotation request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700251 &quot;localizedObjectAnnotations&quot;: [ # If present, localized object detection has completed successfully.
252 # This will be sorted descending by confidence score.
253 { # Set of detected objects with bounding boxes.
Bu Sun Kim65020912020-05-20 12:08:20 -0700254 &quot;name&quot;: &quot;A String&quot;, # Object name, expressed in its `language_code` language.
255 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this object belongs. This must be populated.
256 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
257 { # A vertex represents a 2D point in the image.
258 # NOTE: the normalized vertex coordinates are relative to the original image
259 # and range from 0 to 1.
Bu Sun Kim65020912020-05-20 12:08:20 -0700260 &quot;x&quot;: 3.14, # X coordinate.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700261 &quot;y&quot;: 3.14, # Y coordinate.
Bu Sun Kim65020912020-05-20 12:08:20 -0700262 },
263 ],
264 &quot;vertices&quot;: [ # The bounding polygon vertices.
265 { # A vertex represents a 2D point in the image.
266 # NOTE: the vertex coordinates are in the same scale as the original image.
267 &quot;y&quot;: 42, # Y coordinate.
268 &quot;x&quot;: 42, # X coordinate.
269 },
270 ],
271 },
272 &quot;score&quot;: 3.14, # Score of the result. Range [0, 1].
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700273 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code, such as &quot;en-US&quot; or &quot;sr-Latn&quot;. For more
274 # information, see
275 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
276 &quot;mid&quot;: &quot;A String&quot;, # Object ID that should align with EntityAnnotation mid.
Bu Sun Kim65020912020-05-20 12:08:20 -0700277 },
278 ],
279 &quot;productSearchResults&quot;: { # Results for a product search request. # If present, product search has completed successfully.
Bu Sun Kim65020912020-05-20 12:08:20 -0700280 &quot;results&quot;: [ # List of results, one for each product match.
281 { # Information about a product.
282 &quot;image&quot;: &quot;A String&quot;, # The resource name of the image from the product that is the closest match
283 # to the query.
284 &quot;product&quot;: { # A Product contains ReferenceImages. # The Product.
Bu Sun Kim65020912020-05-20 12:08:20 -0700285 &quot;productLabels&quot;: [ # Key-value pairs that can be attached to a product. At query time,
286 # constraints can be specified based on the product_labels.
287 #
288 # Note that integer values can be provided as strings, e.g. &quot;1199&quot;. Only
289 # strings with integer values can match a range-based restriction which is
290 # to be supported soon.
291 #
292 # Multiple values can be assigned to the same key. One product may have up to
293 # 500 product_labels.
294 #
295 # Notice that the total number of distinct product_labels over all products
296 # in one ProductSet cannot exceed 1M, otherwise the product search pipeline
297 # will refuse to work for that ProductSet.
298 { # A product label represented as a key-value pair.
299 &quot;value&quot;: &quot;A String&quot;, # The value of the label attached to the product. Cannot be empty and
300 # cannot exceed 128 bytes.
301 &quot;key&quot;: &quot;A String&quot;, # The key of the label attached to the product. Cannot be empty and cannot
302 # exceed 128 bytes.
303 },
304 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700305 &quot;name&quot;: &quot;A String&quot;, # The resource name of the product.
306 #
307 # Format is:
308 # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
309 #
310 # This field is ignored when creating a product.
311 &quot;displayName&quot;: &quot;A String&quot;, # The user-provided name for this Product. Must not be empty. Must be at most
312 # 4096 characters long.
313 &quot;description&quot;: &quot;A String&quot;, # User-provided metadata to be stored with this product. Must be at most 4096
314 # characters long.
315 &quot;productCategory&quot;: &quot;A String&quot;, # Immutable. The category for the product identified by the reference image. This should
316 # be either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, or &quot;toys-v2&quot;. The legacy categories
317 # &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported, but these should
318 # not be used for new products.
Bu Sun Kim65020912020-05-20 12:08:20 -0700319 },
320 &quot;score&quot;: 3.14, # A confidence level on the match, ranging from 0 (no confidence) to
321 # 1 (full confidence).
322 },
323 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700324 &quot;indexTime&quot;: &quot;A String&quot;, # Timestamp of the index which provided these results. Products added to the
325 # product set and products removed from the product set after this time are
326 # not reflected in the current results.
327 &quot;productGroupedResults&quot;: [ # List of results grouped by products detected in the query image. Each entry
328 # corresponds to one bounding polygon in the query image, and contains the
329 # matching products specific to that region. There may be duplicate product
330 # matches in the union of all the per-product results.
331 { # Information about the products similar to a single product in a query
332 # image.
333 &quot;objectAnnotations&quot;: [ # List of generic predictions for the object in the bounding box.
334 { # Prediction for what the object in the bounding box is.
335 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code, such as &quot;en-US&quot; or &quot;sr-Latn&quot;. For more
336 # information, see
337 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
338 &quot;mid&quot;: &quot;A String&quot;, # Object ID that should align with EntityAnnotation mid.
339 &quot;name&quot;: &quot;A String&quot;, # Object name, expressed in its `language_code` language.
340 &quot;score&quot;: 3.14, # Score of the result. Range [0, 1].
341 },
342 ],
343 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the product detected in the query image.
344 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
345 { # A vertex represents a 2D point in the image.
346 # NOTE: the normalized vertex coordinates are relative to the original image
347 # and range from 0 to 1.
348 &quot;x&quot;: 3.14, # X coordinate.
349 &quot;y&quot;: 3.14, # Y coordinate.
350 },
351 ],
352 &quot;vertices&quot;: [ # The bounding polygon vertices.
353 { # A vertex represents a 2D point in the image.
354 # NOTE: the vertex coordinates are in the same scale as the original image.
355 &quot;y&quot;: 42, # Y coordinate.
356 &quot;x&quot;: 42, # X coordinate.
357 },
358 ],
359 },
360 &quot;results&quot;: [ # List of results, one for each product match.
361 { # Information about a product.
362 &quot;image&quot;: &quot;A String&quot;, # The resource name of the image from the product that is the closest match
363 # to the query.
364 &quot;product&quot;: { # A Product contains ReferenceImages. # The Product.
365 &quot;productLabels&quot;: [ # Key-value pairs that can be attached to a product. At query time,
366 # constraints can be specified based on the product_labels.
367 #
368 # Note that integer values can be provided as strings, e.g. &quot;1199&quot;. Only
369 # strings with integer values can match a range-based restriction which is
370 # to be supported soon.
371 #
372 # Multiple values can be assigned to the same key. One product may have up to
373 # 500 product_labels.
374 #
375 # Notice that the total number of distinct product_labels over all products
376 # in one ProductSet cannot exceed 1M, otherwise the product search pipeline
377 # will refuse to work for that ProductSet.
378 { # A product label represented as a key-value pair.
379 &quot;value&quot;: &quot;A String&quot;, # The value of the label attached to the product. Cannot be empty and
380 # cannot exceed 128 bytes.
381 &quot;key&quot;: &quot;A String&quot;, # The key of the label attached to the product. Cannot be empty and cannot
382 # exceed 128 bytes.
383 },
384 ],
385 &quot;name&quot;: &quot;A String&quot;, # The resource name of the product.
386 #
387 # Format is:
388 # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
389 #
390 # This field is ignored when creating a product.
391 &quot;displayName&quot;: &quot;A String&quot;, # The user-provided name for this Product. Must not be empty. Must be at most
392 # 4096 characters long.
393 &quot;description&quot;: &quot;A String&quot;, # User-provided metadata to be stored with this product. Must be at most 4096
394 # characters long.
395 &quot;productCategory&quot;: &quot;A String&quot;, # Immutable. The category for the product identified by the reference image. This should
396 # be either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, or &quot;toys-v2&quot;. The legacy categories
397 # &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported, but these should
398 # not be used for new products.
399 },
400 &quot;score&quot;: 3.14, # A confidence level on the match, ranging from 0 (no confidence) to
401 # 1 (full confidence).
402 },
403 ],
404 },
405 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700406 },
407 &quot;error&quot;: { # The `Status` type defines a logical error model that is suitable for # If set, represents the error message for the operation.
408 # Note that filled-in image annotations are guaranteed to be
409 # correct, even when `error` is set.
410 # different programming environments, including REST APIs and RPC APIs. It is
411 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
412 # three pieces of data: error code, error message, and error details.
413 #
414 # You can find out more about this error model and how to work with it in the
415 # [API Design Guide](https://cloud.google.com/apis/design/errors).
416 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
417 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
418 # user-facing error message should be localized and sent in the
419 # google.rpc.Status.details field, or localized by the client.
420 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
421 # message types for APIs to use.
422 {
423 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
424 },
425 ],
426 },
427 &quot;fullTextAnnotation&quot;: { # TextAnnotation contains a structured representation of OCR extracted text. # If present, text (OCR) detection or document (OCR) text detection has
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700428 # completed successfully.
429 # This annotation provides the structural hierarchy for the OCR detected
430 # text.
431 # The hierarchy of an OCR extracted text structure is like this:
Dan O'Mearadd494642020-05-01 07:42:23 -0700432 # TextAnnotation -&gt; Page -&gt; Block -&gt; Paragraph -&gt; Word -&gt; Symbol
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700433 # Each structural component, starting from Page, may further have their own
434 # properties. Properties describe detected languages, breaks etc.. Please refer
435 # to the TextAnnotation.TextProperty message definition below for more
436 # detail.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700437 &quot;text&quot;: &quot;A String&quot;, # UTF-8 text detected on the pages.
Bu Sun Kim65020912020-05-20 12:08:20 -0700438 &quot;pages&quot;: [ # List of pages detected by OCR.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700439 { # Detected page from OCR.
Bu Sun Kim65020912020-05-20 12:08:20 -0700440 &quot;width&quot;: 42, # Page width. For PDFs the unit is points. For images (including
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700441 # TIFFs) the unit is pixels.
Bu Sun Kim65020912020-05-20 12:08:20 -0700442 &quot;blocks&quot;: [ # List of blocks of text, images etc on this page.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700443 { # Logical element on the page.
Bu Sun Kim65020912020-05-20 12:08:20 -0700444 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the block.
445 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
446 { # Detected language for a structural component.
447 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code, such as &quot;en-US&quot; or &quot;sr-Latn&quot;. For more
448 # information, see
449 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
450 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
451 },
452 ],
453 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
454 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
455 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
456 },
457 },
458 &quot;blockType&quot;: &quot;A String&quot;, # Detected block type (text, image etc) for this block.
459 &quot;boundingBox&quot;: { # A bounding polygon for the detected image annotation. # The bounding box for the block.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700460 # The vertices are in the order of top-left, top-right, bottom-right,
461 # bottom-left. When a rotation of the bounding box is detected the rotation
462 # is represented as around the top-left corner as defined when the text is
Bu Sun Kim65020912020-05-20 12:08:20 -0700463 # read in the &#x27;natural&#x27; orientation.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700464 # For example:
465 #
466 # * when the text is horizontal it might look like:
467 #
468 # 0----1
469 # | |
470 # 3----2
471 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700472 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700473 #
474 # 2----3
475 # | |
476 # 1----0
477 #
478 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700479 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700480 { # A vertex represents a 2D point in the image.
481 # NOTE: the normalized vertex coordinates are relative to the original image
482 # and range from 0 to 1.
Bu Sun Kim65020912020-05-20 12:08:20 -0700483 &quot;x&quot;: 3.14, # X coordinate.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700484 &quot;y&quot;: 3.14, # Y coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700485 },
486 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700487 &quot;vertices&quot;: [ # The bounding polygon vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700488 { # A vertex represents a 2D point in the image.
489 # NOTE: the vertex coordinates are in the same scale as the original image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700490 &quot;y&quot;: 42, # Y coordinate.
491 &quot;x&quot;: 42, # X coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700492 },
493 ],
494 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700495 &quot;confidence&quot;: 3.14, # Confidence of the OCR results on the block. Range [0, 1].
496 &quot;paragraphs&quot;: [ # List of paragraphs in this block (if this blocks is of type text).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700497 { # Structural unit of text representing a number of words in certain order.
Bu Sun Kim65020912020-05-20 12:08:20 -0700498 &quot;boundingBox&quot;: { # A bounding polygon for the detected image annotation. # The bounding box for the paragraph.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700499 # The vertices are in the order of top-left, top-right, bottom-right,
500 # bottom-left. When a rotation of the bounding box is detected the rotation
501 # is represented as around the top-left corner as defined when the text is
Bu Sun Kim65020912020-05-20 12:08:20 -0700502 # read in the &#x27;natural&#x27; orientation.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700503 # For example:
504 # * when the text is horizontal it might look like:
505 # 0----1
506 # | |
507 # 3----2
Bu Sun Kim65020912020-05-20 12:08:20 -0700508 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700509 # 2----3
510 # | |
511 # 1----0
512 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700513 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700514 { # A vertex represents a 2D point in the image.
515 # NOTE: the normalized vertex coordinates are relative to the original image
516 # and range from 0 to 1.
Bu Sun Kim65020912020-05-20 12:08:20 -0700517 &quot;x&quot;: 3.14, # X coordinate.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700518 &quot;y&quot;: 3.14, # Y coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700519 },
520 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700521 &quot;vertices&quot;: [ # The bounding polygon vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700522 { # A vertex represents a 2D point in the image.
523 # NOTE: the vertex coordinates are in the same scale as the original image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700524 &quot;y&quot;: 42, # Y coordinate.
525 &quot;x&quot;: 42, # X coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700526 },
527 ],
528 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700529 &quot;confidence&quot;: 3.14, # Confidence of the OCR results for the paragraph. Range [0, 1].
530 &quot;words&quot;: [ # List of all words in this paragraph.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700531 { # A word representation.
Bu Sun Kim65020912020-05-20 12:08:20 -0700532 &quot;boundingBox&quot;: { # A bounding polygon for the detected image annotation. # The bounding box for the word.
Dan O'Mearadd494642020-05-01 07:42:23 -0700533 # The vertices are in the order of top-left, top-right, bottom-right,
534 # bottom-left. When a rotation of the bounding box is detected the rotation
535 # is represented as around the top-left corner as defined when the text is
Bu Sun Kim65020912020-05-20 12:08:20 -0700536 # read in the &#x27;natural&#x27; orientation.
Dan O'Mearadd494642020-05-01 07:42:23 -0700537 # For example:
538 # * when the text is horizontal it might look like:
539 # 0----1
540 # | |
541 # 3----2
Bu Sun Kim65020912020-05-20 12:08:20 -0700542 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700543 # 2----3
544 # | |
545 # 1----0
546 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700547 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
Dan O'Mearadd494642020-05-01 07:42:23 -0700548 { # A vertex represents a 2D point in the image.
549 # NOTE: the normalized vertex coordinates are relative to the original image
550 # and range from 0 to 1.
Bu Sun Kim65020912020-05-20 12:08:20 -0700551 &quot;x&quot;: 3.14, # X coordinate.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700552 &quot;y&quot;: 3.14, # Y coordinate.
Dan O'Mearadd494642020-05-01 07:42:23 -0700553 },
554 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700555 &quot;vertices&quot;: [ # The bounding polygon vertices.
Dan O'Mearadd494642020-05-01 07:42:23 -0700556 { # A vertex represents a 2D point in the image.
557 # NOTE: the vertex coordinates are in the same scale as the original image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700558 &quot;y&quot;: 42, # Y coordinate.
559 &quot;x&quot;: 42, # X coordinate.
Dan O'Mearadd494642020-05-01 07:42:23 -0700560 },
561 ],
562 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700563 &quot;confidence&quot;: 3.14, # Confidence of the OCR results for the word. Range [0, 1].
564 &quot;symbols&quot;: [ # List of symbols in the word.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700565 # The order of the symbols follows the natural reading order.
566 { # A single symbol representation.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700567 &quot;text&quot;: &quot;A String&quot;, # The actual UTF-8 representation of the symbol.
568 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the symbol.
569 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
570 { # Detected language for a structural component.
571 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code, such as &quot;en-US&quot; or &quot;sr-Latn&quot;. For more
572 # information, see
573 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
574 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
575 },
576 ],
577 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
578 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
579 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
580 },
581 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700582 &quot;boundingBox&quot;: { # A bounding polygon for the detected image annotation. # The bounding box for the symbol.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700583 # The vertices are in the order of top-left, top-right, bottom-right,
584 # bottom-left. When a rotation of the bounding box is detected the rotation
585 # is represented as around the top-left corner as defined when the text is
Bu Sun Kim65020912020-05-20 12:08:20 -0700586 # read in the &#x27;natural&#x27; orientation.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700587 # For example:
588 # * when the text is horizontal it might look like:
589 # 0----1
590 # | |
591 # 3----2
Bu Sun Kim65020912020-05-20 12:08:20 -0700592 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700593 # 2----3
594 # | |
595 # 1----0
Dan O'Mearadd494642020-05-01 07:42:23 -0700596 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700597 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700598 { # A vertex represents a 2D point in the image.
599 # NOTE: the normalized vertex coordinates are relative to the original image
600 # and range from 0 to 1.
Bu Sun Kim65020912020-05-20 12:08:20 -0700601 &quot;x&quot;: 3.14, # X coordinate.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700602 &quot;y&quot;: 3.14, # Y coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700603 },
604 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700605 &quot;vertices&quot;: [ # The bounding polygon vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700606 { # A vertex represents a 2D point in the image.
607 # NOTE: the vertex coordinates are in the same scale as the original image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700608 &quot;y&quot;: 42, # Y coordinate.
609 &quot;x&quot;: 42, # X coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700610 },
611 ],
612 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700613 &quot;confidence&quot;: 3.14, # Confidence of the OCR results for the symbol. Range [0, 1].
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700614 },
615 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700616 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the word.
617 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
618 { # Detected language for a structural component.
619 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code, such as &quot;en-US&quot; or &quot;sr-Latn&quot;. For more
620 # information, see
621 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
622 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
623 },
624 ],
625 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
626 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
627 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
628 },
629 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700630 },
631 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700632 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the paragraph.
633 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
634 { # Detected language for a structural component.
635 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code, such as &quot;en-US&quot; or &quot;sr-Latn&quot;. For more
636 # information, see
637 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
638 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
639 },
640 ],
641 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
642 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
643 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
644 },
645 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700646 },
647 ],
648 },
649 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700650 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected on the page.
651 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
652 { # Detected language for a structural component.
653 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code, such as &quot;en-US&quot; or &quot;sr-Latn&quot;. For more
654 # information, see
655 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
656 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
657 },
658 ],
659 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
660 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
661 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
662 },
663 },
664 &quot;confidence&quot;: 3.14, # Confidence of the OCR results on the page. Range [0, 1].
665 &quot;height&quot;: 42, # Page height. For PDFs the unit is points. For images (including
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700666 # TIFFs) the unit is pixels.
667 },
668 ],
669 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700670 &quot;textAnnotations&quot;: [ # If present, text (OCR) detection has completed successfully.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700671 { # Set of detected entity features.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700672 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
673 # `description` is expressed.
674 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
675 # for `LABEL_DETECTION` features.
676 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
677 { # A vertex represents a 2D point in the image.
678 # NOTE: the normalized vertex coordinates are relative to the original image
679 # and range from 0 to 1.
680 &quot;x&quot;: 3.14, # X coordinate.
681 &quot;y&quot;: 3.14, # Y coordinate.
682 },
683 ],
684 &quot;vertices&quot;: [ # The bounding polygon vertices.
685 { # A vertex represents a 2D point in the image.
686 # NOTE: the vertex coordinates are in the same scale as the original image.
687 &quot;y&quot;: 42, # Y coordinate.
688 &quot;x&quot;: 42, # X coordinate.
689 },
690 ],
691 },
692 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
693 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
694 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
695 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
696 # detected distant towering building, even though the confidence that
697 # there is a tower in each image may be the same. Range [0, 1].
Bu Sun Kim65020912020-05-20 12:08:20 -0700698 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
699 # fields, such a score or string that qualifies the entity.
700 { # A `Property` consists of a user-supplied name/value pair.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700701 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
Bu Sun Kim65020912020-05-20 12:08:20 -0700702 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
703 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
Bu Sun Kim65020912020-05-20 12:08:20 -0700704 },
705 ],
706 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
707 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700708 # `LocationInfo` elements can be present because one location may
709 # indicate the location of the scene in the image, and another location
710 # may indicate the location of the place where the image was taken.
711 # Location information is usually present for landmarks.
712 { # Detected entity location information.
Bu Sun Kim65020912020-05-20 12:08:20 -0700713 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700714 # of doubles representing degrees latitude and degrees longitude. Unless
715 # specified otherwise, this must conform to the
Bu Sun Kim65020912020-05-20 12:08:20 -0700716 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
Dan O'Mearadd494642020-05-01 07:42:23 -0700717 # standard&lt;/a&gt;. Values must be within normalized ranges.
Bu Sun Kim65020912020-05-20 12:08:20 -0700718 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
719 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700720 },
721 },
722 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700723 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
724 # [Google Knowledge Graph Search
725 # API](https://developers.google.com/knowledge-graph/).
726 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
727 # The accuracy of the entity detection in an image.
728 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
729 # this field represents the confidence that there is a tower in the query
730 # image. Range [0, 1].
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700731 },
732 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700733 &quot;imagePropertiesAnnotation&quot;: { # Stores image properties, such as dominant colors. # If present, image properties were extracted successfully.
734 &quot;dominantColors&quot;: { # Set of dominant colors and their corresponding scores. # If present, dominant colors completed successfully.
735 &quot;colors&quot;: [ # RGB color values with their score and pixel fraction.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700736 { # Color information consists of RGB channels, score, and the fraction of
737 # the image that the color occupies in the image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700738 &quot;pixelFraction&quot;: 3.14, # The fraction of pixels the color occupies in the image.
739 # Value in range [0, 1].
740 &quot;color&quot;: { # Represents a color in the RGBA color space. This representation is designed # RGB components of the color.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700741 # for simplicity of conversion to/from color representations in various
742 # languages over compactness; for example, the fields of this representation
Bu Sun Kim65020912020-05-20 12:08:20 -0700743 # can be trivially provided to the constructor of &quot;java.awt.Color&quot; in Java; it
744 # can also be trivially provided to UIColor&#x27;s &quot;+colorWithRed:green:blue:alpha&quot;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700745 # method in iOS; and, with just a little work, it can be easily formatted into
Bu Sun Kim65020912020-05-20 12:08:20 -0700746 # a CSS &quot;rgba()&quot; string in JavaScript, as well.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700747 #
748 # Note: this proto does not carry information about the absolute color space
749 # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
750 # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color
751 # space.
752 #
753 # Example (Java):
754 #
755 # import com.google.type.Color;
756 #
757 # // ...
758 # public static java.awt.Color fromProto(Color protocolor) {
759 # float alpha = protocolor.hasAlpha()
760 # ? protocolor.getAlpha().getValue()
761 # : 1.0;
762 #
763 # return new java.awt.Color(
764 # protocolor.getRed(),
765 # protocolor.getGreen(),
766 # protocolor.getBlue(),
767 # alpha);
768 # }
769 #
770 # public static Color toProto(java.awt.Color color) {
771 # float red = (float) color.getRed();
772 # float green = (float) color.getGreen();
773 # float blue = (float) color.getBlue();
774 # float denominator = 255.0;
775 # Color.Builder resultBuilder =
776 # Color
777 # .newBuilder()
778 # .setRed(red / denominator)
779 # .setGreen(green / denominator)
780 # .setBlue(blue / denominator);
781 # int alpha = color.getAlpha();
782 # if (alpha != 255) {
783 # result.setAlpha(
784 # FloatValue
785 # .newBuilder()
786 # .setValue(((float) alpha) / denominator)
787 # .build());
788 # }
789 # return resultBuilder.build();
790 # }
791 # // ...
792 #
793 # Example (iOS / Obj-C):
794 #
795 # // ...
796 # static UIColor* fromProto(Color* protocolor) {
797 # float red = [protocolor red];
798 # float green = [protocolor green];
799 # float blue = [protocolor blue];
800 # FloatValue* alpha_wrapper = [protocolor alpha];
801 # float alpha = 1.0;
802 # if (alpha_wrapper != nil) {
803 # alpha = [alpha_wrapper value];
804 # }
805 # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
806 # }
807 #
808 # static Color* toProto(UIColor* color) {
809 # CGFloat red, green, blue, alpha;
Dan O'Mearadd494642020-05-01 07:42:23 -0700810 # if (![color getRed:&amp;red green:&amp;green blue:&amp;blue alpha:&amp;alpha]) {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700811 # return nil;
812 # }
813 # Color* result = [[Color alloc] init];
814 # [result setRed:red];
815 # [result setGreen:green];
816 # [result setBlue:blue];
Dan O'Mearadd494642020-05-01 07:42:23 -0700817 # if (alpha &lt;= 0.9999) {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700818 # [result setAlpha:floatWrapperWithValue(alpha)];
819 # }
820 # [result autorelease];
821 # return result;
822 # }
823 # // ...
824 #
825 # Example (JavaScript):
826 #
827 # // ...
828 #
829 # var protoToCssColor = function(rgb_color) {
830 # var redFrac = rgb_color.red || 0.0;
831 # var greenFrac = rgb_color.green || 0.0;
832 # var blueFrac = rgb_color.blue || 0.0;
833 # var red = Math.floor(redFrac * 255);
834 # var green = Math.floor(greenFrac * 255);
835 # var blue = Math.floor(blueFrac * 255);
836 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700837 # if (!(&#x27;alpha&#x27; in rgb_color)) {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700838 # return rgbToCssColor_(red, green, blue);
839 # }
840 #
841 # var alphaFrac = rgb_color.alpha.value || 0.0;
Bu Sun Kim65020912020-05-20 12:08:20 -0700842 # var rgbParams = [red, green, blue].join(&#x27;,&#x27;);
843 # return [&#x27;rgba(&#x27;, rgbParams, &#x27;,&#x27;, alphaFrac, &#x27;)&#x27;].join(&#x27;&#x27;);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700844 # };
845 #
846 # var rgbToCssColor_ = function(red, green, blue) {
Dan O'Mearadd494642020-05-01 07:42:23 -0700847 # var rgbNumber = new Number((red &lt;&lt; 16) | (green &lt;&lt; 8) | blue);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700848 # var hexString = rgbNumber.toString(16);
849 # var missingZeros = 6 - hexString.length;
Bu Sun Kim65020912020-05-20 12:08:20 -0700850 # var resultBuilder = [&#x27;#&#x27;];
Dan O'Mearadd494642020-05-01 07:42:23 -0700851 # for (var i = 0; i &lt; missingZeros; i++) {
Bu Sun Kim65020912020-05-20 12:08:20 -0700852 # resultBuilder.push(&#x27;0&#x27;);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700853 # }
854 # resultBuilder.push(hexString);
Bu Sun Kim65020912020-05-20 12:08:20 -0700855 # return resultBuilder.join(&#x27;&#x27;);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700856 # };
857 #
858 # // ...
Bu Sun Kim65020912020-05-20 12:08:20 -0700859 &quot;green&quot;: 3.14, # The amount of green in the color as a value in the interval [0, 1].
860 &quot;blue&quot;: 3.14, # The amount of blue in the color as a value in the interval [0, 1].
861 &quot;alpha&quot;: 3.14, # The fraction of this color that should be applied to the pixel. That is,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700862 # the final pixel color is defined by the equation:
863 #
864 # pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
865 #
866 # This means that a value of 1.0 corresponds to a solid color, whereas
867 # a value of 0.0 corresponds to a completely transparent color. This
868 # uses a wrapper message rather than a simple float scalar so that it is
869 # possible to distinguish between a default value and the value being unset.
870 # If omitted, this color object is to be rendered as a solid color
871 # (as if the alpha value had been explicitly given with a value of 1.0).
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700872 &quot;red&quot;: 3.14, # The amount of red in the color as a value in the interval [0, 1].
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700873 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700874 &quot;score&quot;: 3.14, # Image-specific score for this color. Value in range [0, 1].
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700875 },
876 ],
877 },
878 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700879 &quot;logoAnnotations&quot;: [ # If present, logo detection has completed successfully.
880 { # Set of detected entity features.
881 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
882 # `description` is expressed.
883 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
884 # for `LABEL_DETECTION` features.
885 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
886 { # A vertex represents a 2D point in the image.
887 # NOTE: the normalized vertex coordinates are relative to the original image
888 # and range from 0 to 1.
889 &quot;x&quot;: 3.14, # X coordinate.
890 &quot;y&quot;: 3.14, # Y coordinate.
891 },
892 ],
893 &quot;vertices&quot;: [ # The bounding polygon vertices.
894 { # A vertex represents a 2D point in the image.
895 # NOTE: the vertex coordinates are in the same scale as the original image.
896 &quot;y&quot;: 42, # Y coordinate.
897 &quot;x&quot;: 42, # X coordinate.
898 },
899 ],
900 },
901 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
902 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
903 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
904 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
905 # detected distant towering building, even though the confidence that
906 # there is a tower in each image may be the same. Range [0, 1].
907 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
908 # fields, such a score or string that qualifies the entity.
909 { # A `Property` consists of a user-supplied name/value pair.
910 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
911 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
912 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
913 },
914 ],
915 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
916 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
917 # `LocationInfo` elements can be present because one location may
918 # indicate the location of the scene in the image, and another location
919 # may indicate the location of the place where the image was taken.
920 # Location information is usually present for landmarks.
921 { # Detected entity location information.
922 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
923 # of doubles representing degrees latitude and degrees longitude. Unless
924 # specified otherwise, this must conform to the
925 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
926 # standard&lt;/a&gt;. Values must be within normalized ranges.
927 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
928 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
929 },
930 },
931 ],
932 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
933 # [Google Knowledge Graph Search
934 # API](https://developers.google.com/knowledge-graph/).
935 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
936 # The accuracy of the entity detection in an image.
937 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
938 # this field represents the confidence that there is a tower in the query
939 # image. Range [0, 1].
940 },
941 ],
942 &quot;context&quot;: { # If an image was produced from a file (e.g. a PDF), this message gives # If present, contextual information is needed to understand where this image
943 # comes from.
944 # information about the source of that image.
945 &quot;uri&quot;: &quot;A String&quot;, # The URI of the file used to produce the image.
946 &quot;pageNumber&quot;: 42, # If the file was a PDF or TIFF, this field gives the page number within
947 # the file used to produce the image.
948 },
949 &quot;webDetection&quot;: { # Relevant information for the image from the Internet. # If present, web detection has completed successfully.
950 &quot;visuallySimilarImages&quot;: [ # The visually similar image results.
951 { # Metadata for online images.
952 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
953 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
954 },
955 ],
956 &quot;bestGuessLabels&quot;: [ # The service&#x27;s best guess as to the topic of the request image.
957 # Inferred from similar images on the open web.
958 { # Label to provide extra metadata for the web detection.
959 &quot;label&quot;: &quot;A String&quot;, # Label for extra metadata.
960 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code for `label`, such as &quot;en-US&quot; or &quot;sr-Latn&quot;.
961 # For more information, see
962 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
963 },
964 ],
965 &quot;fullMatchingImages&quot;: [ # Fully matching images from the Internet.
966 # Can include resized copies of the query image.
967 { # Metadata for online images.
968 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
969 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
970 },
971 ],
972 &quot;webEntities&quot;: [ # Deduced entities from similar images on the Internet.
973 { # Entity deduced from similar images on the Internet.
974 &quot;entityId&quot;: &quot;A String&quot;, # Opaque entity ID.
975 &quot;description&quot;: &quot;A String&quot;, # Canonical description of the entity, in English.
976 &quot;score&quot;: 3.14, # Overall relevancy score for the entity.
977 # Not normalized and not comparable across different image queries.
978 },
979 ],
980 &quot;pagesWithMatchingImages&quot;: [ # Web pages containing the matching images from the Internet.
981 { # Metadata for web pages.
982 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the web page.
983 &quot;partialMatchingImages&quot;: [ # Partial matching images on the page.
984 # Those images are similar enough to share some key-point features. For
985 # example an original image will likely have partial matching for its
986 # crops.
987 { # Metadata for online images.
988 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
989 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
990 },
991 ],
992 &quot;url&quot;: &quot;A String&quot;, # The result web page URL.
993 &quot;pageTitle&quot;: &quot;A String&quot;, # Title for the web page, may contain HTML markups.
994 &quot;fullMatchingImages&quot;: [ # Fully matching images on the page.
995 # Can include resized copies of the query image.
996 { # Metadata for online images.
997 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
998 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
999 },
1000 ],
1001 },
1002 ],
1003 &quot;partialMatchingImages&quot;: [ # Partial matching images from the Internet.
1004 # Those images are similar enough to share some key-point features. For
1005 # example an original image will likely have partial matching for its crops.
1006 { # Metadata for online images.
1007 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
1008 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
1009 },
1010 ],
1011 },
1012 &quot;safeSearchAnnotation&quot;: { # Set of features pertaining to the image, computed by computer vision # If present, safe-search annotation has completed successfully.
1013 # methods over safe-search verticals (for example, adult, spoof, medical,
1014 # violence).
1015 &quot;adult&quot;: &quot;A String&quot;, # Represents the adult content likelihood for the image. Adult content may
1016 # contain elements such as nudity, pornographic images or cartoons, or
1017 # sexual activities.
1018 &quot;spoof&quot;: &quot;A String&quot;, # Spoof likelihood. The likelihood that an modification
1019 # was made to the image&#x27;s canonical version to make it appear
1020 # funny or offensive.
1021 &quot;medical&quot;: &quot;A String&quot;, # Likelihood that this is a medical image.
1022 &quot;racy&quot;: &quot;A String&quot;, # Likelihood that the request image contains racy content. Racy content may
1023 # include (but is not limited to) skimpy or sheer clothing, strategically
1024 # covered nudity, lewd or provocative poses, or close-ups of sensitive
1025 # body areas.
1026 &quot;violence&quot;: &quot;A String&quot;, # Likelihood that this image contains violent content.
1027 },
1028 &quot;landmarkAnnotations&quot;: [ # If present, landmark detection has completed successfully.
1029 { # Set of detected entity features.
1030 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
1031 # `description` is expressed.
1032 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
1033 # for `LABEL_DETECTION` features.
1034 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1035 { # A vertex represents a 2D point in the image.
1036 # NOTE: the normalized vertex coordinates are relative to the original image
1037 # and range from 0 to 1.
1038 &quot;x&quot;: 3.14, # X coordinate.
1039 &quot;y&quot;: 3.14, # Y coordinate.
1040 },
1041 ],
1042 &quot;vertices&quot;: [ # The bounding polygon vertices.
1043 { # A vertex represents a 2D point in the image.
1044 # NOTE: the vertex coordinates are in the same scale as the original image.
1045 &quot;y&quot;: 42, # Y coordinate.
1046 &quot;x&quot;: 42, # X coordinate.
1047 },
1048 ],
1049 },
1050 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
1051 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
1052 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
1053 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
1054 # detected distant towering building, even though the confidence that
1055 # there is a tower in each image may be the same. Range [0, 1].
1056 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
1057 # fields, such a score or string that qualifies the entity.
1058 { # A `Property` consists of a user-supplied name/value pair.
1059 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
1060 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
1061 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
1062 },
1063 ],
1064 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
1065 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
1066 # `LocationInfo` elements can be present because one location may
1067 # indicate the location of the scene in the image, and another location
1068 # may indicate the location of the place where the image was taken.
1069 # Location information is usually present for landmarks.
1070 { # Detected entity location information.
1071 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
1072 # of doubles representing degrees latitude and degrees longitude. Unless
1073 # specified otherwise, this must conform to the
1074 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1075 # standard&lt;/a&gt;. Values must be within normalized ranges.
1076 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1077 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1078 },
1079 },
1080 ],
1081 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
1082 # [Google Knowledge Graph Search
1083 # API](https://developers.google.com/knowledge-graph/).
1084 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
1085 # The accuracy of the entity detection in an image.
1086 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
1087 # this field represents the confidence that there is a tower in the query
1088 # image. Range [0, 1].
1089 },
1090 ],
1091 &quot;faceAnnotations&quot;: [ # If present, face detection has completed successfully.
1092 { # A face annotation object contains the results of face detection.
1093 &quot;underExposedLikelihood&quot;: &quot;A String&quot;, # Under-exposed likelihood.
1094 &quot;panAngle&quot;: 3.14, # Yaw angle, which indicates the leftward/rightward angle that the face is
1095 # pointing relative to the vertical plane perpendicular to the image. Range
1096 # [-180,180].
1097 &quot;detectionConfidence&quot;: 3.14, # Detection confidence. Range [0, 1].
1098 &quot;blurredLikelihood&quot;: &quot;A String&quot;, # Blurred likelihood.
1099 &quot;headwearLikelihood&quot;: &quot;A String&quot;, # Headwear likelihood.
1100 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the face. The coordinates of the bounding box
1101 # are in the original image&#x27;s scale.
1102 # The bounding box is computed to &quot;frame&quot; the face in accordance with human
1103 # expectations. It is based on the landmarker results.
1104 # Note that one or more x and/or y coordinates may not be generated in the
1105 # `BoundingPoly` (the polygon will be unbounded) if only a partial face
1106 # appears in the image to be annotated.
1107 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1108 { # A vertex represents a 2D point in the image.
1109 # NOTE: the normalized vertex coordinates are relative to the original image
1110 # and range from 0 to 1.
1111 &quot;x&quot;: 3.14, # X coordinate.
1112 &quot;y&quot;: 3.14, # Y coordinate.
1113 },
1114 ],
1115 &quot;vertices&quot;: [ # The bounding polygon vertices.
1116 { # A vertex represents a 2D point in the image.
1117 # NOTE: the vertex coordinates are in the same scale as the original image.
1118 &quot;y&quot;: 42, # Y coordinate.
1119 &quot;x&quot;: 42, # X coordinate.
1120 },
1121 ],
1122 },
1123 &quot;rollAngle&quot;: 3.14, # Roll angle, which indicates the amount of clockwise/anti-clockwise rotation
1124 # of the face relative to the image vertical about the axis perpendicular to
1125 # the face. Range [-180,180].
1126 &quot;sorrowLikelihood&quot;: &quot;A String&quot;, # Sorrow likelihood.
1127 &quot;tiltAngle&quot;: 3.14, # Pitch angle, which indicates the upwards/downwards angle that the face is
1128 # pointing relative to the image&#x27;s horizontal plane. Range [-180,180].
1129 &quot;fdBoundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The `fd_bounding_poly` bounding polygon is tighter than the
1130 # `boundingPoly`, and encloses only the skin part of the face. Typically, it
1131 # is used to eliminate the face from any image analysis that detects the
1132 # &quot;amount of skin&quot; visible in an image. It is not based on the
1133 # landmarker results, only on the initial face detection, hence
1134 # the &lt;code&gt;fd&lt;/code&gt; (face detection) prefix.
1135 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1136 { # A vertex represents a 2D point in the image.
1137 # NOTE: the normalized vertex coordinates are relative to the original image
1138 # and range from 0 to 1.
1139 &quot;x&quot;: 3.14, # X coordinate.
1140 &quot;y&quot;: 3.14, # Y coordinate.
1141 },
1142 ],
1143 &quot;vertices&quot;: [ # The bounding polygon vertices.
1144 { # A vertex represents a 2D point in the image.
1145 # NOTE: the vertex coordinates are in the same scale as the original image.
1146 &quot;y&quot;: 42, # Y coordinate.
1147 &quot;x&quot;: 42, # X coordinate.
1148 },
1149 ],
1150 },
1151 &quot;angerLikelihood&quot;: &quot;A String&quot;, # Anger likelihood.
1152 &quot;landmarks&quot;: [ # Detected face landmarks.
1153 { # A face-specific landmark (for example, a face feature).
1154 &quot;type&quot;: &quot;A String&quot;, # Face landmark type.
1155 &quot;position&quot;: { # A 3D position in the image, used primarily for Face detection landmarks. # Face landmark position.
1156 # A valid Position must have both x and y coordinates.
1157 # The position coordinates are in the same scale as the original image.
1158 &quot;x&quot;: 3.14, # X coordinate.
1159 &quot;z&quot;: 3.14, # Z coordinate (or depth).
1160 &quot;y&quot;: 3.14, # Y coordinate.
1161 },
1162 },
1163 ],
1164 &quot;surpriseLikelihood&quot;: &quot;A String&quot;, # Surprise likelihood.
1165 &quot;landmarkingConfidence&quot;: 3.14, # Face landmarking confidence. Range [0, 1].
1166 &quot;joyLikelihood&quot;: &quot;A String&quot;, # Joy likelihood.
1167 },
1168 ],
1169 &quot;cropHintsAnnotation&quot;: { # Set of crop hints that are used to generate new crops when serving images. # If present, crop hints have completed successfully.
1170 &quot;cropHints&quot;: [ # Crop hint results.
1171 { # Single crop hint that is used to generate a new crop when serving an image.
1172 &quot;confidence&quot;: 3.14, # Confidence of this being a salient region. Range [0, 1].
1173 &quot;importanceFraction&quot;: 3.14, # Fraction of importance of this salient region with respect to the original
1174 # image.
1175 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon for the crop region. The coordinates of the bounding
1176 # box are in the original image&#x27;s scale.
1177 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1178 { # A vertex represents a 2D point in the image.
1179 # NOTE: the normalized vertex coordinates are relative to the original image
1180 # and range from 0 to 1.
1181 &quot;x&quot;: 3.14, # X coordinate.
1182 &quot;y&quot;: 3.14, # Y coordinate.
1183 },
1184 ],
1185 &quot;vertices&quot;: [ # The bounding polygon vertices.
1186 { # A vertex represents a 2D point in the image.
1187 # NOTE: the vertex coordinates are in the same scale as the original image.
1188 &quot;y&quot;: 42, # Y coordinate.
1189 &quot;x&quot;: 42, # X coordinate.
1190 },
1191 ],
1192 },
1193 },
1194 ],
1195 },
1196 &quot;labelAnnotations&quot;: [ # If present, label detection has completed successfully.
1197 { # Set of detected entity features.
1198 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
1199 # `description` is expressed.
1200 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
1201 # for `LABEL_DETECTION` features.
1202 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1203 { # A vertex represents a 2D point in the image.
1204 # NOTE: the normalized vertex coordinates are relative to the original image
1205 # and range from 0 to 1.
1206 &quot;x&quot;: 3.14, # X coordinate.
1207 &quot;y&quot;: 3.14, # Y coordinate.
1208 },
1209 ],
1210 &quot;vertices&quot;: [ # The bounding polygon vertices.
1211 { # A vertex represents a 2D point in the image.
1212 # NOTE: the vertex coordinates are in the same scale as the original image.
1213 &quot;y&quot;: 42, # Y coordinate.
1214 &quot;x&quot;: 42, # X coordinate.
1215 },
1216 ],
1217 },
1218 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
1219 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
1220 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
1221 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
1222 # detected distant towering building, even though the confidence that
1223 # there is a tower in each image may be the same. Range [0, 1].
1224 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
1225 # fields, such a score or string that qualifies the entity.
1226 { # A `Property` consists of a user-supplied name/value pair.
1227 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
1228 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
1229 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
1230 },
1231 ],
1232 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
1233 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
1234 # `LocationInfo` elements can be present because one location may
1235 # indicate the location of the scene in the image, and another location
1236 # may indicate the location of the place where the image was taken.
1237 # Location information is usually present for landmarks.
1238 { # Detected entity location information.
1239 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
1240 # of doubles representing degrees latitude and degrees longitude. Unless
1241 # specified otherwise, this must conform to the
1242 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1243 # standard&lt;/a&gt;. Values must be within normalized ranges.
1244 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1245 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1246 },
1247 },
1248 ],
1249 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
1250 # [Google Knowledge Graph Search
1251 # API](https://developers.google.com/knowledge-graph/).
1252 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
1253 # The accuracy of the entity detection in an image.
1254 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
1255 # this field represents the confidence that there is a tower in the query
1256 # image. Range [0, 1].
1257 },
1258 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001259 },
1260 ],
1261 }</pre>
1262</div>
1263
1264<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -07001265 <code class="details" id="asyncBatchAnnotate">asyncBatchAnnotate(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001266 <pre>Run asynchronous image detection and annotation for a list of images.
1267
1268Progress and results can be retrieved through the
1269`google.longrunning.Operations` interface.
1270`Operation.metadata` contains `OperationMetadata` (metadata).
1271`Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results).
1272
1273This service will write image annotation outputs to json files in customer
1274GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
1275
1276Args:
Dan O'Mearadd494642020-05-01 07:42:23 -07001277 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001278 The object takes the form of:
1279
1280{ # Request for async image annotation for a list of images.
Bu Sun Kim65020912020-05-20 12:08:20 -07001281 &quot;parent&quot;: &quot;A String&quot;, # Optional. Target project and location to make a call.
1282 #
1283 # Format: `projects/{project-id}/locations/{location-id}`.
1284 #
1285 # If no parent is specified, a region will be chosen automatically.
1286 #
1287 # Supported location-ids:
1288 # `us`: USA country only,
1289 # `asia`: East asia areas, like Japan, Taiwan,
1290 # `eu`: The European Union.
1291 #
1292 # Example: `projects/project-A/locations/eu`.
1293 &quot;outputConfig&quot;: { # The desired output location and metadata. # Required. The desired output location and metadata (e.g. format).
1294 &quot;gcsDestination&quot;: { # The Google Cloud Storage location where the output will be written to. # The Google Cloud Storage location to write the output(s) to.
1295 &quot;uri&quot;: &quot;A String&quot;, # Google Cloud Storage URI prefix where the results will be stored. Results
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001296 # will be in JSON format and preceded by its corresponding input URI prefix.
1297 # This field can either represent a gcs file prefix or gcs directory. In
1298 # either case, the uri should be unique because in order to get all of the
1299 # output files, you will need to do a wildcard gcs search on the uri prefix
1300 # you provide.
1301 #
1302 # Examples:
1303 #
1304 # * File Prefix: gs://bucket-name/here/filenameprefix The output files
1305 # will be created in gs://bucket-name/here/ and the names of the
Bu Sun Kim65020912020-05-20 12:08:20 -07001306 # output files will begin with &quot;filenameprefix&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001307 #
1308 # * Directory Prefix: gs://bucket-name/some/location/ The output files
1309 # will be created in gs://bucket-name/some/location/ and the names of the
1310 # output files could be anything because there was no filename prefix
1311 # specified.
1312 #
1313 # If multiple outputs, each response is still AnnotateFileResponse, each of
1314 # which contains some subset of the full list of AnnotateImageResponse.
1315 # Multiple outputs can happen if, for example, the output JSON is too large
1316 # and overflows into multiple sharded files.
1317 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001318 &quot;batchSize&quot;: 42, # The max number of response protos to put into each output JSON file on
1319 # Google Cloud Storage.
1320 # The valid range is [1, 100]. If not specified, the default value is 20.
1321 #
1322 # For example, for one pdf file with 100 pages, 100 response protos will
1323 # be generated. If `batch_size` = 20, then 5 json files each
1324 # containing 20 response protos will be written under the prefix
1325 # `gcs_destination`.`uri`.
1326 #
1327 # Currently, batch_size only applies to GcsDestination, with potential future
1328 # support for other output configurations.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001329 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001330 &quot;requests&quot;: [ # Required. Individual image annotation requests for this batch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001331 { # Request for performing Google Cloud Vision API tasks over a user-provided
1332 # image, with user-requested features, and with context information.
Bu Sun Kim65020912020-05-20 12:08:20 -07001333 &quot;image&quot;: { # Client image to perform Google Cloud Vision API tasks over. # The image to be processed.
1334 &quot;content&quot;: &quot;A String&quot;, # Image content, represented as a stream of bytes.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001335 # Note: As with all `bytes` fields, protobuffers use a pure binary
1336 # representation, whereas JSON representations use base64.
Bu Sun Kim65020912020-05-20 12:08:20 -07001337 &quot;source&quot;: { # External image source (Google Cloud Storage or web URL image location). # Google Cloud Storage image location, or publicly-accessible image
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001338 # URL. If both `content` and `source` are provided for an image, `content`
1339 # takes precedence and is used to perform the image annotation request.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001340 &quot;gcsImageUri&quot;: &quot;A String&quot;, # **Use `image_uri` instead.**
1341 #
1342 # The Google Cloud Storage URI of the form
1343 # `gs://bucket_name/object_name`. Object versioning is not supported. See
1344 # [Google Cloud Storage Request
1345 # URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
Bu Sun Kim65020912020-05-20 12:08:20 -07001346 &quot;imageUri&quot;: &quot;A String&quot;, # The URI of the source image. Can be either:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001347 #
1348 # 1. A Google Cloud Storage URI of the form
1349 # `gs://bucket_name/object_name`. Object versioning is not supported. See
1350 # [Google Cloud Storage Request
1351 # URIs](https://cloud.google.com/storage/docs/reference-uris) for more
1352 # info.
1353 #
1354 # 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
1355 # HTTP/HTTPS URLs, Google cannot guarantee that the request will be
1356 # completed. Your request may fail if the specified host denies the
1357 # request (e.g. due to request throttling or DOS prevention), or if Google
1358 # throttles requests to the site for abuse prevention. You should not
1359 # depend on externally-hosted images for production applications.
1360 #
1361 # When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
1362 # precedence.
1363 },
1364 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001365 &quot;features&quot;: [ # Requested features.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001366 { # The type of Google Cloud Vision API detection to perform, and the maximum
1367 # number of results to return for that type. Multiple `Feature` objects can
1368 # be specified in the `features` list.
Bu Sun Kim65020912020-05-20 12:08:20 -07001369 &quot;type&quot;: &quot;A String&quot;, # The feature type.
1370 &quot;maxResults&quot;: 42, # Maximum number of results of this type. Does not apply to
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001371 # `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
Bu Sun Kim65020912020-05-20 12:08:20 -07001372 &quot;model&quot;: &quot;A String&quot;, # Model to use for the feature.
1373 # Supported values: &quot;builtin/stable&quot; (the default if unset) and
1374 # &quot;builtin/latest&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001375 },
1376 ],
Bu Sun Kim65020912020-05-20 12:08:20 -07001377 &quot;imageContext&quot;: { # Image context and/or feature-specific parameters. # Additional context that may accompany the image.
Bu Sun Kim65020912020-05-20 12:08:20 -07001378 &quot;cropHintsParams&quot;: { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request.
1379 &quot;aspectRatios&quot;: [ # Aspect ratios in floats, representing the ratio of the width to the height
1380 # of the image. For example, if the desired aspect ratio is 4/3, the
1381 # corresponding float value should be 1.33333. If not specified, the
1382 # best possible crop is returned. The number of provided aspect ratios is
1383 # limited to a maximum of 16; any aspect ratios provided after the 16th are
1384 # ignored.
1385 3.14,
1386 ],
1387 },
1388 &quot;productSearchParams&quot;: { # Parameters for a product search request. # Parameters for product search.
Bu Sun Kim65020912020-05-20 12:08:20 -07001389 &quot;productCategories&quot;: [ # The list of product categories to search in. Currently, we only consider
1390 # the first category, and either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, &quot;toys-v2&quot;,
1391 # &quot;packagedgoods-v1&quot;, or &quot;general-v1&quot; should be specified. The legacy
1392 # categories &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported but will
1393 # be deprecated. For new products, please use &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;,
1394 # or &quot;toys-v2&quot; for better product search accuracy. It is recommended to
1395 # migrate existing products to these categories as well.
1396 &quot;A String&quot;,
1397 ],
1398 &quot;filter&quot;: &quot;A String&quot;, # The filtering expression. This can be used to restrict search results based
1399 # on Product labels. We currently support an AND of OR of key-value
1400 # expressions, where each expression within an OR must have the same key. An
1401 # &#x27;=&#x27; should be used to connect the key and value.
1402 #
1403 # For example, &quot;(color = red OR color = blue) AND brand = Google&quot; is
1404 # acceptable, but &quot;(color = red OR brand = Google)&quot; is not acceptable.
1405 # &quot;color: red&quot; is not acceptable because it uses a &#x27;:&#x27; instead of an &#x27;=&#x27;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001406 &quot;productSet&quot;: &quot;A String&quot;, # The resource name of a ProductSet to be searched for similar images.
1407 #
1408 # Format is:
1409 # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
1410 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image.
1411 # If it is not specified, system discretion will be applied.
1412 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1413 { # A vertex represents a 2D point in the image.
1414 # NOTE: the normalized vertex coordinates are relative to the original image
1415 # and range from 0 to 1.
1416 &quot;x&quot;: 3.14, # X coordinate.
1417 &quot;y&quot;: 3.14, # Y coordinate.
1418 },
1419 ],
1420 &quot;vertices&quot;: [ # The bounding polygon vertices.
1421 { # A vertex represents a 2D point in the image.
1422 # NOTE: the vertex coordinates are in the same scale as the original image.
1423 &quot;y&quot;: 42, # Y coordinate.
1424 &quot;x&quot;: 42, # X coordinate.
1425 },
1426 ],
1427 },
1428 },
1429 &quot;languageHints&quot;: [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value
1430 # yields the best results since it enables automatic language detection. For
1431 # languages based on the Latin alphabet, setting `language_hints` is not
1432 # needed. In rare cases, when the language of the text in the image is known,
1433 # setting a hint will help get better results (although it will be a
1434 # significant hindrance if the hint is wrong). Text detection returns an
1435 # error if one or more of the specified languages is not one of the
1436 # [supported languages](https://cloud.google.com/vision/docs/languages).
1437 &quot;A String&quot;,
1438 ],
1439 &quot;webDetectionParams&quot;: { # Parameters for web detection request. # Parameters for web detection.
1440 &quot;includeGeoResults&quot;: True or False, # Whether to include results derived from the geo information in the image.
1441 },
1442 &quot;latLongRect&quot;: { # Rectangle determined by min and max `LatLng` pairs. # Not used.
1443 &quot;maxLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair.
1444 # of doubles representing degrees latitude and degrees longitude. Unless
1445 # specified otherwise, this must conform to the
1446 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1447 # standard&lt;/a&gt;. Values must be within normalized ranges.
1448 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1449 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1450 },
1451 &quot;minLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair.
1452 # of doubles representing degrees latitude and degrees longitude. Unless
1453 # specified otherwise, this must conform to the
1454 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1455 # standard&lt;/a&gt;. Values must be within normalized ranges.
1456 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1457 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1458 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001459 },
1460 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001461 },
1462 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001463 }
1464
1465 x__xgafv: string, V1 error format.
1466 Allowed values
1467 1 - v1 error format
1468 2 - v2 error format
1469
1470Returns:
1471 An object of the form:
1472
1473 { # This resource represents a long-running operation that is the result of a
1474 # network API call.
Bu Sun Kim65020912020-05-20 12:08:20 -07001475 &quot;error&quot;: { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001476 # different programming environments, including REST APIs and RPC APIs. It is
1477 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
1478 # three pieces of data: error code, error message, and error details.
1479 #
1480 # You can find out more about this error model and how to work with it in the
1481 # [API Design Guide](https://cloud.google.com/apis/design/errors).
Bu Sun Kim65020912020-05-20 12:08:20 -07001482 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
1483 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001484 # user-facing error message should be localized and sent in the
1485 # google.rpc.Status.details field, or localized by the client.
Bu Sun Kim65020912020-05-20 12:08:20 -07001486 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001487 # message types for APIs to use.
1488 {
Bu Sun Kim65020912020-05-20 12:08:20 -07001489 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001490 },
1491 ],
1492 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001493 &quot;metadata&quot;: { # Service-specific metadata associated with the operation. It typically
1494 # contains progress information and common metadata such as create time.
1495 # Some services might not provide such metadata. Any method that returns a
1496 # long-running operation should document the metadata type, if any.
1497 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
1498 },
1499 &quot;done&quot;: True or False, # If the value is `false`, it means the operation is still in progress.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001500 # If `true`, the operation is completed, and either `error` or `response` is
1501 # available.
Bu Sun Kim65020912020-05-20 12:08:20 -07001502 &quot;response&quot;: { # The normal response of the operation in case of success. If the original
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001503 # method returns no data on success, such as `Delete`, the response is
1504 # `google.protobuf.Empty`. If the original method is standard
1505 # `Get`/`Create`/`Update`, the response should be the resource. For other
1506 # methods, the response should have the type `XxxResponse`, where `Xxx`
1507 # is the original method name. For example, if the original method name
1508 # is `TakeSnapshot()`, the inferred response type is
1509 # `TakeSnapshotResponse`.
Bu Sun Kim65020912020-05-20 12:08:20 -07001510 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001511 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001512 &quot;name&quot;: &quot;A String&quot;, # The server-assigned name, which is only unique within the same service that
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001513 # originally returns it. If you use the default HTTP mapping, the
1514 # `name` should be a resource name ending with `operations/{unique_id}`.
1515 }</pre>
1516</div>
1517
1518</body></html>