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