blob: 6a4fdeda1cf1a9f0f82499b18b97e8689b37e393 [file] [log] [blame]
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="vision_v1.html">Google Cloud Vision API</a> . <a href="vision_v1.images.html">images</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#annotate">annotate(body, x__xgafv=None)</a></code></p>
79<p class="firstline">Run image detection and annotation for a batch of images.</p>
80<h3>Method Details</h3>
81<div class="method">
82 <code class="details" id="annotate">annotate(body, x__xgafv=None)</code>
83 <pre>Run image detection and annotation for a batch of images.
84
85Args:
86 body: object, The request body. (required)
87 The object takes the form of:
88
89{ # Multiple image annotation requests are batched into a single service call.
90 "requests": [ # Individual image annotation requests for this batch.
91 { # Request for performing Google Cloud Vision API tasks over a user-provided
92 # image, with user-requested features.
93 "imageContext": { # Image context. # Additional context that may accompany the image.
94 "latLongRect": { # Rectangle determined by min and max LatLng pairs. # Lat/long rectangle that specifies the location of the image.
95 "minLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Min lat/long pair.
96 # of doubles representing degrees latitude and degrees longitude. Unless
97 # specified otherwise, this must conform to the
98 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
99 # standard</a>. Values must be within normalized ranges.
100 #
101 # Example of normalization code in Python:
102 #
103 # def NormalizeLongitude(longitude):
104 # """Wraps decimal degrees longitude to [-180.0, 180.0]."""
105 # q, r = divmod(longitude, 360.0)
106 # if r > 180.0 or (r == 180.0 and q <= -1.0):
107 # return r - 360.0
108 # return r
109 #
110 # def NormalizeLatLng(latitude, longitude):
111 # """Wraps decimal degrees latitude and longitude to
112 # [-90.0, 90.0] and [-180.0, 180.0], respectively."""
113 # r = latitude % 360.0
114 # if r <= 90.0:
115 # return r, NormalizeLongitude(longitude)
116 # elif r >= 270.0:
117 # return r - 360, NormalizeLongitude(longitude)
118 # else:
119 # return 180 - r, NormalizeLongitude(longitude + 180.0)
120 #
121 # assert 180.0 == NormalizeLongitude(180.0)
122 # assert -180.0 == NormalizeLongitude(-180.0)
123 # assert -179.0 == NormalizeLongitude(181.0)
124 # assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
125 # assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
126 # assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
127 # assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
128 # assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
129 # assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
130 # assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
131 # assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
132 # assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
133 # assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
134 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
135 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
136 },
137 "maxLatLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Max lat/long pair.
138 # of doubles representing degrees latitude and degrees longitude. Unless
139 # specified otherwise, this must conform to the
140 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
141 # standard</a>. Values must be within normalized ranges.
142 #
143 # Example of normalization code in Python:
144 #
145 # def NormalizeLongitude(longitude):
146 # """Wraps decimal degrees longitude to [-180.0, 180.0]."""
147 # q, r = divmod(longitude, 360.0)
148 # if r > 180.0 or (r == 180.0 and q <= -1.0):
149 # return r - 360.0
150 # return r
151 #
152 # def NormalizeLatLng(latitude, longitude):
153 # """Wraps decimal degrees latitude and longitude to
154 # [-90.0, 90.0] and [-180.0, 180.0], respectively."""
155 # r = latitude % 360.0
156 # if r <= 90.0:
157 # return r, NormalizeLongitude(longitude)
158 # elif r >= 270.0:
159 # return r - 360, NormalizeLongitude(longitude)
160 # else:
161 # return 180 - r, NormalizeLongitude(longitude + 180.0)
162 #
163 # assert 180.0 == NormalizeLongitude(180.0)
164 # assert -180.0 == NormalizeLongitude(-180.0)
165 # assert -179.0 == NormalizeLongitude(181.0)
166 # assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
167 # assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
168 # assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
169 # assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
170 # assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
171 # assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
172 # assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
173 # assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
174 # assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
175 # assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
176 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
177 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
178 },
179 },
180 "languageHints": [ # List of languages to use for TEXT_DETECTION. In most cases, an empty value
181 # will yield the best results as it will allow text detection to
182 # automatically detect the text language. For languages based on the latin
183 # alphabet a hint is not needed. In rare cases, when the language of
184 # the text in the image is known in advance, setting this hint will help get
185 # better results (although it will hurt a great deal if the hint is wrong).
186 # Text detection will return an error if one or more of the languages
187 # specified here are not supported. The exact list of supported languages are
188 # specified here:
189 # https://cloud.google.com/translate/v2/using_rest#language-params
190 "A String",
191 ],
192 },
193 "image": { # Client image to perform Google Cloud Vision API tasks over. # The image to be processed.
194 "content": "A String", # Image content, represented as a stream of bytes.
195 "source": { # External image source (Google Cloud Storage image location). # Google Cloud Storage image location. If both 'content' and 'source'
196 # are filled for an image, 'content' takes precedence and it will be
197 # used for performing the image annotation request.
198 "gcsImageUri": "A String", # Google Cloud Storage image URI. It must be in the following form:
199 # `gs://bucket_name/object_name`. For more
200 # details, please see: https://cloud.google.com/storage/docs/reference-uris.
201 # NOTE: Cloud Storage object versioning is not supported!
202 },
203 },
204 "features": [ # Requested features.
205 { # The <em>Feature</em> indicates what type of image detection task to perform.
206 # Users describe the type of Google Cloud Vision API tasks to perform over
207 # images by using <em>Feature</em>s. Features encode the Cloud Vision API
208 # vertical to operate on and the number of top-scoring results to return.
209 "type": "A String", # The feature type.
210 "maxResults": 42, # Maximum number of results of this type.
211 },
212 ],
213 },
214 ],
215 }
216
217 x__xgafv: string, V1 error format.
218 Allowed values
219 1 - v1 error format
220 2 - v2 error format
221
222Returns:
223 An object of the form:
224
225 { # Response to a batch image annotation request.
226 "responses": [ # Individual responses to image annotation requests within the batch.
227 { # Response to an image annotation request.
228 "safeSearchAnnotation": { # Set of features pertaining to the image, computed by various computer vision # If present, safe-search annotation completed successfully.
229 # methods over safe-search verticals (for example, adult, spoof, medical,
230 # violence).
231 "medical": "A String", # Likelihood this is a medical image.
232 "violence": "A String", # Violence likelihood.
233 "spoof": "A String", # Spoof likelihood. The likelihood that an obvious modification
234 # was made to the image's canonical version to make it appear
235 # funny or offensive.
236 "adult": "A String", # Represents the adult contents likelihood for the image.
237 },
238 "textAnnotations": [ # If present, text (OCR) detection completed successfully.
239 { # Set of detected entity features.
240 "confidence": 3.14, # The accuracy of the entity detection in an image.
241 # For example, for an image containing 'Eiffel Tower,' this field represents
242 # the confidence that there is a tower in the query image. Range [0, 1].
243 "description": "A String", # Entity textual description, expressed in its <code>locale</code> language.
244 "locale": "A String", # The language code for the locale in which the entity textual
245 # <code>description</code> (next field) is expressed.
246 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
247 # image. For example, the relevancy of 'tower' to an image containing
248 # 'Eiffel Tower' is likely higher than an image containing a distant towering
249 # building, though the confidence that there is a tower may be the same.
250 # Range [0, 1].
251 "mid": "A String", # Opaque entity ID. Some IDs might be available in Knowledge Graph(KG).
252 # For more details on KG please see:
253 # https://developers.google.com/knowledge-graph/
254 "locations": [ # The location information for the detected entity. Multiple
255 # <code>LocationInfo</code> elements can be present since one location may
256 # indicate the location of the scene in the query image, and another the
257 # location of the place where the query image was taken. Location information
258 # is usually present for landmarks.
259 { # Detected entity location information.
260 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Lat - long location coordinates.
261 # of doubles representing degrees latitude and degrees longitude. Unless
262 # specified otherwise, this must conform to the
263 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
264 # standard</a>. Values must be within normalized ranges.
265 #
266 # Example of normalization code in Python:
267 #
268 # def NormalizeLongitude(longitude):
269 # """Wraps decimal degrees longitude to [-180.0, 180.0]."""
270 # q, r = divmod(longitude, 360.0)
271 # if r > 180.0 or (r == 180.0 and q <= -1.0):
272 # return r - 360.0
273 # return r
274 #
275 # def NormalizeLatLng(latitude, longitude):
276 # """Wraps decimal degrees latitude and longitude to
277 # [-90.0, 90.0] and [-180.0, 180.0], respectively."""
278 # r = latitude % 360.0
279 # if r <= 90.0:
280 # return r, NormalizeLongitude(longitude)
281 # elif r >= 270.0:
282 # return r - 360, NormalizeLongitude(longitude)
283 # else:
284 # return 180 - r, NormalizeLongitude(longitude + 180.0)
285 #
286 # assert 180.0 == NormalizeLongitude(180.0)
287 # assert -180.0 == NormalizeLongitude(-180.0)
288 # assert -179.0 == NormalizeLongitude(181.0)
289 # assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
290 # assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
291 # assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
292 # assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
293 # assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
294 # assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
295 # assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
296 # assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
297 # assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
298 # assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
299 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
300 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
301 },
302 },
303 ],
304 "score": 3.14, # Overall score of the result. Range [0, 1].
305 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not filled currently
306 # for `LABEL_DETECTION` features. For `TEXT_DETECTION` (OCR), `boundingPoly`s
307 # are produced for the entire text detected in an image region, followed by
308 # `boundingPoly`s for each word within the detected text.
309 "vertices": [ # The bounding polygon vertices.
310 { # A vertex represents a 2D point in the image.
311 # NOTE: the vertex coordinates are in the same scale as the original image.
312 "y": 42, # Y coordinate.
313 "x": 42, # X coordinate.
314 },
315 ],
316 },
317 "properties": [ # Some entities can have additional optional <code>Property</code> fields.
318 # For example a different kind of score or string that qualifies the entity.
319 { # Arbitrary name/value pair.
320 "name": "A String", # Name of the property.
321 "value": "A String", # Value of the property.
322 },
323 ],
324 },
325 ],
326 "labelAnnotations": [ # If present, label detection completed successfully.
327 { # Set of detected entity features.
328 "confidence": 3.14, # The accuracy of the entity detection in an image.
329 # For example, for an image containing 'Eiffel Tower,' this field represents
330 # the confidence that there is a tower in the query image. Range [0, 1].
331 "description": "A String", # Entity textual description, expressed in its <code>locale</code> language.
332 "locale": "A String", # The language code for the locale in which the entity textual
333 # <code>description</code> (next field) is expressed.
334 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
335 # image. For example, the relevancy of 'tower' to an image containing
336 # 'Eiffel Tower' is likely higher than an image containing a distant towering
337 # building, though the confidence that there is a tower may be the same.
338 # Range [0, 1].
339 "mid": "A String", # Opaque entity ID. Some IDs might be available in Knowledge Graph(KG).
340 # For more details on KG please see:
341 # https://developers.google.com/knowledge-graph/
342 "locations": [ # The location information for the detected entity. Multiple
343 # <code>LocationInfo</code> elements can be present since one location may
344 # indicate the location of the scene in the query image, and another the
345 # location of the place where the query image was taken. Location information
346 # is usually present for landmarks.
347 { # Detected entity location information.
348 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Lat - long location coordinates.
349 # of doubles representing degrees latitude and degrees longitude. Unless
350 # specified otherwise, this must conform to the
351 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
352 # standard</a>. Values must be within normalized ranges.
353 #
354 # Example of normalization code in Python:
355 #
356 # def NormalizeLongitude(longitude):
357 # """Wraps decimal degrees longitude to [-180.0, 180.0]."""
358 # q, r = divmod(longitude, 360.0)
359 # if r > 180.0 or (r == 180.0 and q <= -1.0):
360 # return r - 360.0
361 # return r
362 #
363 # def NormalizeLatLng(latitude, longitude):
364 # """Wraps decimal degrees latitude and longitude to
365 # [-90.0, 90.0] and [-180.0, 180.0], respectively."""
366 # r = latitude % 360.0
367 # if r <= 90.0:
368 # return r, NormalizeLongitude(longitude)
369 # elif r >= 270.0:
370 # return r - 360, NormalizeLongitude(longitude)
371 # else:
372 # return 180 - r, NormalizeLongitude(longitude + 180.0)
373 #
374 # assert 180.0 == NormalizeLongitude(180.0)
375 # assert -180.0 == NormalizeLongitude(-180.0)
376 # assert -179.0 == NormalizeLongitude(181.0)
377 # assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
378 # assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
379 # assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
380 # assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
381 # assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
382 # assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
383 # assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
384 # assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
385 # assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
386 # assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
387 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
388 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
389 },
390 },
391 ],
392 "score": 3.14, # Overall score of the result. Range [0, 1].
393 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not filled currently
394 # for `LABEL_DETECTION` features. For `TEXT_DETECTION` (OCR), `boundingPoly`s
395 # are produced for the entire text detected in an image region, followed by
396 # `boundingPoly`s for each word within the detected text.
397 "vertices": [ # The bounding polygon vertices.
398 { # A vertex represents a 2D point in the image.
399 # NOTE: the vertex coordinates are in the same scale as the original image.
400 "y": 42, # Y coordinate.
401 "x": 42, # X coordinate.
402 },
403 ],
404 },
405 "properties": [ # Some entities can have additional optional <code>Property</code> fields.
406 # For example a different kind of score or string that qualifies the entity.
407 { # Arbitrary name/value pair.
408 "name": "A String", # Name of the property.
409 "value": "A String", # Value of the property.
410 },
411 ],
412 },
413 ],
414 "imagePropertiesAnnotation": { # Stores image properties (e.g. dominant colors). # If present, image properties were extracted successfully.
415 "dominantColors": { # Set of dominant colors and their corresponding scores. # If present, dominant colors completed successfully.
416 "colors": [ # RGB color values, with their score and pixel fraction.
417 { # Color information consists of RGB channels, score and fraction of
418 # image the color occupies in the image.
419 "color": { # Represents a color in the RGBA color space. This representation is designed # RGB components of the color.
420 # for simplicity of conversion to/from color representations in various
421 # languages over compactness; for example, the fields of this representation
422 # can be trivially provided to the constructor of "java.awt.Color" in Java; it
423 # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
424 # method in iOS; and, with just a little work, it can be easily formatted into
425 # a CSS "rgba()" string in JavaScript, as well. Here are some examples:
426 #
427 # Example (Java):
428 #
429 # import com.google.type.Color;
430 #
431 # // ...
432 # public static java.awt.Color fromProto(Color protocolor) {
433 # float alpha = protocolor.hasAlpha()
434 # ? protocolor.getAlpha().getValue()
435 # : 1.0;
436 #
437 # return new java.awt.Color(
438 # protocolor.getRed(),
439 # protocolor.getGreen(),
440 # protocolor.getBlue(),
441 # alpha);
442 # }
443 #
444 # public static Color toProto(java.awt.Color color) {
445 # float red = (float) color.getRed();
446 # float green = (float) color.getGreen();
447 # float blue = (float) color.getBlue();
448 # float denominator = 255.0;
449 # Color.Builder resultBuilder =
450 # Color
451 # .newBuilder()
452 # .setRed(red / denominator)
453 # .setGreen(green / denominator)
454 # .setBlue(blue / denominator);
455 # int alpha = color.getAlpha();
456 # if (alpha != 255) {
457 # result.setAlpha(
458 # FloatValue
459 # .newBuilder()
460 # .setValue(((float) alpha) / denominator)
461 # .build());
462 # }
463 # return resultBuilder.build();
464 # }
465 # // ...
466 #
467 # Example (iOS / Obj-C):
468 #
469 # // ...
470 # static UIColor* fromProto(Color* protocolor) {
471 # float red = [protocolor red];
472 # float green = [protocolor green];
473 # float blue = [protocolor blue];
474 # FloatValue* alpha_wrapper = [protocolor alpha];
475 # float alpha = 1.0;
476 # if (alpha_wrapper != nil) {
477 # alpha = [alpha_wrapper value];
478 # }
479 # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
480 # }
481 #
482 # static Color* toProto(UIColor* color) {
483 # CGFloat red, green, blue, alpha;
484 # if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
485 # return nil;
486 # }
487 # Color* result = [Color alloc] init];
488 # [result setRed:red];
489 # [result setGreen:green];
490 # [result setBlue:blue];
491 # if (alpha <= 0.9999) {
492 # [result setAlpha:floatWrapperWithValue(alpha)];
493 # }
494 # [result autorelease];
495 # return result;
496 # }
497 # // ...
498 #
499 # Example (JavaScript):
500 #
501 # // ...
502 #
503 # var protoToCssColor = function(rgb_color) {
504 # var redFrac = rgb_color.red || 0.0;
505 # var greenFrac = rgb_color.green || 0.0;
506 # var blueFrac = rgb_color.blue || 0.0;
507 # var red = Math.floor(redFrac * 255);
508 # var green = Math.floor(greenFrac * 255);
509 # var blue = Math.floor(blueFrac * 255);
510 #
511 # if (!('alpha' in rgb_color)) {
512 # return rgbToCssColor_(red, green, blue);
513 # }
514 #
515 # var alphaFrac = rgb_color.alpha.value || 0.0;
516 # var rgbParams = [red, green, blue].join(',');
517 # return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
518 # };
519 #
520 # var rgbToCssColor_ = function(red, green, blue) {
521 # var rgbNumber = new Number((red << 16) | (green << 8) | blue);
522 # var hexString = rgbNumber.toString(16);
523 # var missingZeros = 6 - hexString.length;
524 # var resultBuilder = ['#'];
525 # for (var i = 0; i < missingZeros; i++) {
526 # resultBuilder.push('0');
527 # }
528 # resultBuilder.push(hexString);
529 # return resultBuilder.join('');
530 # };
531 #
532 # // ...
533 "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
534 "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is,
535 # the final pixel color is defined by the equation:
536 #
537 # pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
538 #
539 # This means that a value of 1.0 corresponds to a solid color, whereas
540 # a value of 0.0 corresponds to a completely transparent color. This
541 # uses a wrapper message rather than a simple float scalar so that it is
542 # possible to distinguish between a default value and the value being unset.
543 # If omitted, this color object is to be rendered as a solid color
544 # (as if the alpha value had been explicitly given with a value of 1.0).
545 "green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
546 "red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
547 },
548 "pixelFraction": 3.14, # Stores the fraction of pixels the color occupies in the image.
549 # Value in range [0, 1].
550 "score": 3.14, # Image-specific score for this color. Value in range [0, 1].
551 },
552 ],
553 },
554 },
555 "faceAnnotations": [ # If present, face detection completed successfully.
556 { # A face annotation object contains the results of face detection.
557 "panAngle": 3.14, # Yaw angle. Indicates the leftward/rightward angle that the face is
558 # pointing, relative to the vertical plane perpendicular to the image. Range
559 # [-180,180].
560 "sorrowLikelihood": "A String", # Sorrow likelihood.
561 "underExposedLikelihood": "A String", # Under-exposed likelihood.
562 "detectionConfidence": 3.14, # Detection confidence. Range [0, 1].
563 "joyLikelihood": "A String", # Joy likelihood.
564 "landmarks": [ # Detected face landmarks.
565 { # A face-specific landmark (for example, a face feature).
566 # Landmark positions may fall outside the bounds of the image
567 # when the face is near one or more edges of the image.
568 # Therefore it is NOT guaranteed that 0 <= x < width or 0 <= y < height.
569 "position": { # A 3D position in the image, used primarily for Face detection landmarks. # Face landmark position.
570 # A valid Position must have both x and y coordinates.
571 # The position coordinates are in the same scale as the original image.
572 "y": 3.14, # Y coordinate.
573 "x": 3.14, # X coordinate.
574 "z": 3.14, # Z coordinate (or depth).
575 },
576 "type": "A String", # Face landmark type.
577 },
578 ],
579 "surpriseLikelihood": "A String", # Surprise likelihood.
580 "blurredLikelihood": "A String", # Blurred likelihood.
581 "tiltAngle": 3.14, # Pitch angle. Indicates the upwards/downwards angle that the face is
582 # pointing
583 # relative to the image's horizontal plane. Range [-180,180].
584 "angerLikelihood": "A String", # Anger likelihood.
585 "boundingPoly": { # A bounding polygon for the detected image annotation. # The bounding polygon around the face. The coordinates of the bounding box
586 # are in the original image's scale, as returned in ImageParams.
587 # The bounding box is computed to "frame" the face in accordance with human
588 # expectations. It is based on the landmarker results.
589 # Note that one or more x and/or y coordinates may not be generated in the
590 # BoundingPoly (the polygon will be unbounded) if only a partial face appears in
591 # the image to be annotated.
592 "vertices": [ # The bounding polygon vertices.
593 { # A vertex represents a 2D point in the image.
594 # NOTE: the vertex coordinates are in the same scale as the original image.
595 "y": 42, # Y coordinate.
596 "x": 42, # X coordinate.
597 },
598 ],
599 },
600 "rollAngle": 3.14, # Roll angle. Indicates the amount of clockwise/anti-clockwise rotation of
601 # the
602 # face relative to the image vertical, about the axis perpendicular to the
603 # face. Range [-180,180].
604 "headwearLikelihood": "A String", # Headwear likelihood.
605 "fdBoundingPoly": { # A bounding polygon for the detected image annotation. # This bounding polygon is tighter than the previous
606 # <code>boundingPoly</code>, and
607 # encloses only the skin part of the face. Typically, it is used to
608 # eliminate the face from any image analysis that detects the
609 # "amount of skin" visible in an image. It is not based on the
610 # landmarker results, only on the initial face detection, hence
611 # the <code>fd</code> (face detection) prefix.
612 "vertices": [ # The bounding polygon vertices.
613 { # A vertex represents a 2D point in the image.
614 # NOTE: the vertex coordinates are in the same scale as the original image.
615 "y": 42, # Y coordinate.
616 "x": 42, # X coordinate.
617 },
618 ],
619 },
620 "landmarkingConfidence": 3.14, # Face landmarking confidence. Range [0, 1].
621 },
622 ],
623 "logoAnnotations": [ # If present, logo detection completed successfully.
624 { # Set of detected entity features.
625 "confidence": 3.14, # The accuracy of the entity detection in an image.
626 # For example, for an image containing 'Eiffel Tower,' this field represents
627 # the confidence that there is a tower in the query image. Range [0, 1].
628 "description": "A String", # Entity textual description, expressed in its <code>locale</code> language.
629 "locale": "A String", # The language code for the locale in which the entity textual
630 # <code>description</code> (next field) is expressed.
631 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
632 # image. For example, the relevancy of 'tower' to an image containing
633 # 'Eiffel Tower' is likely higher than an image containing a distant towering
634 # building, though the confidence that there is a tower may be the same.
635 # Range [0, 1].
636 "mid": "A String", # Opaque entity ID. Some IDs might be available in Knowledge Graph(KG).
637 # For more details on KG please see:
638 # https://developers.google.com/knowledge-graph/
639 "locations": [ # The location information for the detected entity. Multiple
640 # <code>LocationInfo</code> elements can be present since one location may
641 # indicate the location of the scene in the query image, and another the
642 # location of the place where the query image was taken. Location information
643 # is usually present for landmarks.
644 { # Detected entity location information.
645 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Lat - long location coordinates.
646 # of doubles representing degrees latitude and degrees longitude. Unless
647 # specified otherwise, this must conform to the
648 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
649 # standard</a>. Values must be within normalized ranges.
650 #
651 # Example of normalization code in Python:
652 #
653 # def NormalizeLongitude(longitude):
654 # """Wraps decimal degrees longitude to [-180.0, 180.0]."""
655 # q, r = divmod(longitude, 360.0)
656 # if r > 180.0 or (r == 180.0 and q <= -1.0):
657 # return r - 360.0
658 # return r
659 #
660 # def NormalizeLatLng(latitude, longitude):
661 # """Wraps decimal degrees latitude and longitude to
662 # [-90.0, 90.0] and [-180.0, 180.0], respectively."""
663 # r = latitude % 360.0
664 # if r <= 90.0:
665 # return r, NormalizeLongitude(longitude)
666 # elif r >= 270.0:
667 # return r - 360, NormalizeLongitude(longitude)
668 # else:
669 # return 180 - r, NormalizeLongitude(longitude + 180.0)
670 #
671 # assert 180.0 == NormalizeLongitude(180.0)
672 # assert -180.0 == NormalizeLongitude(-180.0)
673 # assert -179.0 == NormalizeLongitude(181.0)
674 # assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
675 # assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
676 # assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
677 # assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
678 # assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
679 # assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
680 # assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
681 # assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
682 # assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
683 # assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
684 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
685 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
686 },
687 },
688 ],
689 "score": 3.14, # Overall score of the result. Range [0, 1].
690 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not filled currently
691 # for `LABEL_DETECTION` features. For `TEXT_DETECTION` (OCR), `boundingPoly`s
692 # are produced for the entire text detected in an image region, followed by
693 # `boundingPoly`s for each word within the detected text.
694 "vertices": [ # The bounding polygon vertices.
695 { # A vertex represents a 2D point in the image.
696 # NOTE: the vertex coordinates are in the same scale as the original image.
697 "y": 42, # Y coordinate.
698 "x": 42, # X coordinate.
699 },
700 ],
701 },
702 "properties": [ # Some entities can have additional optional <code>Property</code> fields.
703 # For example a different kind of score or string that qualifies the entity.
704 { # Arbitrary name/value pair.
705 "name": "A String", # Name of the property.
706 "value": "A String", # Value of the property.
707 },
708 ],
709 },
710 ],
711 "landmarkAnnotations": [ # If present, landmark detection completed successfully.
712 { # Set of detected entity features.
713 "confidence": 3.14, # The accuracy of the entity detection in an image.
714 # For example, for an image containing 'Eiffel Tower,' this field represents
715 # the confidence that there is a tower in the query image. Range [0, 1].
716 "description": "A String", # Entity textual description, expressed in its <code>locale</code> language.
717 "locale": "A String", # The language code for the locale in which the entity textual
718 # <code>description</code> (next field) is expressed.
719 "topicality": 3.14, # The relevancy of the ICA (Image Content Annotation) label to the
720 # image. For example, the relevancy of 'tower' to an image containing
721 # 'Eiffel Tower' is likely higher than an image containing a distant towering
722 # building, though the confidence that there is a tower may be the same.
723 # Range [0, 1].
724 "mid": "A String", # Opaque entity ID. Some IDs might be available in Knowledge Graph(KG).
725 # For more details on KG please see:
726 # https://developers.google.com/knowledge-graph/
727 "locations": [ # The location information for the detected entity. Multiple
728 # <code>LocationInfo</code> elements can be present since one location may
729 # indicate the location of the scene in the query image, and another the
730 # location of the place where the query image was taken. Location information
731 # is usually present for landmarks.
732 { # Detected entity location information.
733 "latLng": { # An object representing a latitude/longitude pair. This is expressed as a pair # Lat - long location coordinates.
734 # of doubles representing degrees latitude and degrees longitude. Unless
735 # specified otherwise, this must conform to the
736 # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
737 # standard</a>. Values must be within normalized ranges.
738 #
739 # Example of normalization code in Python:
740 #
741 # def NormalizeLongitude(longitude):
742 # """Wraps decimal degrees longitude to [-180.0, 180.0]."""
743 # q, r = divmod(longitude, 360.0)
744 # if r > 180.0 or (r == 180.0 and q <= -1.0):
745 # return r - 360.0
746 # return r
747 #
748 # def NormalizeLatLng(latitude, longitude):
749 # """Wraps decimal degrees latitude and longitude to
750 # [-90.0, 90.0] and [-180.0, 180.0], respectively."""
751 # r = latitude % 360.0
752 # if r <= 90.0:
753 # return r, NormalizeLongitude(longitude)
754 # elif r >= 270.0:
755 # return r - 360, NormalizeLongitude(longitude)
756 # else:
757 # return 180 - r, NormalizeLongitude(longitude + 180.0)
758 #
759 # assert 180.0 == NormalizeLongitude(180.0)
760 # assert -180.0 == NormalizeLongitude(-180.0)
761 # assert -179.0 == NormalizeLongitude(181.0)
762 # assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
763 # assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
764 # assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
765 # assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
766 # assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
767 # assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
768 # assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
769 # assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
770 # assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
771 # assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
772 "latitude": 3.14, # The latitude in degrees. It must be in the range [-90.0, +90.0].
773 "longitude": 3.14, # The longitude in degrees. It must be in the range [-180.0, +180.0].
774 },
775 },
776 ],
777 "score": 3.14, # Overall score of the result. Range [0, 1].
778 "boundingPoly": { # A bounding polygon for the detected image annotation. # Image region to which this entity belongs. Not filled currently
779 # for `LABEL_DETECTION` features. For `TEXT_DETECTION` (OCR), `boundingPoly`s
780 # are produced for the entire text detected in an image region, followed by
781 # `boundingPoly`s for each word within the detected text.
782 "vertices": [ # The bounding polygon vertices.
783 { # A vertex represents a 2D point in the image.
784 # NOTE: the vertex coordinates are in the same scale as the original image.
785 "y": 42, # Y coordinate.
786 "x": 42, # X coordinate.
787 },
788 ],
789 },
790 "properties": [ # Some entities can have additional optional <code>Property</code> fields.
791 # For example a different kind of score or string that qualifies the entity.
792 { # Arbitrary name/value pair.
793 "name": "A String", # Name of the property.
794 "value": "A String", # Value of the property.
795 },
796 ],
797 },
798 ],
799 "error": { # The `Status` type defines a logical error model that is suitable for different # If set, represents the error message for the operation.
800 # Note that filled-in mage annotations are guaranteed to be
801 # correct, even when <code>error</code> is non-empty.
802 # programming environments, including REST APIs and RPC APIs. It is used by
803 # [gRPC](https://github.com/grpc). The error model is designed to be:
804 #
805 # - Simple to use and understand for most users
806 # - Flexible enough to meet unexpected needs
807 #
808 # # Overview
809 #
810 # The `Status` message contains three pieces of data: error code, error message,
811 # and error details. The error code should be an enum value of
812 # google.rpc.Code, but it may accept additional error codes if needed. The
813 # error message should be a developer-facing English message that helps
814 # developers *understand* and *resolve* the error. If a localized user-facing
815 # error message is needed, put the localized message in the error details or
816 # localize it in the client. The optional error details may contain arbitrary
817 # information about the error. There is a predefined set of error detail types
818 # in the package `google.rpc` which can be used for common error conditions.
819 #
820 # # Language mapping
821 #
822 # The `Status` message is the logical representation of the error model, but it
823 # is not necessarily the actual wire format. When the `Status` message is
824 # exposed in different client libraries and different wire protocols, it can be
825 # mapped differently. For example, it will likely be mapped to some exceptions
826 # in Java, but more likely mapped to some error codes in C.
827 #
828 # # Other uses
829 #
830 # The error model and the `Status` message can be used in a variety of
831 # environments, either with or without APIs, to provide a
832 # consistent developer experience across different environments.
833 #
834 # Example uses of this error model include:
835 #
836 # - Partial errors. If a service needs to return partial errors to the client,
837 # it may embed the `Status` in the normal response to indicate the partial
838 # errors.
839 #
840 # - Workflow errors. A typical workflow has multiple steps. Each step may
841 # have a `Status` message for error reporting purpose.
842 #
843 # - Batch operations. If a client uses batch request and batch response, the
844 # `Status` message should be used directly inside batch response, one for
845 # each error sub-response.
846 #
847 # - Asynchronous operations. If an API call embeds asynchronous operation
848 # results in its response, the status of those operations should be
849 # represented directly using the `Status` message.
850 #
851 # - Logging. If some API errors are stored in logs, the message `Status` could
852 # be used directly after any stripping needed for security/privacy reasons.
853 "message": "A String", # A developer-facing error message, which should be in English. Any
854 # user-facing error message should be localized and sent in the
855 # google.rpc.Status.details field, or localized by the client.
856 "code": 42, # The status code, which should be an enum value of google.rpc.Code.
857 "details": [ # A list of messages that carry the error details. There will be a
858 # common set of message types for APIs to use.
859 {
860 "a_key": "", # Properties of the object. Contains field @ype with type URL.
861 },
862 ],
863 },
864 },
865 ],
866 }</pre>
867</div>
868
869</body></html>