blob: 500733494fced8c0ebad461651684612f76d6675 [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_v1p1beta1.html">Cloud Vision API</a> . <a href="vision_v1p1beta1.files.html">files</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">Service that performs image detection and annotation for a batch of files.</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 generic</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>Service that performs image detection and annotation for a batch of files.
Bu Sun Kim65020912020-05-20 12:08:20 -070087Now only &quot;application/pdf&quot;, &quot;image/tiff&quot; and &quot;image/gif&quot; are supported.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070088
89This service will extract at most 5 (customers can specify which 5 in
90AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
91file provided and perform detection and annotation for each image
92extracted.
93
94Args:
Dan O'Mearadd494642020-05-01 07:42:23 -070095 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070096 The object takes the form of:
97
98{ # A list of requests to annotate files using the BatchAnnotateFiles API.
Bu Sun Kimd059ad82020-07-22 17:02:09 -070099 &quot;parent&quot;: &quot;A String&quot;, # Optional. Target project and location to make a call.
100 #
101 # Format: `projects/{project-id}/locations/{location-id}`.
102 #
103 # If no parent is specified, a region will be chosen automatically.
104 #
105 # Supported location-ids:
106 # `us`: USA country only,
107 # `asia`: East asia areas, like Japan, Taiwan,
108 # `eu`: The European Union.
109 #
110 # Example: `projects/project-A/locations/eu`.
Bu Sun Kim65020912020-05-20 12:08:20 -0700111 &quot;requests&quot;: [ # Required. The list of file annotation requests. Right now we support only one
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700112 # AnnotateFileRequest in BatchAnnotateFilesRequest.
113 { # A request to annotate one single file, e.g. a PDF, TIFF or GIF file.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700114 &quot;inputConfig&quot;: { # The desired input location and metadata. # Required. Information about the input file.
115 &quot;gcsSource&quot;: { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from.
116 &quot;uri&quot;: &quot;A String&quot;, # Google Cloud Storage URI for the input file. This must only be a
117 # Google Cloud Storage object. Wildcards are not currently supported.
Bu Sun Kim65020912020-05-20 12:08:20 -0700118 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700119 &quot;mimeType&quot;: &quot;A String&quot;, # The type of the file. Currently only &quot;application/pdf&quot;, &quot;image/tiff&quot; and
120 # &quot;image/gif&quot; are supported. Wildcards are not supported.
121 &quot;content&quot;: &quot;A String&quot;, # File content, represented as a stream of bytes.
122 # Note: As with all `bytes` fields, protobuffers use a pure binary
123 # representation, whereas JSON representations use base64.
124 #
125 # Currently, this field only works for BatchAnnotateFiles requests. It does
126 # not work for AsyncBatchAnnotateFiles requests.
Bu Sun Kim65020912020-05-20 12:08:20 -0700127 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700128 &quot;pages&quot;: [ # Pages of the file to perform image annotation.
129 #
130 # Pages starts from 1, we assume the first page of the file is page 1.
131 # At most 5 pages are supported per request. Pages can be negative.
132 #
133 # Page 1 means the first page.
134 # Page 2 means the second page.
135 # Page -1 means the last page.
136 # Page -2 means the second to the last page.
137 #
138 # If the file is GIF instead of PDF or TIFF, page refers to GIF frames.
139 #
140 # If this field is empty, by default the service performs image annotation
141 # for the first 5 pages of the file.
142 42,
143 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700144 &quot;imageContext&quot;: { # Image context and/or feature-specific parameters. # Additional context that may accompany the image(s) in the file.
145 &quot;productSearchParams&quot;: { # Parameters for a product search request. # Parameters for product search.
146 &quot;productCategories&quot;: [ # The list of product categories to search in. Currently, we only consider
147 # the first category, and either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, &quot;toys-v2&quot;,
148 # &quot;packagedgoods-v1&quot;, or &quot;general-v1&quot; should be specified. The legacy
149 # categories &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported but will
150 # be deprecated. For new products, please use &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;,
151 # or &quot;toys-v2&quot; for better product search accuracy. It is recommended to
152 # migrate existing products to these categories as well.
153 &quot;A String&quot;,
154 ],
155 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image.
156 # If it is not specified, system discretion will be applied.
157 &quot;vertices&quot;: [ # The bounding polygon vertices.
158 { # A vertex represents a 2D point in the image.
159 # NOTE: the vertex coordinates are in the same scale as the original image.
160 &quot;y&quot;: 42, # Y coordinate.
161 &quot;x&quot;: 42, # X coordinate.
162 },
163 ],
164 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
165 { # A vertex represents a 2D point in the image.
166 # NOTE: the normalized vertex coordinates are relative to the original image
167 # and range from 0 to 1.
168 &quot;x&quot;: 3.14, # X coordinate.
169 &quot;y&quot;: 3.14, # Y coordinate.
170 },
171 ],
172 },
173 &quot;filter&quot;: &quot;A String&quot;, # The filtering expression. This can be used to restrict search results based
174 # on Product labels. We currently support an AND of OR of key-value
175 # expressions, where each expression within an OR must have the same key. An
176 # &#x27;=&#x27; should be used to connect the key and value.
177 #
178 # For example, &quot;(color = red OR color = blue) AND brand = Google&quot; is
179 # acceptable, but &quot;(color = red OR brand = Google)&quot; is not acceptable.
180 # &quot;color: red&quot; is not acceptable because it uses a &#x27;:&#x27; instead of an &#x27;=&#x27;.
181 &quot;productSet&quot;: &quot;A String&quot;, # The resource name of a ProductSet to be searched for similar images.
182 #
183 # Format is:
184 # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700185 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700186 &quot;cropHintsParams&quot;: { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request.
187 &quot;aspectRatios&quot;: [ # Aspect ratios in floats, representing the ratio of the width to the height
188 # of the image. For example, if the desired aspect ratio is 4/3, the
189 # corresponding float value should be 1.33333. If not specified, the
190 # best possible crop is returned. The number of provided aspect ratios is
191 # limited to a maximum of 16; any aspect ratios provided after the 16th are
192 # ignored.
193 3.14,
194 ],
195 },
196 &quot;webDetectionParams&quot;: { # Parameters for web detection request. # Parameters for web detection.
197 &quot;includeGeoResults&quot;: True or False, # Whether to include results derived from the geo information in the image.
198 },
199 &quot;latLongRect&quot;: { # Rectangle determined by min and max `LatLng` pairs. # Not used.
200 &quot;minLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair.
201 # of doubles representing degrees latitude and degrees longitude. Unless
202 # specified otherwise, this must conform to the
203 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
204 # standard&lt;/a&gt;. Values must be within normalized ranges.
205 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
206 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
207 },
208 &quot;maxLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair.
209 # of doubles representing degrees latitude and degrees longitude. Unless
210 # specified otherwise, this must conform to the
211 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
212 # standard&lt;/a&gt;. Values must be within normalized ranges.
213 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
214 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
215 },
216 },
217 &quot;languageHints&quot;: [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value
218 # yields the best results since it enables automatic language detection. For
219 # languages based on the Latin alphabet, setting `language_hints` is not
220 # needed. In rare cases, when the language of the text in the image is known,
221 # setting a hint will help get better results (although it will be a
222 # significant hindrance if the hint is wrong). Text detection returns an
223 # error if one or more of the specified languages is not one of the
224 # [supported languages](https://cloud.google.com/vision/docs/languages).
225 &quot;A String&quot;,
226 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700227 },
228 &quot;features&quot;: [ # Required. Requested features.
229 { # The type of Google Cloud Vision API detection to perform, and the maximum
230 # number of results to return for that type. Multiple `Feature` objects can
231 # be specified in the `features` list.
232 &quot;type&quot;: &quot;A String&quot;, # The feature type.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700233 &quot;model&quot;: &quot;A String&quot;, # Model to use for the feature.
234 # Supported values: &quot;builtin/stable&quot; (the default if unset) and
235 # &quot;builtin/latest&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700236 &quot;maxResults&quot;: 42, # Maximum number of results of this type. Does not apply to
237 # `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700238 },
239 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700240 },
241 ],
242 }
243
244 x__xgafv: string, V1 error format.
245 Allowed values
246 1 - v1 error format
247 2 - v2 error format
248
249Returns:
250 An object of the form:
251
252 { # A list of file annotation responses.
Bu Sun Kim65020912020-05-20 12:08:20 -0700253 &quot;responses&quot;: [ # The list of file annotation responses, each response corresponding to each
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700254 # AnnotateFileRequest in BatchAnnotateFilesRequest.
255 { # Response to a single file annotation request. A file may contain one or more
256 # images, which individually have their own responses.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700257 &quot;inputConfig&quot;: { # The desired input location and metadata. # Information about the file for which this response is generated.
258 &quot;gcsSource&quot;: { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from.
259 &quot;uri&quot;: &quot;A String&quot;, # Google Cloud Storage URI for the input file. This must only be a
260 # Google Cloud Storage object. Wildcards are not currently supported.
261 },
262 &quot;mimeType&quot;: &quot;A String&quot;, # The type of the file. Currently only &quot;application/pdf&quot;, &quot;image/tiff&quot; and
263 # &quot;image/gif&quot; are supported. Wildcards are not supported.
264 &quot;content&quot;: &quot;A String&quot;, # File content, represented as a stream of bytes.
265 # Note: As with all `bytes` fields, protobuffers use a pure binary
266 # representation, whereas JSON representations use base64.
267 #
268 # Currently, this field only works for BatchAnnotateFiles requests. It does
269 # not work for AsyncBatchAnnotateFiles requests.
270 },
271 &quot;totalPages&quot;: 42, # This field gives the total number of pages in the file.
272 &quot;error&quot;: { # The `Status` type defines a logical error model that is suitable for # If set, represents the error message for the failed request. The
273 # `responses` field will not be set in this case.
274 # different programming environments, including REST APIs and RPC APIs. It is
275 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
276 # three pieces of data: error code, error message, and error details.
277 #
278 # You can find out more about this error model and how to work with it in the
279 # [API Design Guide](https://cloud.google.com/apis/design/errors).
280 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
281 # message types for APIs to use.
282 {
283 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
284 },
285 ],
286 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
287 # user-facing error message should be localized and sent in the
288 # google.rpc.Status.details field, or localized by the client.
289 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
290 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700291 &quot;responses&quot;: [ # Individual responses to images found within the file. This field will be
Dan O'Mearadd494642020-05-01 07:42:23 -0700292 # empty if the `error` field is set.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700293 { # Response to an image annotation request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700294 &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 -0700295 # completed successfully.
296 # This annotation provides the structural hierarchy for the OCR detected
297 # text.
298 # The hierarchy of an OCR extracted text structure is like this:
Dan O'Mearadd494642020-05-01 07:42:23 -0700299 # TextAnnotation -&gt; Page -&gt; Block -&gt; Paragraph -&gt; Word -&gt; Symbol
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700300 # Each structural component, starting from Page, may further have their own
301 # properties. Properties describe detected languages, breaks etc.. Please refer
302 # to the TextAnnotation.TextProperty message definition below for more
303 # detail.
Bu Sun Kim65020912020-05-20 12:08:20 -0700304 &quot;pages&quot;: [ # List of pages detected by OCR.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700305 { # Detected page from OCR.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700306 &quot;confidence&quot;: 3.14, # Confidence of the OCR results on the page. Range [0, 1].
Bu Sun Kim65020912020-05-20 12:08:20 -0700307 &quot;blocks&quot;: [ # List of blocks of text, images etc on this page.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700308 { # Logical element on the page.
Bu Sun Kim65020912020-05-20 12:08:20 -0700309 &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 -0700310 # The vertices are in the order of top-left, top-right, bottom-right,
311 # bottom-left. When a rotation of the bounding box is detected the rotation
312 # is represented as around the top-left corner as defined when the text is
Bu Sun Kim65020912020-05-20 12:08:20 -0700313 # read in the &#x27;natural&#x27; orientation.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700314 # For example:
315 #
316 # * when the text is horizontal it might look like:
317 #
318 # 0----1
319 # | |
320 # 3----2
321 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700322 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700323 #
324 # 2----3
325 # | |
326 # 1----0
327 #
328 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700329 &quot;vertices&quot;: [ # The bounding polygon vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700330 { # A vertex represents a 2D point in the image.
331 # NOTE: the vertex coordinates are in the same scale as the original image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700332 &quot;y&quot;: 42, # Y coordinate.
333 &quot;x&quot;: 42, # X coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700334 },
335 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700336 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
337 { # A vertex represents a 2D point in the image.
338 # NOTE: the normalized vertex coordinates are relative to the original image
339 # and range from 0 to 1.
340 &quot;x&quot;: 3.14, # X coordinate.
341 &quot;y&quot;: 3.14, # Y coordinate.
342 },
343 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700344 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700345 &quot;confidence&quot;: 3.14, # Confidence of the OCR results on the block. Range [0, 1].
346 &quot;paragraphs&quot;: [ # List of paragraphs in this block (if this blocks is of type text).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700347 { # Structural unit of text representing a number of words in certain order.
Bu Sun Kim65020912020-05-20 12:08:20 -0700348 &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 -0700349 # The vertices are in the order of top-left, top-right, bottom-right,
350 # bottom-left. When a rotation of the bounding box is detected the rotation
351 # is represented as around the top-left corner as defined when the text is
Bu Sun Kim65020912020-05-20 12:08:20 -0700352 # read in the &#x27;natural&#x27; orientation.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700353 # For example:
354 # * when the text is horizontal it might look like:
355 # 0----1
356 # | |
357 # 3----2
Bu Sun Kim65020912020-05-20 12:08:20 -0700358 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700359 # 2----3
360 # | |
361 # 1----0
362 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700363 &quot;vertices&quot;: [ # The bounding polygon vertices.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700364 { # A vertex represents a 2D point in the image.
365 # NOTE: the vertex coordinates are in the same scale as the original image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700366 &quot;y&quot;: 42, # Y coordinate.
367 &quot;x&quot;: 42, # X coordinate.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700368 },
369 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700370 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
371 { # A vertex represents a 2D point in the image.
372 # NOTE: the normalized vertex coordinates are relative to the original image
373 # and range from 0 to 1.
374 &quot;x&quot;: 3.14, # X coordinate.
375 &quot;y&quot;: 3.14, # Y coordinate.
376 },
377 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700378 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700379 &quot;words&quot;: [ # List of all words in this paragraph.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700380 { # A word representation.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700381 &quot;confidence&quot;: 3.14, # Confidence of the OCR results for the word. Range [0, 1].
382 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the word.
383 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
384 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
385 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
386 },
387 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
388 { # Detected language for a structural component.
389 &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
390 # information, see
391 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
392 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
393 },
394 ],
395 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700396 &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 -0700397 # The vertices are in the order of top-left, top-right, bottom-right,
398 # bottom-left. When a rotation of the bounding box is detected the rotation
399 # is represented as around the top-left corner as defined when the text is
Bu Sun Kim65020912020-05-20 12:08:20 -0700400 # read in the &#x27;natural&#x27; orientation.
Dan O'Mearadd494642020-05-01 07:42:23 -0700401 # For example:
402 # * when the text is horizontal it might look like:
403 # 0----1
404 # | |
405 # 3----2
Bu Sun Kim65020912020-05-20 12:08:20 -0700406 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
Dan O'Mearadd494642020-05-01 07:42:23 -0700407 # 2----3
408 # | |
409 # 1----0
410 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700411 &quot;vertices&quot;: [ # The bounding polygon vertices.
Dan O'Mearadd494642020-05-01 07:42:23 -0700412 { # A vertex represents a 2D point in the image.
413 # NOTE: the vertex coordinates are in the same scale as the original image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700414 &quot;y&quot;: 42, # Y coordinate.
415 &quot;x&quot;: 42, # X coordinate.
Dan O'Mearadd494642020-05-01 07:42:23 -0700416 },
417 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700418 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
419 { # A vertex represents a 2D point in the image.
420 # NOTE: the normalized vertex coordinates are relative to the original image
421 # and range from 0 to 1.
422 &quot;x&quot;: 3.14, # X coordinate.
423 &quot;y&quot;: 3.14, # Y coordinate.
424 },
425 ],
Dan O'Mearadd494642020-05-01 07:42:23 -0700426 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700427 &quot;symbols&quot;: [ # List of symbols in the word.
428 # The order of the symbols follows the natural reading order.
429 { # A single symbol representation.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700430 &quot;confidence&quot;: 3.14, # Confidence of the OCR results for the symbol. Range [0, 1].
Bu Sun Kim65020912020-05-20 12:08:20 -0700431 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the symbol.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700432 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
433 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
434 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
435 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700436 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
437 { # Detected language for a structural component.
438 &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
439 # information, see
440 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
441 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
442 },
443 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700444 },
445 &quot;boundingBox&quot;: { # A bounding polygon for the detected image annotation. # The bounding box for the symbol.
446 # The vertices are in the order of top-left, top-right, bottom-right,
447 # bottom-left. When a rotation of the bounding box is detected the rotation
448 # is represented as around the top-left corner as defined when the text is
449 # read in the &#x27;natural&#x27; orientation.
450 # For example:
451 # * when the text is horizontal it might look like:
452 # 0----1
453 # | |
454 # 3----2
455 # * when it&#x27;s rotated 180 degrees around the top-left corner it becomes:
456 # 2----3
457 # | |
458 # 1----0
459 # and the vertex order will still be (0, 1, 2, 3).
Bu Sun Kim65020912020-05-20 12:08:20 -0700460 &quot;vertices&quot;: [ # The bounding polygon vertices.
461 { # A vertex represents a 2D point in the image.
462 # NOTE: the vertex coordinates are in the same scale as the original image.
463 &quot;y&quot;: 42, # Y coordinate.
464 &quot;x&quot;: 42, # X coordinate.
465 },
466 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700467 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
468 { # A vertex represents a 2D point in the image.
469 # NOTE: the normalized vertex coordinates are relative to the original image
470 # and range from 0 to 1.
471 &quot;x&quot;: 3.14, # X coordinate.
472 &quot;y&quot;: 3.14, # Y coordinate.
473 },
474 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700475 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700476 &quot;text&quot;: &quot;A String&quot;, # The actual UTF-8 representation of the symbol.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700477 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700478 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700479 },
480 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700481 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the paragraph.
482 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
483 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
484 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
485 },
486 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
487 { # Detected language for a structural component.
488 &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
489 # information, see
490 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
491 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
492 },
493 ],
494 },
495 &quot;confidence&quot;: 3.14, # Confidence of the OCR results for the paragraph. Range [0, 1].
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700496 },
497 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700498 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected for the block.
499 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
500 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
501 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
502 },
503 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
504 { # Detected language for a structural component.
505 &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
506 # information, see
507 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
508 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
509 },
510 ],
511 },
512 &quot;blockType&quot;: &quot;A String&quot;, # Detected block type (text, image etc) for this block.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700513 },
514 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700515 &quot;property&quot;: { # Additional information detected on the structural component. # Additional information detected on the page.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700516 &quot;detectedBreak&quot;: { # Detected start or end of a structural component. # Detected start or end of a text segment.
517 &quot;type&quot;: &quot;A String&quot;, # Detected break type.
518 &quot;isPrefix&quot;: True or False, # True if break prepends the element.
519 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700520 &quot;detectedLanguages&quot;: [ # A list of detected languages together with confidence.
521 { # Detected language for a structural component.
522 &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
523 # information, see
524 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
525 &quot;confidence&quot;: 3.14, # Confidence of detected language. Range [0, 1].
526 },
527 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700528 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700529 &quot;height&quot;: 42, # Page height. For PDFs the unit is points. For images (including
530 # TIFFs) the unit is pixels.
531 &quot;width&quot;: 42, # Page width. For PDFs the unit is points. For images (including
532 # TIFFs) the unit is pixels.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700533 },
534 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700535 &quot;text&quot;: &quot;A String&quot;, # UTF-8 text detected on the pages.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700536 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700537 &quot;error&quot;: { # The `Status` type defines a logical error model that is suitable for # If set, represents the error message for the operation.
538 # Note that filled-in image annotations are guaranteed to be
539 # correct, even when `error` is set.
540 # different programming environments, including REST APIs and RPC APIs. It is
541 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
542 # three pieces of data: error code, error message, and error details.
543 #
544 # You can find out more about this error model and how to work with it in the
545 # [API Design Guide](https://cloud.google.com/apis/design/errors).
546 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
547 # message types for APIs to use.
548 {
549 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
550 },
551 ],
552 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
553 # user-facing error message should be localized and sent in the
554 # google.rpc.Status.details field, or localized by the client.
555 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
556 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700557 &quot;textAnnotations&quot;: [ # If present, text (OCR) detection has completed successfully.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700558 { # Set of detected entity features.
Bu Sun Kim65020912020-05-20 12:08:20 -0700559 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
560 # `description` is expressed.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700561 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
562 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
563 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
564 # detected distant towering building, even though the confidence that
565 # there is a tower in each image may be the same. Range [0, 1].
566 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
567 # fields, such a score or string that qualifies the entity.
568 { # A `Property` consists of a user-supplied name/value pair.
569 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
570 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
571 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
572 },
573 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700574 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
575 # [Google Knowledge Graph Search
576 # API](https://developers.google.com/knowledge-graph/).
577 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
578 # The accuracy of the entity detection in an image.
579 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
580 # this field represents the confidence that there is a tower in the query
581 # image. Range [0, 1].
582 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
583 # for `LABEL_DETECTION` features.
584 &quot;vertices&quot;: [ # The bounding polygon vertices.
585 { # A vertex represents a 2D point in the image.
586 # NOTE: the vertex coordinates are in the same scale as the original image.
587 &quot;y&quot;: 42, # Y coordinate.
588 &quot;x&quot;: 42, # X coordinate.
589 },
590 ],
591 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
592 { # A vertex represents a 2D point in the image.
593 # NOTE: the normalized vertex coordinates are relative to the original image
594 # and range from 0 to 1.
595 &quot;x&quot;: 3.14, # X coordinate.
596 &quot;y&quot;: 3.14, # Y coordinate.
597 },
598 ],
599 },
600 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
601 # `LocationInfo` elements can be present because one location may
602 # indicate the location of the scene in the image, and another location
603 # may indicate the location of the place where the image was taken.
604 # Location information is usually present for landmarks.
605 { # Detected entity location information.
606 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
607 # of doubles representing degrees latitude and degrees longitude. Unless
608 # specified otherwise, this must conform to the
609 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
610 # standard&lt;/a&gt;. Values must be within normalized ranges.
611 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
612 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
613 },
614 },
615 ],
616 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
617 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700618 },
619 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700620 &quot;faceAnnotations&quot;: [ # If present, face detection has completed successfully.
621 { # A face annotation object contains the results of face detection.
622 &quot;landmarkingConfidence&quot;: 3.14, # Face landmarking confidence. Range [0, 1].
623 &quot;panAngle&quot;: 3.14, # Yaw angle, which indicates the leftward/rightward angle that the face is
624 # pointing relative to the vertical plane perpendicular to the image. Range
625 # [-180,180].
626 &quot;surpriseLikelihood&quot;: &quot;A String&quot;, # Surprise likelihood.
627 &quot;tiltAngle&quot;: 3.14, # Pitch angle, which indicates the upwards/downwards angle that the face is
628 # pointing relative to the image&#x27;s horizontal plane. Range [-180,180].
629 &quot;blurredLikelihood&quot;: &quot;A String&quot;, # Blurred likelihood.
630 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the face. The coordinates of the bounding box
631 # are in the original image&#x27;s scale.
632 # The bounding box is computed to &quot;frame&quot; the face in accordance with human
633 # expectations. It is based on the landmarker results.
634 # Note that one or more x and/or y coordinates may not be generated in the
635 # `BoundingPoly` (the polygon will be unbounded) if only a partial face
636 # appears in the image to be annotated.
637 &quot;vertices&quot;: [ # The bounding polygon vertices.
638 { # A vertex represents a 2D point in the image.
639 # NOTE: the vertex coordinates are in the same scale as the original image.
640 &quot;y&quot;: 42, # Y coordinate.
641 &quot;x&quot;: 42, # X coordinate.
642 },
643 ],
644 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
645 { # A vertex represents a 2D point in the image.
646 # NOTE: the normalized vertex coordinates are relative to the original image
647 # and range from 0 to 1.
648 &quot;x&quot;: 3.14, # X coordinate.
649 &quot;y&quot;: 3.14, # Y coordinate.
650 },
651 ],
652 },
653 &quot;headwearLikelihood&quot;: &quot;A String&quot;, # Headwear likelihood.
654 &quot;fdBoundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The `fd_bounding_poly` bounding polygon is tighter than the
655 # `boundingPoly`, and encloses only the skin part of the face. Typically, it
656 # is used to eliminate the face from any image analysis that detects the
657 # &quot;amount of skin&quot; visible in an image. It is not based on the
658 # landmarker results, only on the initial face detection, hence
659 # the &lt;code&gt;fd&lt;/code&gt; (face detection) prefix.
660 &quot;vertices&quot;: [ # The bounding polygon vertices.
661 { # A vertex represents a 2D point in the image.
662 # NOTE: the vertex coordinates are in the same scale as the original image.
663 &quot;y&quot;: 42, # Y coordinate.
664 &quot;x&quot;: 42, # X coordinate.
665 },
666 ],
667 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
668 { # A vertex represents a 2D point in the image.
669 # NOTE: the normalized vertex coordinates are relative to the original image
670 # and range from 0 to 1.
671 &quot;x&quot;: 3.14, # X coordinate.
672 &quot;y&quot;: 3.14, # Y coordinate.
673 },
674 ],
675 },
676 &quot;detectionConfidence&quot;: 3.14, # Detection confidence. Range [0, 1].
677 &quot;underExposedLikelihood&quot;: &quot;A String&quot;, # Under-exposed likelihood.
678 &quot;joyLikelihood&quot;: &quot;A String&quot;, # Joy likelihood.
679 &quot;sorrowLikelihood&quot;: &quot;A String&quot;, # Sorrow likelihood.
680 &quot;landmarks&quot;: [ # Detected face landmarks.
681 { # A face-specific landmark (for example, a face feature).
682 &quot;position&quot;: { # A 3D position in the image, used primarily for Face detection landmarks. # Face landmark position.
683 # A valid Position must have both x and y coordinates.
684 # The position coordinates are in the same scale as the original image.
685 &quot;x&quot;: 3.14, # X coordinate.
686 &quot;y&quot;: 3.14, # Y coordinate.
687 &quot;z&quot;: 3.14, # Z coordinate (or depth).
688 },
689 &quot;type&quot;: &quot;A String&quot;, # Face landmark type.
690 },
691 ],
692 &quot;rollAngle&quot;: 3.14, # Roll angle, which indicates the amount of clockwise/anti-clockwise rotation
693 # of the face relative to the image vertical about the axis perpendicular to
694 # the face. Range [-180,180].
695 &quot;angerLikelihood&quot;: &quot;A String&quot;, # Anger likelihood.
696 },
697 ],
698 &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
699 # comes from.
700 # information about the source of that image.
701 &quot;uri&quot;: &quot;A String&quot;, # The URI of the file used to produce the image.
702 &quot;pageNumber&quot;: 42, # If the file was a PDF or TIFF, this field gives the page number within
703 # the file used to produce the image.
704 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700705 &quot;imagePropertiesAnnotation&quot;: { # Stores image properties, such as dominant colors. # If present, image properties were extracted successfully.
706 &quot;dominantColors&quot;: { # Set of dominant colors and their corresponding scores. # If present, dominant colors completed successfully.
707 &quot;colors&quot;: [ # RGB color values with their score and pixel fraction.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700708 { # Color information consists of RGB channels, score, and the fraction of
709 # the image that the color occupies in the image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700710 &quot;pixelFraction&quot;: 3.14, # The fraction of pixels the color occupies in the image.
711 # Value in range [0, 1].
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700712 &quot;score&quot;: 3.14, # Image-specific score for this color. Value in range [0, 1].
Bu Sun Kim65020912020-05-20 12:08:20 -0700713 &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 -0700714 # for simplicity of conversion to/from color representations in various
715 # languages over compactness; for example, the fields of this representation
Bu Sun Kim65020912020-05-20 12:08:20 -0700716 # can be trivially provided to the constructor of &quot;java.awt.Color&quot; in Java; it
717 # can also be trivially provided to UIColor&#x27;s &quot;+colorWithRed:green:blue:alpha&quot;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700718 # method in iOS; and, with just a little work, it can be easily formatted into
Bu Sun Kim65020912020-05-20 12:08:20 -0700719 # a CSS &quot;rgba()&quot; string in JavaScript, as well.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700720 #
721 # Note: this proto does not carry information about the absolute color space
722 # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
723 # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color
724 # space.
725 #
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700726 # Note: when color equality needs to be decided, implementations, unless
727 # documented otherwise, will treat two colors to be equal if all their red,
728 # green, blue and alpha values each differ by at most 1e-5.
729 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700730 # Example (Java):
731 #
732 # import com.google.type.Color;
733 #
734 # // ...
735 # public static java.awt.Color fromProto(Color protocolor) {
736 # float alpha = protocolor.hasAlpha()
737 # ? protocolor.getAlpha().getValue()
738 # : 1.0;
739 #
740 # return new java.awt.Color(
741 # protocolor.getRed(),
742 # protocolor.getGreen(),
743 # protocolor.getBlue(),
744 # alpha);
745 # }
746 #
747 # public static Color toProto(java.awt.Color color) {
748 # float red = (float) color.getRed();
749 # float green = (float) color.getGreen();
750 # float blue = (float) color.getBlue();
751 # float denominator = 255.0;
752 # Color.Builder resultBuilder =
753 # Color
754 # .newBuilder()
755 # .setRed(red / denominator)
756 # .setGreen(green / denominator)
757 # .setBlue(blue / denominator);
758 # int alpha = color.getAlpha();
759 # if (alpha != 255) {
760 # result.setAlpha(
761 # FloatValue
762 # .newBuilder()
763 # .setValue(((float) alpha) / denominator)
764 # .build());
765 # }
766 # return resultBuilder.build();
767 # }
768 # // ...
769 #
770 # Example (iOS / Obj-C):
771 #
772 # // ...
773 # static UIColor* fromProto(Color* protocolor) {
774 # float red = [protocolor red];
775 # float green = [protocolor green];
776 # float blue = [protocolor blue];
777 # FloatValue* alpha_wrapper = [protocolor alpha];
778 # float alpha = 1.0;
779 # if (alpha_wrapper != nil) {
780 # alpha = [alpha_wrapper value];
781 # }
782 # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
783 # }
784 #
785 # static Color* toProto(UIColor* color) {
786 # CGFloat red, green, blue, alpha;
Dan O'Mearadd494642020-05-01 07:42:23 -0700787 # if (![color getRed:&amp;red green:&amp;green blue:&amp;blue alpha:&amp;alpha]) {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700788 # return nil;
789 # }
790 # Color* result = [[Color alloc] init];
791 # [result setRed:red];
792 # [result setGreen:green];
793 # [result setBlue:blue];
Dan O'Mearadd494642020-05-01 07:42:23 -0700794 # if (alpha &lt;= 0.9999) {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700795 # [result setAlpha:floatWrapperWithValue(alpha)];
796 # }
797 # [result autorelease];
798 # return result;
799 # }
800 # // ...
801 #
802 # Example (JavaScript):
803 #
804 # // ...
805 #
806 # var protoToCssColor = function(rgb_color) {
807 # var redFrac = rgb_color.red || 0.0;
808 # var greenFrac = rgb_color.green || 0.0;
809 # var blueFrac = rgb_color.blue || 0.0;
810 # var red = Math.floor(redFrac * 255);
811 # var green = Math.floor(greenFrac * 255);
812 # var blue = Math.floor(blueFrac * 255);
813 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700814 # if (!(&#x27;alpha&#x27; in rgb_color)) {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700815 # return rgbToCssColor_(red, green, blue);
816 # }
817 #
818 # var alphaFrac = rgb_color.alpha.value || 0.0;
Bu Sun Kim65020912020-05-20 12:08:20 -0700819 # var rgbParams = [red, green, blue].join(&#x27;,&#x27;);
820 # return [&#x27;rgba(&#x27;, rgbParams, &#x27;,&#x27;, alphaFrac, &#x27;)&#x27;].join(&#x27;&#x27;);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700821 # };
822 #
823 # var rgbToCssColor_ = function(red, green, blue) {
Dan O'Mearadd494642020-05-01 07:42:23 -0700824 # var rgbNumber = new Number((red &lt;&lt; 16) | (green &lt;&lt; 8) | blue);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700825 # var hexString = rgbNumber.toString(16);
826 # var missingZeros = 6 - hexString.length;
Bu Sun Kim65020912020-05-20 12:08:20 -0700827 # var resultBuilder = [&#x27;#&#x27;];
Dan O'Mearadd494642020-05-01 07:42:23 -0700828 # for (var i = 0; i &lt; missingZeros; i++) {
Bu Sun Kim65020912020-05-20 12:08:20 -0700829 # resultBuilder.push(&#x27;0&#x27;);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700830 # }
831 # resultBuilder.push(hexString);
Bu Sun Kim65020912020-05-20 12:08:20 -0700832 # return resultBuilder.join(&#x27;&#x27;);
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700833 # };
834 #
835 # // ...
Bu Sun Kim65020912020-05-20 12:08:20 -0700836 &quot;blue&quot;: 3.14, # The amount of blue in the color as a value in the interval [0, 1].
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700837 &quot;green&quot;: 3.14, # The amount of green in the color as a value in the interval [0, 1].
838 &quot;red&quot;: 3.14, # The amount of red in the color as a value in the interval [0, 1].
Bu Sun Kim65020912020-05-20 12:08:20 -0700839 &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 -0700840 # the final pixel color is defined by the equation:
841 #
842 # pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
843 #
844 # This means that a value of 1.0 corresponds to a solid color, whereas
845 # a value of 0.0 corresponds to a completely transparent color. This
846 # uses a wrapper message rather than a simple float scalar so that it is
847 # possible to distinguish between a default value and the value being unset.
848 # If omitted, this color object is to be rendered as a solid color
849 # (as if the alpha value had been explicitly given with a value of 1.0).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700850 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700851 },
852 ],
853 },
854 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700855 &quot;webDetection&quot;: { # Relevant information for the image from the Internet. # If present, web detection has completed successfully.
856 &quot;visuallySimilarImages&quot;: [ # The visually similar image results.
857 { # Metadata for online images.
Bu Sun Kim65020912020-05-20 12:08:20 -0700858 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700859 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700860 },
861 ],
862 &quot;bestGuessLabels&quot;: [ # The service&#x27;s best guess as to the topic of the request image.
863 # Inferred from similar images on the open web.
864 { # Label to provide extra metadata for the web detection.
865 &quot;label&quot;: &quot;A String&quot;, # Label for extra metadata.
866 &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;.
867 # For more information, see
868 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
869 },
870 ],
871 &quot;fullMatchingImages&quot;: [ # Fully matching images from the Internet.
872 # Can include resized copies of the query image.
873 { # Metadata for online images.
Bu Sun Kim65020912020-05-20 12:08:20 -0700874 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700875 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
Bu Sun Kim65020912020-05-20 12:08:20 -0700876 },
877 ],
878 &quot;webEntities&quot;: [ # Deduced entities from similar images on the Internet.
879 { # Entity deduced from similar images on the Internet.
Bu Sun Kim65020912020-05-20 12:08:20 -0700880 &quot;description&quot;: &quot;A String&quot;, # Canonical description of the entity, in English.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700881 &quot;entityId&quot;: &quot;A String&quot;, # Opaque entity ID.
Bu Sun Kim65020912020-05-20 12:08:20 -0700882 &quot;score&quot;: 3.14, # Overall relevancy score for the entity.
883 # Not normalized and not comparable across different image queries.
884 },
885 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700886 &quot;partialMatchingImages&quot;: [ # Partial matching images from the Internet.
887 # Those images are similar enough to share some key-point features. For
888 # example an original image will likely have partial matching for its crops.
889 { # Metadata for online images.
Bu Sun Kim65020912020-05-20 12:08:20 -0700890 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700891 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
892 },
893 ],
894 &quot;pagesWithMatchingImages&quot;: [ # Web pages containing the matching images from the Internet.
895 { # Metadata for web pages.
896 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the web page.
897 &quot;url&quot;: &quot;A String&quot;, # The result web page URL.
898 &quot;partialMatchingImages&quot;: [ # Partial matching images on the page.
899 # Those images are similar enough to share some key-point features. For
900 # example an original image will likely have partial matching for its
901 # crops.
902 { # Metadata for online images.
903 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
904 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
905 },
906 ],
907 &quot;pageTitle&quot;: &quot;A String&quot;, # Title for the web page, may contain HTML markups.
908 &quot;fullMatchingImages&quot;: [ # Fully matching images on the page.
909 # Can include resized copies of the query image.
910 { # Metadata for online images.
911 &quot;url&quot;: &quot;A String&quot;, # The result image URL.
912 &quot;score&quot;: 3.14, # (Deprecated) Overall relevancy score for the image.
913 },
914 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700915 },
916 ],
917 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700918 &quot;landmarkAnnotations&quot;: [ # If present, landmark detection has completed successfully.
919 { # Set of detected entity features.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700920 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
921 # `description` is expressed.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700922 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
923 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
924 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
925 # detected distant towering building, even though the confidence that
926 # there is a tower in each image may be the same. Range [0, 1].
927 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
928 # fields, such a score or string that qualifies the entity.
929 { # A `Property` consists of a user-supplied name/value pair.
930 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
931 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
932 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
933 },
934 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700935 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
936 # [Google Knowledge Graph Search
937 # API](https://developers.google.com/knowledge-graph/).
938 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
939 # The accuracy of the entity detection in an image.
940 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
941 # this field represents the confidence that there is a tower in the query
942 # image. Range [0, 1].
943 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
944 # for `LABEL_DETECTION` features.
945 &quot;vertices&quot;: [ # The bounding polygon vertices.
946 { # A vertex represents a 2D point in the image.
947 # NOTE: the vertex coordinates are in the same scale as the original image.
948 &quot;y&quot;: 42, # Y coordinate.
949 &quot;x&quot;: 42, # X coordinate.
950 },
951 ],
952 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
953 { # A vertex represents a 2D point in the image.
954 # NOTE: the normalized vertex coordinates are relative to the original image
955 # and range from 0 to 1.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700956 &quot;x&quot;: 3.14, # X coordinate.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700957 &quot;y&quot;: 3.14, # Y coordinate.
958 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700959 ],
960 },
961 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
962 # `LocationInfo` elements can be present because one location may
963 # indicate the location of the scene in the image, and another location
964 # may indicate the location of the place where the image was taken.
965 # Location information is usually present for landmarks.
966 { # Detected entity location information.
967 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
968 # of doubles representing degrees latitude and degrees longitude. Unless
969 # specified otherwise, this must conform to the
970 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
971 # standard&lt;/a&gt;. Values must be within normalized ranges.
972 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
973 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
974 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700975 },
976 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700977 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
978 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700979 },
980 ],
981 &quot;cropHintsAnnotation&quot;: { # Set of crop hints that are used to generate new crops when serving images. # If present, crop hints have completed successfully.
982 &quot;cropHints&quot;: [ # Crop hint results.
983 { # Single crop hint that is used to generate a new crop when serving an image.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700984 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon for the crop region. The coordinates of the bounding
985 # box are in the original image&#x27;s scale.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700986 &quot;vertices&quot;: [ # The bounding polygon vertices.
987 { # A vertex represents a 2D point in the image.
988 # NOTE: the vertex coordinates are in the same scale as the original image.
989 &quot;y&quot;: 42, # Y coordinate.
990 &quot;x&quot;: 42, # X coordinate.
991 },
992 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700993 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
994 { # A vertex represents a 2D point in the image.
995 # NOTE: the normalized vertex coordinates are relative to the original image
996 # and range from 0 to 1.
997 &quot;x&quot;: 3.14, # X coordinate.
998 &quot;y&quot;: 3.14, # Y coordinate.
999 },
1000 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001001 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001002 &quot;importanceFraction&quot;: 3.14, # Fraction of importance of this salient region with respect to the original
1003 # image.
1004 &quot;confidence&quot;: 3.14, # Confidence of this being a salient region. Range [0, 1].
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001005 },
1006 ],
1007 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001008 &quot;logoAnnotations&quot;: [ # If present, logo detection has completed successfully.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001009 { # Set of detected entity features.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001010 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
1011 # `description` is expressed.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001012 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
1013 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
1014 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
1015 # detected distant towering building, even though the confidence that
1016 # there is a tower in each image may be the same. Range [0, 1].
1017 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
1018 # fields, such a score or string that qualifies the entity.
1019 { # A `Property` consists of a user-supplied name/value pair.
1020 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
1021 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
1022 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
1023 },
1024 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001025 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
1026 # [Google Knowledge Graph Search
1027 # API](https://developers.google.com/knowledge-graph/).
1028 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
1029 # The accuracy of the entity detection in an image.
1030 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
1031 # this field represents the confidence that there is a tower in the query
1032 # image. Range [0, 1].
1033 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
1034 # for `LABEL_DETECTION` features.
1035 &quot;vertices&quot;: [ # The bounding polygon vertices.
1036 { # A vertex represents a 2D point in the image.
1037 # NOTE: the vertex coordinates are in the same scale as the original image.
1038 &quot;y&quot;: 42, # Y coordinate.
1039 &quot;x&quot;: 42, # X coordinate.
1040 },
1041 ],
1042 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1043 { # A vertex represents a 2D point in the image.
1044 # NOTE: the normalized vertex coordinates are relative to the original image
1045 # and range from 0 to 1.
1046 &quot;x&quot;: 3.14, # X coordinate.
1047 &quot;y&quot;: 3.14, # Y coordinate.
1048 },
1049 ],
1050 },
1051 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
1052 # `LocationInfo` elements can be present because one location may
1053 # indicate the location of the scene in the image, and another location
1054 # may indicate the location of the place where the image was taken.
1055 # Location information is usually present for landmarks.
1056 { # Detected entity location information.
1057 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
1058 # of doubles representing degrees latitude and degrees longitude. Unless
1059 # specified otherwise, this must conform to the
1060 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1061 # standard&lt;/a&gt;. Values must be within normalized ranges.
1062 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1063 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1064 },
1065 },
1066 ],
1067 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
1068 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001069 },
1070 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001071 &quot;localizedObjectAnnotations&quot;: [ # If present, localized object detection has completed successfully.
1072 # This will be sorted descending by confidence score.
1073 { # Set of detected objects with bounding boxes.
1074 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this object belongs. This must be populated.
1075 &quot;vertices&quot;: [ # The bounding polygon vertices.
1076 { # A vertex represents a 2D point in the image.
1077 # NOTE: the vertex coordinates are in the same scale as the original image.
1078 &quot;y&quot;: 42, # Y coordinate.
1079 &quot;x&quot;: 42, # X coordinate.
1080 },
1081 ],
1082 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1083 { # A vertex represents a 2D point in the image.
1084 # NOTE: the normalized vertex coordinates are relative to the original image
1085 # and range from 0 to 1.
1086 &quot;x&quot;: 3.14, # X coordinate.
1087 &quot;y&quot;: 3.14, # Y coordinate.
1088 },
1089 ],
1090 },
1091 &quot;mid&quot;: &quot;A String&quot;, # Object ID that should align with EntityAnnotation mid.
1092 &quot;name&quot;: &quot;A String&quot;, # Object name, expressed in its `language_code` language.
1093 &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
1094 # information, see
1095 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
1096 &quot;score&quot;: 3.14, # Score of the result. Range [0, 1].
1097 },
1098 ],
1099 &quot;labelAnnotations&quot;: [ # If present, label detection has completed successfully.
1100 { # Set of detected entity features.
1101 &quot;locale&quot;: &quot;A String&quot;, # The language code for the locale in which the entity textual
1102 # `description` is expressed.
1103 &quot;topicality&quot;: 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
1104 # image. For example, the relevancy of &quot;tower&quot; is likely higher to an image
1105 # containing the detected &quot;Eiffel Tower&quot; than to an image containing a
1106 # detected distant towering building, even though the confidence that
1107 # there is a tower in each image may be the same. Range [0, 1].
1108 &quot;properties&quot;: [ # Some entities may have optional user-supplied `Property` (name/value)
1109 # fields, such a score or string that qualifies the entity.
1110 { # A `Property` consists of a user-supplied name/value pair.
1111 &quot;value&quot;: &quot;A String&quot;, # Value of the property.
1112 &quot;uint64Value&quot;: &quot;A String&quot;, # Value of numeric properties.
1113 &quot;name&quot;: &quot;A String&quot;, # Name of the property.
1114 },
1115 ],
1116 &quot;mid&quot;: &quot;A String&quot;, # Opaque entity ID. Some IDs may be available in
1117 # [Google Knowledge Graph Search
1118 # API](https://developers.google.com/knowledge-graph/).
1119 &quot;confidence&quot;: 3.14, # **Deprecated. Use `score` instead.**
1120 # The accuracy of the entity detection in an image.
1121 # For example, for an image in which the &quot;Eiffel Tower&quot; entity is detected,
1122 # this field represents the confidence that there is a tower in the query
1123 # image. Range [0, 1].
1124 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced
1125 # for `LABEL_DETECTION` features.
1126 &quot;vertices&quot;: [ # The bounding polygon vertices.
1127 { # A vertex represents a 2D point in the image.
1128 # NOTE: the vertex coordinates are in the same scale as the original image.
1129 &quot;y&quot;: 42, # Y coordinate.
1130 &quot;x&quot;: 42, # X coordinate.
1131 },
1132 ],
1133 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1134 { # A vertex represents a 2D point in the image.
1135 # NOTE: the normalized vertex coordinates are relative to the original image
1136 # and range from 0 to 1.
1137 &quot;x&quot;: 3.14, # X coordinate.
1138 &quot;y&quot;: 3.14, # Y coordinate.
1139 },
1140 ],
1141 },
1142 &quot;locations&quot;: [ # The location information for the detected entity. Multiple
1143 # `LocationInfo` elements can be present because one location may
1144 # indicate the location of the scene in the image, and another location
1145 # may indicate the location of the place where the image was taken.
1146 # Location information is usually present for landmarks.
1147 { # Detected entity location information.
1148 &quot;latLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates.
1149 # of doubles representing degrees latitude and degrees longitude. Unless
1150 # specified otherwise, this must conform to the
1151 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1152 # standard&lt;/a&gt;. Values must be within normalized ranges.
1153 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1154 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1155 },
1156 },
1157 ],
1158 &quot;description&quot;: &quot;A String&quot;, # Entity textual description, expressed in its `locale` language.
1159 &quot;score&quot;: 3.14, # Overall score of the result. Range [0, 1].
1160 },
1161 ],
1162 &quot;productSearchResults&quot;: { # Results for a product search request. # If present, product search has completed successfully.
1163 &quot;productGroupedResults&quot;: [ # List of results grouped by products detected in the query image. Each entry
1164 # corresponds to one bounding polygon in the query image, and contains the
1165 # matching products specific to that region. There may be duplicate product
1166 # matches in the union of all the per-product results.
1167 { # Information about the products similar to a single product in a query
1168 # image.
1169 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the product detected in the query image.
1170 &quot;vertices&quot;: [ # The bounding polygon vertices.
1171 { # A vertex represents a 2D point in the image.
1172 # NOTE: the vertex coordinates are in the same scale as the original image.
1173 &quot;y&quot;: 42, # Y coordinate.
1174 &quot;x&quot;: 42, # X coordinate.
1175 },
1176 ],
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 },
1186 &quot;results&quot;: [ # List of results, one for each product match.
1187 { # Information about a product.
1188 &quot;image&quot;: &quot;A String&quot;, # The resource name of the image from the product that is the closest match
1189 # to the query.
1190 &quot;score&quot;: 3.14, # A confidence level on the match, ranging from 0 (no confidence) to
1191 # 1 (full confidence).
1192 &quot;product&quot;: { # A Product contains ReferenceImages. # The Product.
1193 &quot;displayName&quot;: &quot;A String&quot;, # The user-provided name for this Product. Must not be empty. Must be at most
1194 # 4096 characters long.
1195 &quot;productCategory&quot;: &quot;A String&quot;, # Immutable. The category for the product identified by the reference image. This should
1196 # be either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, or &quot;toys-v2&quot;. The legacy categories
1197 # &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported, but these should
1198 # not be used for new products.
1199 &quot;productLabels&quot;: [ # Key-value pairs that can be attached to a product. At query time,
1200 # constraints can be specified based on the product_labels.
1201 #
1202 # Note that integer values can be provided as strings, e.g. &quot;1199&quot;. Only
1203 # strings with integer values can match a range-based restriction which is
1204 # to be supported soon.
1205 #
1206 # Multiple values can be assigned to the same key. One product may have up to
1207 # 500 product_labels.
1208 #
1209 # Notice that the total number of distinct product_labels over all products
1210 # in one ProductSet cannot exceed 1M, otherwise the product search pipeline
1211 # will refuse to work for that ProductSet.
1212 { # A product label represented as a key-value pair.
1213 &quot;key&quot;: &quot;A String&quot;, # The key of the label attached to the product. Cannot be empty and cannot
1214 # exceed 128 bytes.
1215 &quot;value&quot;: &quot;A String&quot;, # The value of the label attached to the product. Cannot be empty and
1216 # cannot exceed 128 bytes.
1217 },
1218 ],
1219 &quot;name&quot;: &quot;A String&quot;, # The resource name of the product.
1220 #
1221 # Format is:
1222 # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
1223 #
1224 # This field is ignored when creating a product.
1225 &quot;description&quot;: &quot;A String&quot;, # User-provided metadata to be stored with this product. Must be at most 4096
1226 # characters long.
1227 },
1228 },
1229 ],
1230 &quot;objectAnnotations&quot;: [ # List of generic predictions for the object in the bounding box.
1231 { # Prediction for what the object in the bounding box is.
1232 &quot;name&quot;: &quot;A String&quot;, # Object name, expressed in its `language_code` language.
1233 &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
1234 # information, see
1235 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
1236 &quot;mid&quot;: &quot;A String&quot;, # Object ID that should align with EntityAnnotation mid.
1237 &quot;score&quot;: 3.14, # Score of the result. Range [0, 1].
1238 },
1239 ],
1240 },
1241 ],
1242 &quot;results&quot;: [ # List of results, one for each product match.
1243 { # Information about a product.
1244 &quot;image&quot;: &quot;A String&quot;, # The resource name of the image from the product that is the closest match
1245 # to the query.
1246 &quot;score&quot;: 3.14, # A confidence level on the match, ranging from 0 (no confidence) to
1247 # 1 (full confidence).
1248 &quot;product&quot;: { # A Product contains ReferenceImages. # The Product.
1249 &quot;displayName&quot;: &quot;A String&quot;, # The user-provided name for this Product. Must not be empty. Must be at most
1250 # 4096 characters long.
1251 &quot;productCategory&quot;: &quot;A String&quot;, # Immutable. The category for the product identified by the reference image. This should
1252 # be either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, or &quot;toys-v2&quot;. The legacy categories
1253 # &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported, but these should
1254 # not be used for new products.
1255 &quot;productLabels&quot;: [ # Key-value pairs that can be attached to a product. At query time,
1256 # constraints can be specified based on the product_labels.
1257 #
1258 # Note that integer values can be provided as strings, e.g. &quot;1199&quot;. Only
1259 # strings with integer values can match a range-based restriction which is
1260 # to be supported soon.
1261 #
1262 # Multiple values can be assigned to the same key. One product may have up to
1263 # 500 product_labels.
1264 #
1265 # Notice that the total number of distinct product_labels over all products
1266 # in one ProductSet cannot exceed 1M, otherwise the product search pipeline
1267 # will refuse to work for that ProductSet.
1268 { # A product label represented as a key-value pair.
1269 &quot;key&quot;: &quot;A String&quot;, # The key of the label attached to the product. Cannot be empty and cannot
1270 # exceed 128 bytes.
1271 &quot;value&quot;: &quot;A String&quot;, # The value of the label attached to the product. Cannot be empty and
1272 # cannot exceed 128 bytes.
1273 },
1274 ],
1275 &quot;name&quot;: &quot;A String&quot;, # The resource name of the product.
1276 #
1277 # Format is:
1278 # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
1279 #
1280 # This field is ignored when creating a product.
1281 &quot;description&quot;: &quot;A String&quot;, # User-provided metadata to be stored with this product. Must be at most 4096
1282 # characters long.
1283 },
1284 },
1285 ],
1286 &quot;indexTime&quot;: &quot;A String&quot;, # Timestamp of the index which provided these results. Products added to the
1287 # product set and products removed from the product set after this time are
1288 # not reflected in the current results.
1289 },
1290 &quot;safeSearchAnnotation&quot;: { # Set of features pertaining to the image, computed by computer vision # If present, safe-search annotation has completed successfully.
1291 # methods over safe-search verticals (for example, adult, spoof, medical,
1292 # violence).
1293 &quot;medical&quot;: &quot;A String&quot;, # Likelihood that this is a medical image.
1294 &quot;racy&quot;: &quot;A String&quot;, # Likelihood that the request image contains racy content. Racy content may
1295 # include (but is not limited to) skimpy or sheer clothing, strategically
1296 # covered nudity, lewd or provocative poses, or close-ups of sensitive
1297 # body areas.
1298 &quot;spoof&quot;: &quot;A String&quot;, # Spoof likelihood. The likelihood that an modification
1299 # was made to the image&#x27;s canonical version to make it appear
1300 # funny or offensive.
1301 &quot;violence&quot;: &quot;A String&quot;, # Likelihood that this image contains violent content.
1302 &quot;adult&quot;: &quot;A String&quot;, # Represents the adult content likelihood for the image. Adult content may
1303 # contain elements such as nudity, pornographic images or cartoons, or
1304 # sexual activities.
1305 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001306 },
1307 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001308 },
1309 ],
1310 }</pre>
1311</div>
1312
1313<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -07001314 <code class="details" id="asyncBatchAnnotate">asyncBatchAnnotate(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001315 <pre>Run asynchronous image detection and annotation for a list of generic
1316files, such as PDF files, which may contain multiple pages and multiple
1317images per page. Progress and results can be retrieved through the
1318`google.longrunning.Operations` interface.
1319`Operation.metadata` contains `OperationMetadata` (metadata).
1320`Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
1321
1322Args:
Dan O'Mearadd494642020-05-01 07:42:23 -07001323 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001324 The object takes the form of:
1325
1326{ # Multiple async file annotation requests are batched into a single service
1327 # call.
Bu Sun Kim65020912020-05-20 12:08:20 -07001328 &quot;requests&quot;: [ # Required. Individual async file annotation requests for this batch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001329 { # An offline file annotation request.
Bu Sun Kim65020912020-05-20 12:08:20 -07001330 &quot;imageContext&quot;: { # Image context and/or feature-specific parameters. # Additional context that may accompany the image(s) in the file.
Bu Sun Kim65020912020-05-20 12:08:20 -07001331 &quot;productSearchParams&quot;: { # Parameters for a product search request. # Parameters for product search.
Bu Sun Kim65020912020-05-20 12:08:20 -07001332 &quot;productCategories&quot;: [ # The list of product categories to search in. Currently, we only consider
1333 # the first category, and either &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;, &quot;toys-v2&quot;,
1334 # &quot;packagedgoods-v1&quot;, or &quot;general-v1&quot; should be specified. The legacy
1335 # categories &quot;homegoods&quot;, &quot;apparel&quot;, and &quot;toys&quot; are still supported but will
1336 # be deprecated. For new products, please use &quot;homegoods-v2&quot;, &quot;apparel-v2&quot;,
1337 # or &quot;toys-v2&quot; for better product search accuracy. It is recommended to
1338 # migrate existing products to these categories as well.
1339 &quot;A String&quot;,
1340 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001341 &quot;boundingPoly&quot;: { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image.
1342 # If it is not specified, system discretion will be applied.
1343 &quot;vertices&quot;: [ # The bounding polygon vertices.
1344 { # A vertex represents a 2D point in the image.
1345 # NOTE: the vertex coordinates are in the same scale as the original image.
1346 &quot;y&quot;: 42, # Y coordinate.
1347 &quot;x&quot;: 42, # X coordinate.
1348 },
1349 ],
1350 &quot;normalizedVertices&quot;: [ # The bounding polygon normalized vertices.
1351 { # A vertex represents a 2D point in the image.
1352 # NOTE: the normalized vertex coordinates are relative to the original image
1353 # and range from 0 to 1.
1354 &quot;x&quot;: 3.14, # X coordinate.
1355 &quot;y&quot;: 3.14, # Y coordinate.
1356 },
1357 ],
1358 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001359 &quot;filter&quot;: &quot;A String&quot;, # The filtering expression. This can be used to restrict search results based
1360 # on Product labels. We currently support an AND of OR of key-value
1361 # expressions, where each expression within an OR must have the same key. An
1362 # &#x27;=&#x27; should be used to connect the key and value.
1363 #
1364 # For example, &quot;(color = red OR color = blue) AND brand = Google&quot; is
1365 # acceptable, but &quot;(color = red OR brand = Google)&quot; is not acceptable.
1366 # &quot;color: red&quot; is not acceptable because it uses a &#x27;:&#x27; instead of an &#x27;=&#x27;.
1367 &quot;productSet&quot;: &quot;A String&quot;, # The resource name of a ProductSet to be searched for similar images.
1368 #
1369 # Format is:
1370 # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001371 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001372 &quot;cropHintsParams&quot;: { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request.
1373 &quot;aspectRatios&quot;: [ # Aspect ratios in floats, representing the ratio of the width to the height
1374 # of the image. For example, if the desired aspect ratio is 4/3, the
1375 # corresponding float value should be 1.33333. If not specified, the
1376 # best possible crop is returned. The number of provided aspect ratios is
1377 # limited to a maximum of 16; any aspect ratios provided after the 16th are
1378 # ignored.
1379 3.14,
1380 ],
1381 },
1382 &quot;webDetectionParams&quot;: { # Parameters for web detection request. # Parameters for web detection.
1383 &quot;includeGeoResults&quot;: True or False, # Whether to include results derived from the geo information in the image.
1384 },
1385 &quot;latLongRect&quot;: { # Rectangle determined by min and max `LatLng` pairs. # Not used.
1386 &quot;minLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair.
1387 # of doubles representing degrees latitude and degrees longitude. Unless
1388 # specified otherwise, this must conform to the
1389 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1390 # standard&lt;/a&gt;. Values must be within normalized ranges.
1391 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1392 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1393 },
1394 &quot;maxLatLng&quot;: { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair.
1395 # of doubles representing degrees latitude and degrees longitude. Unless
1396 # specified otherwise, this must conform to the
1397 # &lt;a href=&quot;http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf&quot;&gt;WGS84
1398 # standard&lt;/a&gt;. Values must be within normalized ranges.
1399 &quot;longitude&quot;: 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
1400 &quot;latitude&quot;: 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
1401 },
1402 },
1403 &quot;languageHints&quot;: [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value
1404 # yields the best results since it enables automatic language detection. For
1405 # languages based on the Latin alphabet, setting `language_hints` is not
1406 # needed. In rare cases, when the language of the text in the image is known,
1407 # setting a hint will help get better results (although it will be a
1408 # significant hindrance if the hint is wrong). Text detection returns an
1409 # error if one or more of the specified languages is not one of the
1410 # [supported languages](https://cloud.google.com/vision/docs/languages).
1411 &quot;A String&quot;,
1412 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001413 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001414 &quot;features&quot;: [ # Required. Requested features.
1415 { # The type of Google Cloud Vision API detection to perform, and the maximum
1416 # number of results to return for that type. Multiple `Feature` objects can
1417 # be specified in the `features` list.
1418 &quot;type&quot;: &quot;A String&quot;, # The feature type.
1419 &quot;model&quot;: &quot;A String&quot;, # Model to use for the feature.
1420 # Supported values: &quot;builtin/stable&quot; (the default if unset) and
1421 # &quot;builtin/latest&quot;.
1422 &quot;maxResults&quot;: 42, # Maximum number of results of this type. Does not apply to
1423 # `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
1424 },
1425 ],
Bu Sun Kim65020912020-05-20 12:08:20 -07001426 &quot;outputConfig&quot;: { # The desired output location and metadata. # Required. The desired output location and metadata (e.g. format).
1427 &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.
1428 &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 -07001429 # will be in JSON format and preceded by its corresponding input URI prefix.
1430 # This field can either represent a gcs file prefix or gcs directory. In
1431 # either case, the uri should be unique because in order to get all of the
1432 # output files, you will need to do a wildcard gcs search on the uri prefix
1433 # you provide.
1434 #
1435 # Examples:
1436 #
1437 # * File Prefix: gs://bucket-name/here/filenameprefix The output files
1438 # will be created in gs://bucket-name/here/ and the names of the
Bu Sun Kim65020912020-05-20 12:08:20 -07001439 # output files will begin with &quot;filenameprefix&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001440 #
1441 # * Directory Prefix: gs://bucket-name/some/location/ The output files
1442 # will be created in gs://bucket-name/some/location/ and the names of the
1443 # output files could be anything because there was no filename prefix
1444 # specified.
1445 #
1446 # If multiple outputs, each response is still AnnotateFileResponse, each of
1447 # which contains some subset of the full list of AnnotateImageResponse.
1448 # Multiple outputs can happen if, for example, the output JSON is too large
1449 # and overflows into multiple sharded files.
1450 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001451 &quot;batchSize&quot;: 42, # The max number of response protos to put into each output JSON file on
1452 # Google Cloud Storage.
1453 # The valid range is [1, 100]. If not specified, the default value is 20.
1454 #
1455 # For example, for one pdf file with 100 pages, 100 response protos will
1456 # be generated. If `batch_size` = 20, then 5 json files each
1457 # containing 20 response protos will be written under the prefix
1458 # `gcs_destination`.`uri`.
1459 #
1460 # Currently, batch_size only applies to GcsDestination, with potential future
1461 # support for other output configurations.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001462 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001463 &quot;inputConfig&quot;: { # The desired input location and metadata. # Required. Information about the input file.
Bu Sun Kim65020912020-05-20 12:08:20 -07001464 &quot;gcsSource&quot;: { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from.
1465 &quot;uri&quot;: &quot;A String&quot;, # Google Cloud Storage URI for the input file. This must only be a
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001466 # Google Cloud Storage object. Wildcards are not currently supported.
1467 },
Bu Sun Kim65020912020-05-20 12:08:20 -07001468 &quot;mimeType&quot;: &quot;A String&quot;, # The type of the file. Currently only &quot;application/pdf&quot;, &quot;image/tiff&quot; and
1469 # &quot;image/gif&quot; are supported. Wildcards are not supported.
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001470 &quot;content&quot;: &quot;A String&quot;, # File content, represented as a stream of bytes.
1471 # Note: As with all `bytes` fields, protobuffers use a pure binary
1472 # representation, whereas JSON representations use base64.
1473 #
1474 # Currently, this field only works for BatchAnnotateFiles requests. It does
1475 # not work for AsyncBatchAnnotateFiles requests.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001476 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001477 },
1478 ],
Bu Sun Kim65020912020-05-20 12:08:20 -07001479 &quot;parent&quot;: &quot;A String&quot;, # Optional. Target project and location to make a call.
Dan O'Mearadd494642020-05-01 07:42:23 -07001480 #
1481 # Format: `projects/{project-id}/locations/{location-id}`.
1482 #
1483 # If no parent is specified, a region will be chosen automatically.
1484 #
1485 # Supported location-ids:
1486 # `us`: USA country only,
1487 # `asia`: East asia areas, like Japan, Taiwan,
1488 # `eu`: The European Union.
1489 #
1490 # Example: `projects/project-A/locations/eu`.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001491 }
1492
1493 x__xgafv: string, V1 error format.
1494 Allowed values
1495 1 - v1 error format
1496 2 - v2 error format
1497
1498Returns:
1499 An object of the form:
1500
1501 { # This resource represents a long-running operation that is the result of a
1502 # network API call.
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001503 &quot;response&quot;: { # The normal response of the operation in case of success. If the original
1504 # method returns no data on success, such as `Delete`, the response is
1505 # `google.protobuf.Empty`. If the original method is standard
1506 # `Get`/`Create`/`Update`, the response should be the resource. For other
1507 # methods, the response should have the type `XxxResponse`, where `Xxx`
1508 # is the original method name. For example, if the original method name
1509 # is `TakeSnapshot()`, the inferred response type is
1510 # `TakeSnapshotResponse`.
1511 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
1512 },
1513 &quot;metadata&quot;: { # Service-specific metadata associated with the operation. It typically
1514 # contains progress information and common metadata such as create time.
1515 # Some services might not provide such metadata. Any method that returns a
1516 # long-running operation should document the metadata type, if any.
1517 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
1518 },
1519 &quot;name&quot;: &quot;A String&quot;, # The server-assigned name, which is only unique within the same service that
1520 # originally returns it. If you use the default HTTP mapping, the
1521 # `name` should be a resource name ending with `operations/{unique_id}`.
1522 &quot;done&quot;: True or False, # If the value is `false`, it means the operation is still in progress.
1523 # If `true`, the operation is completed, and either `error` or `response` is
1524 # available.
Bu Sun Kim65020912020-05-20 12:08:20 -07001525 &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.
1526 # different programming environments, including REST APIs and RPC APIs. It is
1527 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
1528 # three pieces of data: error code, error message, and error details.
1529 #
1530 # You can find out more about this error model and how to work with it in the
1531 # [API Design Guide](https://cloud.google.com/apis/design/errors).
Bu Sun Kim65020912020-05-20 12:08:20 -07001532 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
1533 # message types for APIs to use.
1534 {
1535 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
1536 },
1537 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -07001538 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
1539 # user-facing error message should be localized and sent in the
1540 # google.rpc.Status.details field, or localized by the client.
Bu Sun Kimd059ad82020-07-22 17:02:09 -07001541 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
Bu Sun Kim65020912020-05-20 12:08:20 -07001542 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001543 }</pre>
1544</div>
1545
1546</body></html>