1<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_v1.html">Cloud Vision API</a> . <a href="vision_v1.files.html">files</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#annotate">annotate(body, x__xgafv=None)</a></code></p> 79<p class="firstline">Service that performs image detection and annotation for a batch of files.</p> 80<p class="toc_element"> 81 <code><a href="#asyncBatchAnnotate">asyncBatchAnnotate(body, x__xgafv=None)</a></code></p> 82<p class="firstline">Run asynchronous image detection and annotation for a list of generic</p> 83<h3>Method Details</h3> 84<div class="method"> 85 <code class="details" id="annotate">annotate(body, x__xgafv=None)</code> 86 <pre>Service that performs image detection and annotation for a batch of files. 87Now only "application/pdf", "image/tiff" and "image/gif" are supported. 88 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: 95 body: object, The request body. (required) 96 The object takes the form of: 97 98{ # A list of requests to annotate files using the BatchAnnotateFiles API. 99 "requests": [ # The list of file annotation requests. Right now we support only one 100 # AnnotateFileRequest in BatchAnnotateFilesRequest. 101 { # A request to annotate one single file, e.g. a PDF, TIFF or GIF file. 102 "imageContext": { # Image context and/or feature-specific parameters. # Additional context that may accompany the image(s) in the file. 103 "latLongRect": { # Rectangle determined by min and max `LatLng` pairs. # Not used. 104 "minLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair. 105 # of doubles representing degrees latitude and degrees longitude. Unless 106 # specified otherwise, this must conform to the 107 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 108 # standard</a>. Values must be within normalized ranges. 109 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 110 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 111 }, 112 "maxLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair. 113 # of doubles representing degrees latitude and degrees longitude. Unless 114 # specified otherwise, this must conform to the 115 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 116 # standard</a>. Values must be within normalized ranges. 117 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 118 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 119 }, 120 }, 121 "languageHints": [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value 122 # yields the best results since it enables automatic language detection. For 123 # languages based on the Latin alphabet, setting `language_hints` is not 124 # needed. In rare cases, when the language of the text in the image is known, 125 # setting a hint will help get better results (although it will be a 126 # significant hindrance if the hint is wrong). Text detection returns an 127 # error if one or more of the specified languages is not one of the 128 # [supported languages](/vision/docs/languages). 129 "A String", 130 ], 131 "productSearchParams": { # Parameters for a product search request. # Parameters for product search. 132 "filter": "A String", # The filtering expression. This can be used to restrict search results based 133 # on Product labels. We currently support an AND of OR of key-value 134 # expressions, where each expression within an OR must have the same key. An 135 # '=' should be used to connect the key and value. 136 # 137 # For example, "(color = red OR color = blue) AND brand = Google" is 138 # acceptable, but "(color = red OR brand = Google)" is not acceptable. 139 # "color: red" is not acceptable because it uses a ':' instead of an '='. 140 "productCategories": [ # The list of product categories to search in. Currently, we only consider 141 # the first category, and either "homegoods-v2", "apparel-v2", or "toys-v2" 142 # should be specified. The legacy categories "homegoods", "apparel", and 143 # "toys" are still supported but will be deprecated. For new products, please 144 # use "homegoods-v2", "apparel-v2", or "toys-v2" for better product search 145 # accuracy. It is recommended to migrate existing products to these 146 # categories as well. 147 "A String", 148 ], 149 "productSet": "A String", # The resource name of a ProductSet to be searched for similar images. 150 # 151 # Format is: 152 # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. 153 "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image. 154 # Optional. If it is not specified, system discretion will be applied. 155 "normalizedVertices": [ # The bounding polygon normalized vertices. 156 { # A vertex represents a 2D point in the image. 157 # NOTE: the normalized vertex coordinates are relative to the original image 158 # and range from 0 to 1. 159 "y": 3.14, # Y coordinate. 160 "x": 3.14, # X coordinate. 161 }, 162 ], 163 "vertices": [ # The bounding polygon vertices. 164 { # A vertex represents a 2D point in the image. 165 # NOTE: the vertex coordinates are in the same scale as the original image. 166 "y": 42, # Y coordinate. 167 "x": 42, # X coordinate. 168 }, 169 ], 170 }, 171 }, 172 "cropHintsParams": { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request. 173 "aspectRatios": [ # Aspect ratios in floats, representing the ratio of the width to the height 174 # of the image. For example, if the desired aspect ratio is 4/3, the 175 # corresponding float value should be 1.33333. If not specified, the 176 # best possible crop is returned. The number of provided aspect ratios is 177 # limited to a maximum of 16; any aspect ratios provided after the 16th are 178 # ignored. 179 3.14, 180 ], 181 }, 182 "webDetectionParams": { # Parameters for web detection request. # Parameters for web detection. 183 "includeGeoResults": True or False, # Whether to include results derived from the geo information in the image. 184 }, 185 }, 186 "features": [ # Required. Requested features. 187 { # The type of Google Cloud Vision API detection to perform, and the maximum 188 # number of results to return for that type. Multiple `Feature` objects can 189 # be specified in the `features` list. 190 "model": "A String", # Model to use for the feature. 191 # Supported values: "builtin/stable" (the default if unset) and 192 # "builtin/latest". 193 "type": "A String", # The feature type. 194 "maxResults": 42, # Maximum number of results of this type. Does not apply to 195 # `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 196 }, 197 ], 198 "pages": [ # Pages of the file to perform image annotation. 199 # 200 # Pages starts from 1, we assume the first page of the file is page 1. 201 # At most 5 pages are supported per request. Pages can be negative. 202 # 203 # Page 1 means the first page. 204 # Page 2 means the second page. 205 # Page -1 means the last page. 206 # Page -2 means the second to the last page. 207 # 208 # If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 209 # 210 # If this field is empty, by default the service performs image annotation 211 # for the first 5 pages of the file. 212 42, 213 ], 214 "inputConfig": { # The desired input location and metadata. # Required. Information about the input file. 215 "content": "A String", # File content, represented as a stream of bytes. 216 # Note: As with all `bytes` fields, protobuffers use a pure binary 217 # representation, whereas JSON representations use base64. 218 # 219 # Currently, this field only works for BatchAnnotateFiles requests. It does 220 # not work for AsyncBatchAnnotateFiles requests. 221 "mimeType": "A String", # The type of the file. Currently only "application/pdf", "image/tiff" and 222 # "image/gif" are supported. Wildcards are not supported. 223 "gcsSource": { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from. 224 "uri": "A String", # Google Cloud Storage URI for the input file. This must only be a 225 # Google Cloud Storage object. Wildcards are not currently supported. 226 }, 227 }, 228 }, 229 ], 230 } 231 232 x__xgafv: string, V1 error format. 233 Allowed values 234 1 - v1 error format 235 2 - v2 error format 236 237Returns: 238 An object of the form: 239 240 { # A list of file annotation responses. 241 "responses": [ # The list of file annotation responses, each response corresponding to each 242 # AnnotateFileRequest in BatchAnnotateFilesRequest. 243 { # Response to a single file annotation request. A file may contain one or more 244 # images, which individually have their own responses. 245 "totalPages": 42, # This field gives the total number of pages in the file. 246 "responses": [ # Individual responses to images found within the file. 247 { # Response to an image annotation request. 248 "safeSearchAnnotation": { # Set of features pertaining to the image, computed by computer vision # If present, safe-search annotation has completed successfully. 249 # methods over safe-search verticals (for example, adult, spoof, medical, 250 # violence). 251 "spoof": "A String", # Spoof likelihood. The likelihood that an modification 252 # was made to the image's canonical version to make it appear 253 # funny or offensive. 254 "violence": "A String", # Likelihood that this image contains violent content. 255 "medical": "A String", # Likelihood that this is a medical image. 256 "adult": "A String", # Represents the adult content likelihood for the image. Adult content may 257 # contain elements such as nudity, pornographic images or cartoons, or 258 # sexual activities. 259 "racy": "A String", # Likelihood that the request image contains racy content. Racy content may 260 # include (but is not limited to) skimpy or sheer clothing, strategically 261 # covered nudity, lewd or provocative poses, or close-ups of sensitive 262 # body areas. 263 }, 264 "textAnnotations": [ # If present, text (OCR) detection has completed successfully. 265 { # Set of detected entity features. 266 "confidence": 3.14, # **Deprecated. Use `score` instead.** 267 # The accuracy of the entity detection in an image. 268 # For example, for an image in which the "Eiffel Tower" entity is detected, 269 # this field represents the confidence that there is a tower in the query 270 # image. Range [0, 1]. 271 "description": "A String", # Entity textual description, expressed in its `locale` language. 272 "locale": "A String", # The language code for the locale in which the entity textual 273 # `description` is expressed. 274 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the 275 # image. For example, the relevancy of "tower" is likely higher to an image 276 # containing the detected "Eiffel Tower" than to an image containing a 277 # detected distant towering building, even though the confidence that 278 # there is a tower in each image may be the same. Range [0, 1]. 279 "locations": [ # The location information for the detected entity. Multiple 280 # `LocationInfo` elements can be present because one location may 281 # indicate the location of the scene in the image, and another location 282 # may indicate the location of the place where the image was taken. 283 # Location information is usually present for landmarks. 284 { # Detected entity location information. 285 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates. 286 # of doubles representing degrees latitude and degrees longitude. Unless 287 # specified otherwise, this must conform to the 288 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 289 # standard</a>. Values must be within normalized ranges. 290 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 291 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 292 }, 293 }, 294 ], 295 "mid": "A String", # Opaque entity ID. Some IDs may be available in 296 # [Google Knowledge Graph Search 297 # API](https://developers.google.com/knowledge-graph/). 298 "score": 3.14, # Overall score of the result. Range [0, 1]. 299 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced 300 # for `LABEL_DETECTION` features. 301 "normalizedVertices": [ # The bounding polygon normalized vertices. 302 { # A vertex represents a 2D point in the image. 303 # NOTE: the normalized vertex coordinates are relative to the original image 304 # and range from 0 to 1. 305 "y": 3.14, # Y coordinate. 306 "x": 3.14, # X coordinate. 307 }, 308 ], 309 "vertices": [ # The bounding polygon vertices. 310 { # A vertex represents a 2D point in the image. 311 # NOTE: the vertex coordinates are in the same scale as the original image. 312 "y": 42, # Y coordinate. 313 "x": 42, # X coordinate. 314 }, 315 ], 316 }, 317 "properties": [ # Some entities may have optional user-supplied `Property` (name/value) 318 # fields, such a score or string that qualifies the entity. 319 { # A `Property` consists of a user-supplied name/value pair. 320 "uint64Value": "A String", # Value of numeric properties. 321 "name": "A String", # Name of the property. 322 "value": "A String", # Value of the property. 323 }, 324 ], 325 }, 326 ], 327 "webDetection": { # Relevant information for the image from the Internet. # If present, web detection has completed successfully. 328 "fullMatchingImages": [ # Fully matching images from the Internet. 329 # Can include resized copies of the query image. 330 { # Metadata for online images. 331 "url": "A String", # The result image URL. 332 "score": 3.14, # (Deprecated) Overall relevancy score for the image. 333 }, 334 ], 335 "pagesWithMatchingImages": [ # Web pages containing the matching images from the Internet. 336 { # Metadata for web pages. 337 "pageTitle": "A String", # Title for the web page, may contain HTML markups. 338 "url": "A String", # The result web page URL. 339 "score": 3.14, # (Deprecated) Overall relevancy score for the web page. 340 "partialMatchingImages": [ # Partial matching images on the page. 341 # Those images are similar enough to share some key-point features. For 342 # example an original image will likely have partial matching for its 343 # crops. 344 { # Metadata for online images. 345 "url": "A String", # The result image URL. 346 "score": 3.14, # (Deprecated) Overall relevancy score for the image. 347 }, 348 ], 349 "fullMatchingImages": [ # Fully matching images on the page. 350 # Can include resized copies of the query image. 351 { # Metadata for online images. 352 "url": "A String", # The result image URL. 353 "score": 3.14, # (Deprecated) Overall relevancy score for the image. 354 }, 355 ], 356 }, 357 ], 358 "visuallySimilarImages": [ # The visually similar image results. 359 { # Metadata for online images. 360 "url": "A String", # The result image URL. 361 "score": 3.14, # (Deprecated) Overall relevancy score for the image. 362 }, 363 ], 364 "partialMatchingImages": [ # Partial matching images from the Internet. 365 # Those images are similar enough to share some key-point features. For 366 # example an original image will likely have partial matching for its crops. 367 { # Metadata for online images. 368 "url": "A String", # The result image URL. 369 "score": 3.14, # (Deprecated) Overall relevancy score for the image. 370 }, 371 ], 372 "webEntities": [ # Deduced entities from similar images on the Internet. 373 { # Entity deduced from similar images on the Internet. 374 "entityId": "A String", # Opaque entity ID. 375 "score": 3.14, # Overall relevancy score for the entity. 376 # Not normalized and not comparable across different image queries. 377 "description": "A String", # Canonical description of the entity, in English. 378 }, 379 ], 380 "bestGuessLabels": [ # The service's best guess as to the topic of the request image. 381 # Inferred from similar images on the open web. 382 { # Label to provide extra metadata for the web detection. 383 "languageCode": "A String", # The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". 384 # For more information, see 385 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 386 "label": "A String", # Label for extra metadata. 387 }, 388 ], 389 }, 390 "localizedObjectAnnotations": [ # If present, localized object detection has completed successfully. 391 # This will be sorted descending by confidence score. 392 { # Set of detected objects with bounding boxes. 393 "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more 394 # information, see 395 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 396 "score": 3.14, # Score of the result. Range [0, 1]. 397 "mid": "A String", # Object ID that should align with EntityAnnotation mid. 398 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this object belongs. This must be populated. 399 "normalizedVertices": [ # The bounding polygon normalized vertices. 400 { # A vertex represents a 2D point in the image. 401 # NOTE: the normalized vertex coordinates are relative to the original image 402 # and range from 0 to 1. 403 "y": 3.14, # Y coordinate. 404 "x": 3.14, # X coordinate. 405 }, 406 ], 407 "vertices": [ # The bounding polygon vertices. 408 { # A vertex represents a 2D point in the image. 409 # NOTE: the vertex coordinates are in the same scale as the original image. 410 "y": 42, # Y coordinate. 411 "x": 42, # X coordinate. 412 }, 413 ], 414 }, 415 "name": "A String", # Object name, expressed in its `language_code` language. 416 }, 417 ], 418 "fullTextAnnotation": { # TextAnnotation contains a structured representation of OCR extracted text. # If present, text (OCR) detection or document (OCR) text detection has 419 # completed successfully. 420 # This annotation provides the structural hierarchy for the OCR detected 421 # text. 422 # The hierarchy of an OCR extracted text structure is like this: 423 # TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol 424 # Each structural component, starting from Page, may further have their own 425 # properties. Properties describe detected languages, breaks etc.. Please refer 426 # to the TextAnnotation.TextProperty message definition below for more 427 # detail. 428 "text": "A String", # UTF-8 text detected on the pages. 429 "pages": [ # List of pages detected by OCR. 430 { # Detected page from OCR. 431 "width": 42, # Page width. For PDFs the unit is points. For images (including 432 # TIFFs) the unit is pixels. 433 "confidence": 3.14, # Confidence of the OCR results on the page. Range [0, 1]. 434 "property": { # Additional information detected on the structural component. # Additional information detected on the page. 435 "detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment. 436 "isPrefix": True or False, # True if break prepends the element. 437 "type": "A String", # Detected break type. 438 }, 439 "detectedLanguages": [ # A list of detected languages together with confidence. 440 { # Detected language for a structural component. 441 "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more 442 # information, see 443 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 444 "confidence": 3.14, # Confidence of detected language. Range [0, 1]. 445 }, 446 ], 447 }, 448 "blocks": [ # List of blocks of text, images etc on this page. 449 { # Logical element on the page. 450 "boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the block. 451 # The vertices are in the order of top-left, top-right, bottom-right, 452 # bottom-left. When a rotation of the bounding box is detected the rotation 453 # is represented as around the top-left corner as defined when the text is 454 # read in the 'natural' orientation. 455 # For example: 456 # 457 # * when the text is horizontal it might look like: 458 # 459 # 0----1 460 # | | 461 # 3----2 462 # 463 # * when it's rotated 180 degrees around the top-left corner it becomes: 464 # 465 # 2----3 466 # | | 467 # 1----0 468 # 469 # and the vertex order will still be (0, 1, 2, 3). 470 "normalizedVertices": [ # The bounding polygon normalized vertices. 471 { # A vertex represents a 2D point in the image. 472 # NOTE: the normalized vertex coordinates are relative to the original image 473 # and range from 0 to 1. 474 "y": 3.14, # Y coordinate. 475 "x": 3.14, # X coordinate. 476 }, 477 ], 478 "vertices": [ # The bounding polygon vertices. 479 { # A vertex represents a 2D point in the image. 480 # NOTE: the vertex coordinates are in the same scale as the original image. 481 "y": 42, # Y coordinate. 482 "x": 42, # X coordinate. 483 }, 484 ], 485 }, 486 "confidence": 3.14, # Confidence of the OCR results on the block. Range [0, 1]. 487 "property": { # Additional information detected on the structural component. # Additional information detected for the block. 488 "detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment. 489 "isPrefix": True or False, # True if break prepends the element. 490 "type": "A String", # Detected break type. 491 }, 492 "detectedLanguages": [ # A list of detected languages together with confidence. 493 { # Detected language for a structural component. 494 "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more 495 # information, see 496 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 497 "confidence": 3.14, # Confidence of detected language. Range [0, 1]. 498 }, 499 ], 500 }, 501 "blockType": "A String", # Detected block type (text, image etc) for this block. 502 "paragraphs": [ # List of paragraphs in this block (if this blocks is of type text). 503 { # Structural unit of text representing a number of words in certain order. 504 "boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the paragraph. 505 # The vertices are in the order of top-left, top-right, bottom-right, 506 # bottom-left. When a rotation of the bounding box is detected the rotation 507 # is represented as around the top-left corner as defined when the text is 508 # read in the 'natural' orientation. 509 # For example: 510 # * when the text is horizontal it might look like: 511 # 0----1 512 # | | 513 # 3----2 514 # * when it's rotated 180 degrees around the top-left corner it becomes: 515 # 2----3 516 # | | 517 # 1----0 518 # and the vertex order will still be (0, 1, 2, 3). 519 "normalizedVertices": [ # The bounding polygon normalized vertices. 520 { # A vertex represents a 2D point in the image. 521 # NOTE: the normalized vertex coordinates are relative to the original image 522 # and range from 0 to 1. 523 "y": 3.14, # Y coordinate. 524 "x": 3.14, # X coordinate. 525 }, 526 ], 527 "vertices": [ # The bounding polygon vertices. 528 { # A vertex represents a 2D point in the image. 529 # NOTE: the vertex coordinates are in the same scale as the original image. 530 "y": 42, # Y coordinate. 531 "x": 42, # X coordinate. 532 }, 533 ], 534 }, 535 "confidence": 3.14, # Confidence of the OCR results for the paragraph. Range [0, 1]. 536 "property": { # Additional information detected on the structural component. # Additional information detected for the paragraph. 537 "detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment. 538 "isPrefix": True or False, # True if break prepends the element. 539 "type": "A String", # Detected break type. 540 }, 541 "detectedLanguages": [ # A list of detected languages together with confidence. 542 { # Detected language for a structural component. 543 "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more 544 # information, see 545 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 546 "confidence": 3.14, # Confidence of detected language. Range [0, 1]. 547 }, 548 ], 549 }, 550 "words": [ # List of words in this paragraph. 551 { # A word representation. 552 "boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the word. 553 # The vertices are in the order of top-left, top-right, bottom-right, 554 # bottom-left. When a rotation of the bounding box is detected the rotation 555 # is represented as around the top-left corner as defined when the text is 556 # read in the 'natural' orientation. 557 # For example: 558 # * when the text is horizontal it might look like: 559 # 0----1 560 # | | 561 # 3----2 562 # * when it's rotated 180 degrees around the top-left corner it becomes: 563 # 2----3 564 # | | 565 # 1----0 566 # and the vertex order will still be (0, 1, 2, 3). 567 "normalizedVertices": [ # The bounding polygon normalized vertices. 568 { # A vertex represents a 2D point in the image. 569 # NOTE: the normalized vertex coordinates are relative to the original image 570 # and range from 0 to 1. 571 "y": 3.14, # Y coordinate. 572 "x": 3.14, # X coordinate. 573 }, 574 ], 575 "vertices": [ # The bounding polygon vertices. 576 { # A vertex represents a 2D point in the image. 577 # NOTE: the vertex coordinates are in the same scale as the original image. 578 "y": 42, # Y coordinate. 579 "x": 42, # X coordinate. 580 }, 581 ], 582 }, 583 "symbols": [ # List of symbols in the word. 584 # The order of the symbols follows the natural reading order. 585 { # A single symbol representation. 586 "boundingBox": { # A bounding polygon for the detected image annotation. # The bounding box for the symbol. 587 # The vertices are in the order of top-left, top-right, bottom-right, 588 # bottom-left. When a rotation of the bounding box is detected the rotation 589 # is represented as around the top-left corner as defined when the text is 590 # read in the 'natural' orientation. 591 # For example: 592 # * when the text is horizontal it might look like: 593 # 0----1 594 # | | 595 # 3----2 596 # * when it's rotated 180 degrees around the top-left corner it becomes: 597 # 2----3 598 # | | 599 # 1----0 600 # and the vertice order will still be (0, 1, 2, 3). 601 "normalizedVertices": [ # The bounding polygon normalized vertices. 602 { # A vertex represents a 2D point in the image. 603 # NOTE: the normalized vertex coordinates are relative to the original image 604 # and range from 0 to 1. 605 "y": 3.14, # Y coordinate. 606 "x": 3.14, # X coordinate. 607 }, 608 ], 609 "vertices": [ # The bounding polygon vertices. 610 { # A vertex represents a 2D point in the image. 611 # NOTE: the vertex coordinates are in the same scale as the original image. 612 "y": 42, # Y coordinate. 613 "x": 42, # X coordinate. 614 }, 615 ], 616 }, 617 "text": "A String", # The actual UTF-8 representation of the symbol. 618 "confidence": 3.14, # Confidence of the OCR results for the symbol. Range [0, 1]. 619 "property": { # Additional information detected on the structural component. # Additional information detected for the symbol. 620 "detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment. 621 "isPrefix": True or False, # True if break prepends the element. 622 "type": "A String", # Detected break type. 623 }, 624 "detectedLanguages": [ # A list of detected languages together with confidence. 625 { # Detected language for a structural component. 626 "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more 627 # information, see 628 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 629 "confidence": 3.14, # Confidence of detected language. Range [0, 1]. 630 }, 631 ], 632 }, 633 }, 634 ], 635 "confidence": 3.14, # Confidence of the OCR results for the word. Range [0, 1]. 636 "property": { # Additional information detected on the structural component. # Additional information detected for the word. 637 "detectedBreak": { # Detected start or end of a structural component. # Detected start or end of a text segment. 638 "isPrefix": True or False, # True if break prepends the element. 639 "type": "A String", # Detected break type. 640 }, 641 "detectedLanguages": [ # A list of detected languages together with confidence. 642 { # Detected language for a structural component. 643 "languageCode": "A String", # The BCP-47 language code, such as "en-US" or "sr-Latn". For more 644 # information, see 645 # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 646 "confidence": 3.14, # Confidence of detected language. Range [0, 1]. 647 }, 648 ], 649 }, 650 }, 651 ], 652 }, 653 ], 654 }, 655 ], 656 "height": 42, # Page height. For PDFs the unit is points. For images (including 657 # TIFFs) the unit is pixels. 658 }, 659 ], 660 }, 661 "labelAnnotations": [ # If present, label detection has completed successfully. 662 { # Set of detected entity features. 663 "confidence": 3.14, # **Deprecated. Use `score` instead.** 664 # The accuracy of the entity detection in an image. 665 # For example, for an image in which the "Eiffel Tower" entity is detected, 666 # this field represents the confidence that there is a tower in the query 667 # image. Range [0, 1]. 668 "description": "A String", # Entity textual description, expressed in its `locale` language. 669 "locale": "A String", # The language code for the locale in which the entity textual 670 # `description` is expressed. 671 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the 672 # image. For example, the relevancy of "tower" is likely higher to an image 673 # containing the detected "Eiffel Tower" than to an image containing a 674 # detected distant towering building, even though the confidence that 675 # there is a tower in each image may be the same. Range [0, 1]. 676 "locations": [ # The location information for the detected entity. Multiple 677 # `LocationInfo` elements can be present because one location may 678 # indicate the location of the scene in the image, and another location 679 # may indicate the location of the place where the image was taken. 680 # Location information is usually present for landmarks. 681 { # Detected entity location information. 682 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates. 683 # of doubles representing degrees latitude and degrees longitude. Unless 684 # specified otherwise, this must conform to the 685 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 686 # standard</a>. Values must be within normalized ranges. 687 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 688 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 689 }, 690 }, 691 ], 692 "mid": "A String", # Opaque entity ID. Some IDs may be available in 693 # [Google Knowledge Graph Search 694 # API](https://developers.google.com/knowledge-graph/). 695 "score": 3.14, # Overall score of the result. Range [0, 1]. 696 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced 697 # for `LABEL_DETECTION` features. 698 "normalizedVertices": [ # The bounding polygon normalized vertices. 699 { # A vertex represents a 2D point in the image. 700 # NOTE: the normalized vertex coordinates are relative to the original image 701 # and range from 0 to 1. 702 "y": 3.14, # Y coordinate. 703 "x": 3.14, # X coordinate. 704 }, 705 ], 706 "vertices": [ # The bounding polygon vertices. 707 { # A vertex represents a 2D point in the image. 708 # NOTE: the vertex coordinates are in the same scale as the original image. 709 "y": 42, # Y coordinate. 710 "x": 42, # X coordinate. 711 }, 712 ], 713 }, 714 "properties": [ # Some entities may have optional user-supplied `Property` (name/value) 715 # fields, such a score or string that qualifies the entity. 716 { # A `Property` consists of a user-supplied name/value pair. 717 "uint64Value": "A String", # Value of numeric properties. 718 "name": "A String", # Name of the property. 719 "value": "A String", # Value of the property. 720 }, 721 ], 722 }, 723 ], 724 "imagePropertiesAnnotation": { # Stores image properties, such as dominant colors. # If present, image properties were extracted successfully. 725 "dominantColors": { # Set of dominant colors and their corresponding scores. # If present, dominant colors completed successfully. 726 "colors": [ # RGB color values with their score and pixel fraction. 727 { # Color information consists of RGB channels, score, and the fraction of 728 # the image that the color occupies in the image. 729 "color": { # Represents a color in the RGBA color space. This representation is designed # RGB components of the color. 730 # for simplicity of conversion to/from color representations in various 731 # languages over compactness; for example, the fields of this representation 732 # can be trivially provided to the constructor of "java.awt.Color" in Java; it 733 # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" 734 # method in iOS; and, with just a little work, it can be easily formatted into 735 # a CSS "rgba()" string in JavaScript, as well. 736 # 737 # Note: this proto does not carry information about the absolute color space 738 # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, 739 # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color 740 # space. 741 # 742 # Example (Java): 743 # 744 # import com.google.type.Color; 745 # 746 # // ... 747 # public static java.awt.Color fromProto(Color protocolor) { 748 # float alpha = protocolor.hasAlpha() 749 # ? protocolor.getAlpha().getValue() 750 # : 1.0; 751 # 752 # return new java.awt.Color( 753 # protocolor.getRed(), 754 # protocolor.getGreen(), 755 # protocolor.getBlue(), 756 # alpha); 757 # } 758 # 759 # public static Color toProto(java.awt.Color color) { 760 # float red = (float) color.getRed(); 761 # float green = (float) color.getGreen(); 762 # float blue = (float) color.getBlue(); 763 # float denominator = 255.0; 764 # Color.Builder resultBuilder = 765 # Color 766 # .newBuilder() 767 # .setRed(red / denominator) 768 # .setGreen(green / denominator) 769 # .setBlue(blue / denominator); 770 # int alpha = color.getAlpha(); 771 # if (alpha != 255) { 772 # result.setAlpha( 773 # FloatValue 774 # .newBuilder() 775 # .setValue(((float) alpha) / denominator) 776 # .build()); 777 # } 778 # return resultBuilder.build(); 779 # } 780 # // ... 781 # 782 # Example (iOS / Obj-C): 783 # 784 # // ... 785 # static UIColor* fromProto(Color* protocolor) { 786 # float red = [protocolor red]; 787 # float green = [protocolor green]; 788 # float blue = [protocolor blue]; 789 # FloatValue* alpha_wrapper = [protocolor alpha]; 790 # float alpha = 1.0; 791 # if (alpha_wrapper != nil) { 792 # alpha = [alpha_wrapper value]; 793 # } 794 # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; 795 # } 796 # 797 # static Color* toProto(UIColor* color) { 798 # CGFloat red, green, blue, alpha; 799 # if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { 800 # return nil; 801 # } 802 # Color* result = [[Color alloc] init]; 803 # [result setRed:red]; 804 # [result setGreen:green]; 805 # [result setBlue:blue]; 806 # if (alpha <= 0.9999) { 807 # [result setAlpha:floatWrapperWithValue(alpha)]; 808 # } 809 # [result autorelease]; 810 # return result; 811 # } 812 # // ... 813 # 814 # Example (JavaScript): 815 # 816 # // ... 817 # 818 # var protoToCssColor = function(rgb_color) { 819 # var redFrac = rgb_color.red || 0.0; 820 # var greenFrac = rgb_color.green || 0.0; 821 # var blueFrac = rgb_color.blue || 0.0; 822 # var red = Math.floor(redFrac * 255); 823 # var green = Math.floor(greenFrac * 255); 824 # var blue = Math.floor(blueFrac * 255); 825 # 826 # if (!('alpha' in rgb_color)) { 827 # return rgbToCssColor_(red, green, blue); 828 # } 829 # 830 # var alphaFrac = rgb_color.alpha.value || 0.0; 831 # var rgbParams = [red, green, blue].join(','); 832 # return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); 833 # }; 834 # 835 # var rgbToCssColor_ = function(red, green, blue) { 836 # var rgbNumber = new Number((red << 16) | (green << 8) | blue); 837 # var hexString = rgbNumber.toString(16); 838 # var missingZeros = 6 - hexString.length; 839 # var resultBuilder = ['#']; 840 # for (var i = 0; i < missingZeros; i++) { 841 # resultBuilder.push('0'); 842 # } 843 # resultBuilder.push(hexString); 844 # return resultBuilder.join(''); 845 # }; 846 # 847 # // ... 848 "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. 849 "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, 850 # the final pixel color is defined by the equation: 851 # 852 # pixel color = alpha * (this color) + (1.0 - alpha) * (background color) 853 # 854 # This means that a value of 1.0 corresponds to a solid color, whereas 855 # a value of 0.0 corresponds to a completely transparent color. This 856 # uses a wrapper message rather than a simple float scalar so that it is 857 # possible to distinguish between a default value and the value being unset. 858 # If omitted, this color object is to be rendered as a solid color 859 # (as if the alpha value had been explicitly given with a value of 1.0). 860 "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. 861 "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. 862 }, 863 "pixelFraction": 3.14, # The fraction of pixels the color occupies in the image. 864 # Value in range [0, 1]. 865 "score": 3.14, # Image-specific score for this color. Value in range [0, 1]. 866 }, 867 ], 868 }, 869 }, 870 "faceAnnotations": [ # If present, face detection has completed successfully. 871 { # A face annotation object contains the results of face detection. 872 "panAngle": 3.14, # Yaw angle, which indicates the leftward/rightward angle that the face is 873 # pointing relative to the vertical plane perpendicular to the image. Range 874 # [-180,180]. 875 "underExposedLikelihood": "A String", # Under-exposed likelihood. 876 "detectionConfidence": 3.14, # Detection confidence. Range [0, 1]. 877 "joyLikelihood": "A String", # Joy likelihood. 878 "landmarks": [ # Detected face landmarks. 879 { # A face-specific landmark (for example, a face feature). 880 "position": { # A 3D position in the image, used primarily for Face detection landmarks. # Face landmark position. 881 # A valid Position must have both x and y coordinates. 882 # The position coordinates are in the same scale as the original image. 883 "y": 3.14, # Y coordinate. 884 "x": 3.14, # X coordinate. 885 "z": 3.14, # Z coordinate (or depth). 886 }, 887 "type": "A String", # Face landmark type. 888 }, 889 ], 890 "sorrowLikelihood": "A String", # Sorrow likelihood. 891 "blurredLikelihood": "A String", # Blurred likelihood. 892 "tiltAngle": 3.14, # Pitch angle, which indicates the upwards/downwards angle that the face is 893 # pointing relative to the image's horizontal plane. Range [-180,180]. 894 "angerLikelihood": "A String", # Anger likelihood. 895 "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the face. The coordinates of the bounding box 896 # are in the original image's scale. 897 # The bounding box is computed to "frame" the face in accordance with human 898 # expectations. It is based on the landmarker results. 899 # Note that one or more x and/or y coordinates may not be generated in the 900 # `BoundingPoly` (the polygon will be unbounded) if only a partial face 901 # appears in the image to be annotated. 902 "normalizedVertices": [ # The bounding polygon normalized vertices. 903 { # A vertex represents a 2D point in the image. 904 # NOTE: the normalized vertex coordinates are relative to the original image 905 # and range from 0 to 1. 906 "y": 3.14, # Y coordinate. 907 "x": 3.14, # X coordinate. 908 }, 909 ], 910 "vertices": [ # The bounding polygon vertices. 911 { # A vertex represents a 2D point in the image. 912 # NOTE: the vertex coordinates are in the same scale as the original image. 913 "y": 42, # Y coordinate. 914 "x": 42, # X coordinate. 915 }, 916 ], 917 }, 918 "rollAngle": 3.14, # Roll angle, which indicates the amount of clockwise/anti-clockwise rotation 919 # of the face relative to the image vertical about the axis perpendicular to 920 # the face. Range [-180,180]. 921 "headwearLikelihood": "A String", # Headwear likelihood. 922 "surpriseLikelihood": "A String", # Surprise likelihood. 923 "fdBoundingPoly": { # A bounding polygon for the detected image annotation. # The `fd_bounding_poly` bounding polygon is tighter than the 924 # `boundingPoly`, and encloses only the skin part of the face. Typically, it 925 # is used to eliminate the face from any image analysis that detects the 926 # "amount of skin" visible in an image. It is not based on the 927 # landmarker results, only on the initial face detection, hence 928 # the <code>fd</code> (face detection) prefix. 929 "normalizedVertices": [ # The bounding polygon normalized vertices. 930 { # A vertex represents a 2D point in the image. 931 # NOTE: the normalized vertex coordinates are relative to the original image 932 # and range from 0 to 1. 933 "y": 3.14, # Y coordinate. 934 "x": 3.14, # X coordinate. 935 }, 936 ], 937 "vertices": [ # The bounding polygon vertices. 938 { # A vertex represents a 2D point in the image. 939 # NOTE: the vertex coordinates are in the same scale as the original image. 940 "y": 42, # Y coordinate. 941 "x": 42, # X coordinate. 942 }, 943 ], 944 }, 945 "landmarkingConfidence": 3.14, # Face landmarking confidence. Range [0, 1]. 946 }, 947 ], 948 "productSearchResults": { # Results for a product search request. # If present, product search has completed successfully. 949 "productGroupedResults": [ # List of results grouped by products detected in the query image. Each entry 950 # corresponds to one bounding polygon in the query image, and contains the 951 # matching products specific to that region. There may be duplicate product 952 # matches in the union of all the per-product results. 953 { # Information about the products similar to a single product in a query 954 # image. 955 "results": [ # List of results, one for each product match. 956 { # Information about a product. 957 "image": "A String", # The resource name of the image from the product that is the closest match 958 # to the query. 959 "score": 3.14, # A confidence level on the match, ranging from 0 (no confidence) to 960 # 1 (full confidence). 961 "product": { # A Product contains ReferenceImages. # The Product. 962 "productLabels": [ # Key-value pairs that can be attached to a product. At query time, 963 # constraints can be specified based on the product_labels. 964 # 965 # Note that integer values can be provided as strings, e.g. "1199". Only 966 # strings with integer values can match a range-based restriction which is 967 # to be supported soon. 968 # 969 # Multiple values can be assigned to the same key. One product may have up to 970 # 100 product_labels. 971 { # A product label represented as a key-value pair. 972 "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot 973 # exceed 128 bytes. 974 "value": "A String", # The value of the label attached to the product. Cannot be empty and 975 # cannot exceed 128 bytes. 976 }, 977 ], 978 "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most 979 # 4096 characters long. 980 "name": "A String", # The resource name of the product. 981 # 982 # Format is: 983 # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. 984 # 985 # This field is ignored when creating a product. 986 "productCategory": "A String", # The category for the product identified by the reference image. This should 987 # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories 988 # "homegoods", "apparel", and "toys" are still supported, but these should 989 # not be used for new products. 990 # 991 # This field is immutable. 992 "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096 993 # characters long. 994 }, 995 }, 996 ], 997 "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the product detected in the query image. 998 "normalizedVertices": [ # The bounding polygon normalized vertices. 999 { # A vertex represents a 2D point in the image. 1000 # NOTE: the normalized vertex coordinates are relative to the original image 1001 # and range from 0 to 1. 1002 "y": 3.14, # Y coordinate. 1003 "x": 3.14, # X coordinate. 1004 }, 1005 ], 1006 "vertices": [ # The bounding polygon vertices. 1007 { # A vertex represents a 2D point in the image. 1008 # NOTE: the vertex coordinates are in the same scale as the original image. 1009 "y": 42, # Y coordinate. 1010 "x": 42, # X coordinate. 1011 }, 1012 ], 1013 }, 1014 }, 1015 ], 1016 "results": [ # List of results, one for each product match. 1017 { # Information about a product. 1018 "image": "A String", # The resource name of the image from the product that is the closest match 1019 # to the query. 1020 "score": 3.14, # A confidence level on the match, ranging from 0 (no confidence) to 1021 # 1 (full confidence). 1022 "product": { # A Product contains ReferenceImages. # The Product. 1023 "productLabels": [ # Key-value pairs that can be attached to a product. At query time, 1024 # constraints can be specified based on the product_labels. 1025 # 1026 # Note that integer values can be provided as strings, e.g. "1199". Only 1027 # strings with integer values can match a range-based restriction which is 1028 # to be supported soon. 1029 # 1030 # Multiple values can be assigned to the same key. One product may have up to 1031 # 100 product_labels. 1032 { # A product label represented as a key-value pair. 1033 "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot 1034 # exceed 128 bytes. 1035 "value": "A String", # The value of the label attached to the product. Cannot be empty and 1036 # cannot exceed 128 bytes. 1037 }, 1038 ], 1039 "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most 1040 # 4096 characters long. 1041 "name": "A String", # The resource name of the product. 1042 # 1043 # Format is: 1044 # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. 1045 # 1046 # This field is ignored when creating a product. 1047 "productCategory": "A String", # The category for the product identified by the reference image. This should 1048 # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories 1049 # "homegoods", "apparel", and "toys" are still supported, but these should 1050 # not be used for new products. 1051 # 1052 # This field is immutable. 1053 "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096 1054 # characters long. 1055 }, 1056 }, 1057 ], 1058 "indexTime": "A String", # Timestamp of the index which provided these results. Products added to the 1059 # product set and products removed from the product set after this time are 1060 # not reflected in the current results. 1061 }, 1062 "logoAnnotations": [ # If present, logo detection has completed successfully. 1063 { # Set of detected entity features. 1064 "confidence": 3.14, # **Deprecated. Use `score` instead.** 1065 # The accuracy of the entity detection in an image. 1066 # For example, for an image in which the "Eiffel Tower" entity is detected, 1067 # this field represents the confidence that there is a tower in the query 1068 # image. Range [0, 1]. 1069 "description": "A String", # Entity textual description, expressed in its `locale` language. 1070 "locale": "A String", # The language code for the locale in which the entity textual 1071 # `description` is expressed. 1072 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the 1073 # image. For example, the relevancy of "tower" is likely higher to an image 1074 # containing the detected "Eiffel Tower" than to an image containing a 1075 # detected distant towering building, even though the confidence that 1076 # there is a tower in each image may be the same. Range [0, 1]. 1077 "locations": [ # The location information for the detected entity. Multiple 1078 # `LocationInfo` elements can be present because one location may 1079 # indicate the location of the scene in the image, and another location 1080 # may indicate the location of the place where the image was taken. 1081 # Location information is usually present for landmarks. 1082 { # Detected entity location information. 1083 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates. 1084 # of doubles representing degrees latitude and degrees longitude. Unless 1085 # specified otherwise, this must conform to the 1086 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 1087 # standard</a>. Values must be within normalized ranges. 1088 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 1089 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 1090 }, 1091 }, 1092 ], 1093 "mid": "A String", # Opaque entity ID. Some IDs may be available in 1094 # [Google Knowledge Graph Search 1095 # API](https://developers.google.com/knowledge-graph/). 1096 "score": 3.14, # Overall score of the result. Range [0, 1]. 1097 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced 1098 # for `LABEL_DETECTION` features. 1099 "normalizedVertices": [ # The bounding polygon normalized vertices. 1100 { # A vertex represents a 2D point in the image. 1101 # NOTE: the normalized vertex coordinates are relative to the original image 1102 # and range from 0 to 1. 1103 "y": 3.14, # Y coordinate. 1104 "x": 3.14, # X coordinate. 1105 }, 1106 ], 1107 "vertices": [ # The bounding polygon vertices. 1108 { # A vertex represents a 2D point in the image. 1109 # NOTE: the vertex coordinates are in the same scale as the original image. 1110 "y": 42, # Y coordinate. 1111 "x": 42, # X coordinate. 1112 }, 1113 ], 1114 }, 1115 "properties": [ # Some entities may have optional user-supplied `Property` (name/value) 1116 # fields, such a score or string that qualifies the entity. 1117 { # A `Property` consists of a user-supplied name/value pair. 1118 "uint64Value": "A String", # Value of numeric properties. 1119 "name": "A String", # Name of the property. 1120 "value": "A String", # Value of the property. 1121 }, 1122 ], 1123 }, 1124 ], 1125 "landmarkAnnotations": [ # If present, landmark detection has completed successfully. 1126 { # Set of detected entity features. 1127 "confidence": 3.14, # **Deprecated. Use `score` instead.** 1128 # The accuracy of the entity detection in an image. 1129 # For example, for an image in which the "Eiffel Tower" entity is detected, 1130 # this field represents the confidence that there is a tower in the query 1131 # image. Range [0, 1]. 1132 "description": "A String", # Entity textual description, expressed in its `locale` language. 1133 "locale": "A String", # The language code for the locale in which the entity textual 1134 # `description` is expressed. 1135 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the 1136 # image. For example, the relevancy of "tower" is likely higher to an image 1137 # containing the detected "Eiffel Tower" than to an image containing a 1138 # detected distant towering building, even though the confidence that 1139 # there is a tower in each image may be the same. Range [0, 1]. 1140 "locations": [ # The location information for the detected entity. Multiple 1141 # `LocationInfo` elements can be present because one location may 1142 # indicate the location of the scene in the image, and another location 1143 # may indicate the location of the place where the image was taken. 1144 # Location information is usually present for landmarks. 1145 { # Detected entity location information. 1146 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # lat/long location coordinates. 1147 # of doubles representing degrees latitude and degrees longitude. Unless 1148 # specified otherwise, this must conform to the 1149 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 1150 # standard</a>. Values must be within normalized ranges. 1151 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 1152 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 1153 }, 1154 }, 1155 ], 1156 "mid": "A String", # Opaque entity ID. Some IDs may be available in 1157 # [Google Knowledge Graph Search 1158 # API](https://developers.google.com/knowledge-graph/). 1159 "score": 3.14, # Overall score of the result. Range [0, 1]. 1160 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not produced 1161 # for `LABEL_DETECTION` features. 1162 "normalizedVertices": [ # The bounding polygon normalized vertices. 1163 { # A vertex represents a 2D point in the image. 1164 # NOTE: the normalized vertex coordinates are relative to the original image 1165 # and range from 0 to 1. 1166 "y": 3.14, # Y coordinate. 1167 "x": 3.14, # X coordinate. 1168 }, 1169 ], 1170 "vertices": [ # 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 "y": 42, # Y coordinate. 1174 "x": 42, # X coordinate. 1175 }, 1176 ], 1177 }, 1178 "properties": [ # Some entities may have optional user-supplied `Property` (name/value) 1179 # fields, such a score or string that qualifies the entity. 1180 { # A `Property` consists of a user-supplied name/value pair. 1181 "uint64Value": "A String", # Value of numeric properties. 1182 "name": "A String", # Name of the property. 1183 "value": "A String", # Value of the property. 1184 }, 1185 ], 1186 }, 1187 ], 1188 "context": { # 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 1189 # comes from. 1190 # information about the source of that image. 1191 "pageNumber": 42, # If the file was a PDF or TIFF, this field gives the page number within 1192 # the file used to produce the image. 1193 "uri": "A String", # The URI of the file used to produce the image. 1194 }, 1195 "error": { # The `Status` type defines a logical error model that is suitable for # If set, represents the error message for the operation. 1196 # Note that filled-in image annotations are guaranteed to be 1197 # correct, even when `error` is set. 1198 # different programming environments, including REST APIs and RPC APIs. It is 1199 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 1200 # three pieces of data: error code, error message, and error details. 1201 # 1202 # You can find out more about this error model and how to work with it in the 1203 # [API Design Guide](https://cloud.google.com/apis/design/errors). 1204 "message": "A String", # A developer-facing error message, which should be in English. Any 1205 # user-facing error message should be localized and sent in the 1206 # google.rpc.Status.details field, or localized by the client. 1207 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 1208 "details": [ # A list of messages that carry the error details. There is a common set of 1209 # message types for APIs to use. 1210 { 1211 "a_key": "", # Properties of the object. Contains field @type with type URL. 1212 }, 1213 ], 1214 }, 1215 "cropHintsAnnotation": { # Set of crop hints that are used to generate new crops when serving images. # If present, crop hints have completed successfully. 1216 "cropHints": [ # Crop hint results. 1217 { # Single crop hint that is used to generate a new crop when serving an image. 1218 "confidence": 3.14, # Confidence of this being a salient region. Range [0, 1]. 1219 "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon for the crop region. The coordinates of the bounding 1220 # box are in the original image's scale. 1221 "normalizedVertices": [ # The bounding polygon normalized vertices. 1222 { # A vertex represents a 2D point in the image. 1223 # NOTE: the normalized vertex coordinates are relative to the original image 1224 # and range from 0 to 1. 1225 "y": 3.14, # Y coordinate. 1226 "x": 3.14, # X coordinate. 1227 }, 1228 ], 1229 "vertices": [ # The bounding polygon vertices. 1230 { # A vertex represents a 2D point in the image. 1231 # NOTE: the vertex coordinates are in the same scale as the original image. 1232 "y": 42, # Y coordinate. 1233 "x": 42, # X coordinate. 1234 }, 1235 ], 1236 }, 1237 "importanceFraction": 3.14, # Fraction of importance of this salient region with respect to the original 1238 # image. 1239 }, 1240 ], 1241 }, 1242 }, 1243 ], 1244 "inputConfig": { # The desired input location and metadata. # Information about the file for which this response is generated. 1245 "content": "A String", # File content, represented as a stream of bytes. 1246 # Note: As with all `bytes` fields, protobuffers use a pure binary 1247 # representation, whereas JSON representations use base64. 1248 # 1249 # Currently, this field only works for BatchAnnotateFiles requests. It does 1250 # not work for AsyncBatchAnnotateFiles requests. 1251 "mimeType": "A String", # The type of the file. Currently only "application/pdf", "image/tiff" and 1252 # "image/gif" are supported. Wildcards are not supported. 1253 "gcsSource": { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from. 1254 "uri": "A String", # Google Cloud Storage URI for the input file. This must only be a 1255 # Google Cloud Storage object. Wildcards are not currently supported. 1256 }, 1257 }, 1258 }, 1259 ], 1260 }</pre> 1261</div> 1262 1263<div class="method"> 1264 <code class="details" id="asyncBatchAnnotate">asyncBatchAnnotate(body, x__xgafv=None)</code> 1265 <pre>Run asynchronous image detection and annotation for a list of generic 1266files, such as PDF files, which may contain multiple pages and multiple 1267images per page. Progress and results can be retrieved through the 1268`google.longrunning.Operations` interface. 1269`Operation.metadata` contains `OperationMetadata` (metadata). 1270`Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). 1271 1272Args: 1273 body: object, The request body. (required) 1274 The object takes the form of: 1275 1276{ # Multiple async file annotation requests are batched into a single service 1277 # call. 1278 "requests": [ # Individual async file annotation requests for this batch. 1279 { # An offline file annotation request. 1280 "imageContext": { # Image context and/or feature-specific parameters. # Additional context that may accompany the image(s) in the file. 1281 "latLongRect": { # Rectangle determined by min and max `LatLng` pairs. # Not used. 1282 "minLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair. 1283 # of doubles representing degrees latitude and degrees longitude. Unless 1284 # specified otherwise, this must conform to the 1285 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 1286 # standard</a>. Values must be within normalized ranges. 1287 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 1288 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 1289 }, 1290 "maxLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair. 1291 # of doubles representing degrees latitude and degrees longitude. Unless 1292 # specified otherwise, this must conform to the 1293 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 1294 # standard</a>. Values must be within normalized ranges. 1295 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0]. 1296 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0]. 1297 }, 1298 }, 1299 "languageHints": [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value 1300 # yields the best results since it enables automatic language detection. For 1301 # languages based on the Latin alphabet, setting `language_hints` is not 1302 # needed. In rare cases, when the language of the text in the image is known, 1303 # setting a hint will help get better results (although it will be a 1304 # significant hindrance if the hint is wrong). Text detection returns an 1305 # error if one or more of the specified languages is not one of the 1306 # [supported languages](/vision/docs/languages). 1307 "A String", 1308 ], 1309 "productSearchParams": { # Parameters for a product search request. # Parameters for product search. 1310 "filter": "A String", # The filtering expression. This can be used to restrict search results based 1311 # on Product labels. We currently support an AND of OR of key-value 1312 # expressions, where each expression within an OR must have the same key. An 1313 # '=' should be used to connect the key and value. 1314 # 1315 # For example, "(color = red OR color = blue) AND brand = Google" is 1316 # acceptable, but "(color = red OR brand = Google)" is not acceptable. 1317 # "color: red" is not acceptable because it uses a ':' instead of an '='. 1318 "productCategories": [ # The list of product categories to search in. Currently, we only consider 1319 # the first category, and either "homegoods-v2", "apparel-v2", or "toys-v2" 1320 # should be specified. The legacy categories "homegoods", "apparel", and 1321 # "toys" are still supported but will be deprecated. For new products, please 1322 # use "homegoods-v2", "apparel-v2", or "toys-v2" for better product search 1323 # accuracy. It is recommended to migrate existing products to these 1324 # categories as well. 1325 "A String", 1326 ], 1327 "productSet": "A String", # The resource name of a ProductSet to be searched for similar images. 1328 # 1329 # Format is: 1330 # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. 1331 "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the area of interest in the image. 1332 # Optional. If it is not specified, system discretion will be applied. 1333 "normalizedVertices": [ # The bounding polygon normalized vertices. 1334 { # A vertex represents a 2D point in the image. 1335 # NOTE: the normalized vertex coordinates are relative to the original image 1336 # and range from 0 to 1. 1337 "y": 3.14, # Y coordinate. 1338 "x": 3.14, # X coordinate. 1339 }, 1340 ], 1341 "vertices": [ # The bounding polygon vertices. 1342 { # A vertex represents a 2D point in the image. 1343 # NOTE: the vertex coordinates are in the same scale as the original image. 1344 "y": 42, # Y coordinate. 1345 "x": 42, # X coordinate. 1346 }, 1347 ], 1348 }, 1349 }, 1350 "cropHintsParams": { # Parameters for crop hints annotation request. # Parameters for crop hints annotation request. 1351 "aspectRatios": [ # Aspect ratios in floats, representing the ratio of the width to the height 1352 # of the image. For example, if the desired aspect ratio is 4/3, the 1353 # corresponding float value should be 1.33333. If not specified, the 1354 # best possible crop is returned. The number of provided aspect ratios is 1355 # limited to a maximum of 16; any aspect ratios provided after the 16th are 1356 # ignored. 1357 3.14, 1358 ], 1359 }, 1360 "webDetectionParams": { # Parameters for web detection request. # Parameters for web detection. 1361 "includeGeoResults": True or False, # Whether to include results derived from the geo information in the image. 1362 }, 1363 }, 1364 "outputConfig": { # The desired output location and metadata. # Required. The desired output location and metadata (e.g. format). 1365 "batchSize": 42, # The max number of response protos to put into each output JSON file on 1366 # Google Cloud Storage. 1367 # The valid range is [1, 100]. If not specified, the default value is 20. 1368 # 1369 # For example, for one pdf file with 100 pages, 100 response protos will 1370 # be generated. If `batch_size` = 20, then 5 json files each 1371 # containing 20 response protos will be written under the prefix 1372 # `gcs_destination`.`uri`. 1373 # 1374 # Currently, batch_size only applies to GcsDestination, with potential future 1375 # support for other output configurations. 1376 "gcsDestination": { # The Google Cloud Storage location where the output will be written to. # The Google Cloud Storage location to write the output(s) to. 1377 "uri": "A String", # Google Cloud Storage URI prefix where the results will be stored. Results 1378 # will be in JSON format and preceded by its corresponding input URI prefix. 1379 # This field can either represent a gcs file prefix or gcs directory. In 1380 # either case, the uri should be unique because in order to get all of the 1381 # output files, you will need to do a wildcard gcs search on the uri prefix 1382 # you provide. 1383 # 1384 # Examples: 1385 # 1386 # * File Prefix: gs://bucket-name/here/filenameprefix The output files 1387 # will be created in gs://bucket-name/here/ and the names of the 1388 # output files will begin with "filenameprefix". 1389 # 1390 # * Directory Prefix: gs://bucket-name/some/location/ The output files 1391 # will be created in gs://bucket-name/some/location/ and the names of the 1392 # output files could be anything because there was no filename prefix 1393 # specified. 1394 # 1395 # If multiple outputs, each response is still AnnotateFileResponse, each of 1396 # which contains some subset of the full list of AnnotateImageResponse. 1397 # Multiple outputs can happen if, for example, the output JSON is too large 1398 # and overflows into multiple sharded files. 1399 }, 1400 }, 1401 "inputConfig": { # The desired input location and metadata. # Required. Information about the input file. 1402 "content": "A String", # File content, represented as a stream of bytes. 1403 # Note: As with all `bytes` fields, protobuffers use a pure binary 1404 # representation, whereas JSON representations use base64. 1405 # 1406 # Currently, this field only works for BatchAnnotateFiles requests. It does 1407 # not work for AsyncBatchAnnotateFiles requests. 1408 "mimeType": "A String", # The type of the file. Currently only "application/pdf", "image/tiff" and 1409 # "image/gif" are supported. Wildcards are not supported. 1410 "gcsSource": { # The Google Cloud Storage location where the input will be read from. # The Google Cloud Storage location to read the input from. 1411 "uri": "A String", # Google Cloud Storage URI for the input file. This must only be a 1412 # Google Cloud Storage object. Wildcards are not currently supported. 1413 }, 1414 }, 1415 "features": [ # Required. Requested features. 1416 { # The type of Google Cloud Vision API detection to perform, and the maximum 1417 # number of results to return for that type. Multiple `Feature` objects can 1418 # be specified in the `features` list. 1419 "model": "A String", # Model to use for the feature. 1420 # Supported values: "builtin/stable" (the default if unset) and 1421 # "builtin/latest". 1422 "type": "A String", # The feature type. 1423 "maxResults": 42, # Maximum number of results of this type. Does not apply to 1424 # `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 1425 }, 1426 ], 1427 }, 1428 ], 1429 } 1430 1431 x__xgafv: string, V1 error format. 1432 Allowed values 1433 1 - v1 error format 1434 2 - v2 error format 1435 1436Returns: 1437 An object of the form: 1438 1439 { # This resource represents a long-running operation that is the result of a 1440 # network API call. 1441 "response": { # The normal response of the operation in case of success. If the original 1442 # method returns no data on success, such as `Delete`, the response is 1443 # `google.protobuf.Empty`. If the original method is standard 1444 # `Get`/`Create`/`Update`, the response should be the resource. For other 1445 # methods, the response should have the type `XxxResponse`, where `Xxx` 1446 # is the original method name. For example, if the original method name 1447 # is `TakeSnapshot()`, the inferred response type is 1448 # `TakeSnapshotResponse`. 1449 "a_key": "", # Properties of the object. Contains field @type with type URL. 1450 }, 1451 "metadata": { # Service-specific metadata associated with the operation. It typically 1452 # contains progress information and common metadata such as create time. 1453 # Some services might not provide such metadata. Any method that returns a 1454 # long-running operation should document the metadata type, if any. 1455 "a_key": "", # Properties of the object. Contains field @type with type URL. 1456 }, 1457 "done": True or False, # If the value is `false`, it means the operation is still in progress. 1458 # If `true`, the operation is completed, and either `error` or `response` is 1459 # available. 1460 "name": "A String", # The server-assigned name, which is only unique within the same service that 1461 # originally returns it. If you use the default HTTP mapping, the 1462 # `name` should be a resource name ending with `operations/{unique_id}`. 1463 "error": { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation. 1464 # different programming environments, including REST APIs and RPC APIs. It is 1465 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 1466 # three pieces of data: error code, error message, and error details. 1467 # 1468 # You can find out more about this error model and how to work with it in the 1469 # [API Design Guide](https://cloud.google.com/apis/design/errors). 1470 "message": "A String", # A developer-facing error message, which should be in English. Any 1471 # user-facing error message should be localized and sent in the 1472 # google.rpc.Status.details field, or localized by the client. 1473 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 1474 "details": [ # A list of messages that carry the error details. There is a common set of 1475 # message types for APIs to use. 1476 { 1477 "a_key": "", # Properties of the object. Contains field @type with type URL. 1478 }, 1479 ], 1480 }, 1481 }</pre> 1482</div> 1483 1484</body></html>