google-api-client 0.11.2 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +6 -0
- data/api_names.yaml +1 -0
- data/generated/google/apis/acceleratedmobilepageurl_v1/classes.rb +38 -38
- data/generated/google/apis/acceleratedmobilepageurl_v1/representations.rb +13 -13
- data/generated/google/apis/acceleratedmobilepageurl_v1/service.rb +10 -10
- data/generated/google/apis/adexchangebuyer2_v2beta1.rb +1 -1
- data/generated/google/apis/adexchangebuyer2_v2beta1/classes.rb +201 -201
- data/generated/google/apis/adexchangebuyer2_v2beta1/representations.rb +46 -46
- data/generated/google/apis/adexchangebuyer2_v2beta1/service.rb +119 -119
- data/generated/google/apis/adexchangebuyer_v1_4.rb +1 -1
- data/generated/google/apis/adexchangebuyer_v1_4/classes.rb +52 -9
- data/generated/google/apis/adexchangebuyer_v1_4/representations.rb +9 -0
- data/generated/google/apis/adsense_v1_4.rb +1 -1
- data/generated/google/apis/adsensehost_v4_1.rb +1 -1
- data/generated/google/apis/analyticsreporting_v4/classes.rb +926 -926
- data/generated/google/apis/analyticsreporting_v4/representations.rb +149 -149
- data/generated/google/apis/androidenterprise_v1.rb +1 -1
- data/generated/google/apis/androidenterprise_v1/classes.rb +18 -11
- data/generated/google/apis/androidenterprise_v1/representations.rb +1 -0
- data/generated/google/apis/androidpublisher_v2.rb +1 -1
- data/generated/google/apis/appengine_v1.rb +1 -1
- data/generated/google/apis/appengine_v1/classes.rb +1487 -1487
- data/generated/google/apis/appengine_v1/representations.rb +229 -229
- data/generated/google/apis/appengine_v1/service.rb +188 -188
- data/generated/google/apis/appstate_v1.rb +1 -1
- data/generated/google/apis/bigquery_v2.rb +1 -1
- data/generated/google/apis/bigquery_v2/classes.rb +15 -10
- data/generated/google/apis/calendar_v3.rb +1 -1
- data/generated/google/apis/calendar_v3/service.rb +10 -4
- data/generated/google/apis/classroom_v1.rb +26 -17
- data/generated/google/apis/classroom_v1/classes.rb +990 -990
- data/generated/google/apis/classroom_v1/representations.rb +239 -239
- data/generated/google/apis/classroom_v1/service.rb +853 -853
- data/generated/google/apis/cloudbilling_v1.rb +1 -1
- data/generated/google/apis/cloudbuild_v1.rb +1 -1
- data/generated/google/apis/cloudbuild_v1/classes.rb +627 -627
- data/generated/google/apis/cloudbuild_v1/representations.rb +116 -116
- data/generated/google/apis/cloudbuild_v1/service.rb +162 -157
- data/generated/google/apis/clouddebugger_v2/classes.rb +258 -258
- data/generated/google/apis/clouddebugger_v2/representations.rb +80 -80
- data/generated/google/apis/clouddebugger_v2/service.rb +163 -163
- data/generated/google/apis/clouderrorreporting_v1beta1.rb +3 -4
- data/generated/google/apis/clouderrorreporting_v1beta1/classes.rb +202 -167
- data/generated/google/apis/clouderrorreporting_v1beta1/representations.rb +53 -37
- data/generated/google/apis/clouderrorreporting_v1beta1/service.rb +50 -51
- data/generated/google/apis/cloudfunctions_v1.rb +1 -1
- data/generated/google/apis/cloudkms_v1.rb +1 -1
- data/generated/google/apis/cloudkms_v1/classes.rb +628 -622
- data/generated/google/apis/cloudkms_v1/representations.rb +134 -133
- data/generated/google/apis/cloudkms_v1/service.rb +190 -190
- data/generated/google/apis/cloudresourcemanager_v1.rb +1 -1
- data/generated/google/apis/cloudresourcemanager_v1/classes.rb +835 -835
- data/generated/google/apis/cloudresourcemanager_v1/representations.rb +138 -138
- data/generated/google/apis/cloudresourcemanager_v1/service.rb +474 -474
- data/generated/google/apis/cloudresourcemanager_v1beta1.rb +1 -1
- data/generated/google/apis/cloudresourcemanager_v1beta1/classes.rb +386 -386
- data/generated/google/apis/cloudresourcemanager_v1beta1/representations.rb +75 -75
- data/generated/google/apis/cloudresourcemanager_v1beta1/service.rb +64 -64
- data/generated/google/apis/cloudtrace_v1.rb +4 -4
- data/generated/google/apis/cloudtrace_v1/classes.rb +114 -114
- data/generated/google/apis/cloudtrace_v1/representations.rb +23 -23
- data/generated/google/apis/cloudtrace_v1/service.rb +14 -14
- data/generated/google/apis/compute_beta.rb +1 -1
- data/generated/google/apis/compute_beta/classes.rb +66 -25
- data/generated/google/apis/compute_beta/representations.rb +16 -0
- data/generated/google/apis/compute_beta/service.rb +85 -3
- data/generated/google/apis/compute_v1.rb +1 -1
- data/generated/google/apis/compute_v1/classes.rb +375 -24
- data/generated/google/apis/compute_v1/representations.rb +155 -0
- data/generated/google/apis/compute_v1/service.rb +481 -3
- data/generated/google/apis/container_v1.rb +1 -1
- data/generated/google/apis/container_v1/classes.rb +301 -301
- data/generated/google/apis/container_v1/representations.rb +59 -59
- data/generated/google/apis/container_v1/service.rb +178 -178
- data/generated/google/apis/content_v2.rb +1 -1
- data/generated/google/apis/content_v2/classes.rb +37 -2
- data/generated/google/apis/content_v2/representations.rb +15 -0
- data/generated/google/apis/content_v2/service.rb +58 -3
- data/generated/google/apis/dataflow_v1b3.rb +4 -1
- data/generated/google/apis/dataflow_v1b3/classes.rb +3514 -3279
- data/generated/google/apis/dataflow_v1b3/representations.rb +530 -440
- data/generated/google/apis/dataflow_v1b3/service.rb +378 -137
- data/generated/google/apis/dataproc_v1.rb +1 -1
- data/generated/google/apis/dataproc_v1/classes.rb +446 -446
- data/generated/google/apis/dataproc_v1/representations.rb +96 -96
- data/generated/google/apis/dataproc_v1/service.rb +302 -302
- data/generated/google/apis/datastore_v1.rb +1 -1
- data/generated/google/apis/datastore_v1/classes.rb +370 -374
- data/generated/google/apis/datastore_v1/representations.rb +120 -120
- data/generated/google/apis/datastore_v1/service.rb +62 -62
- data/generated/google/apis/dns_v1.rb +1 -1
- data/generated/google/apis/dns_v2beta1.rb +1 -1
- data/generated/google/apis/doubleclickbidmanager_v1.rb +3 -0
- data/generated/google/apis/doubleclicksearch_v2.rb +1 -1
- data/generated/google/apis/drive_v2.rb +1 -1
- data/generated/google/apis/drive_v2/classes.rb +24 -21
- data/generated/google/apis/drive_v3.rb +1 -1
- data/generated/google/apis/drive_v3/classes.rb +24 -22
- data/generated/google/apis/firebasedynamiclinks_v1.rb +1 -1
- data/generated/google/apis/firebasedynamiclinks_v1/classes.rb +148 -149
- data/generated/google/apis/firebasedynamiclinks_v1/representations.rb +42 -42
- data/generated/google/apis/firebaserules_v1/classes.rb +71 -71
- data/generated/google/apis/firebaserules_v1/representations.rb +22 -22
- data/generated/google/apis/firebaserules_v1/service.rb +68 -68
- data/generated/google/apis/games_configuration_v1configuration.rb +1 -1
- data/generated/google/apis/games_management_v1management.rb +1 -1
- data/generated/google/apis/games_v1.rb +1 -1
- data/generated/google/apis/genomics_v1.rb +1 -1
- data/generated/google/apis/genomics_v1/classes.rb +2348 -2348
- data/generated/google/apis/genomics_v1/representations.rb +430 -430
- data/generated/google/apis/genomics_v1/service.rb +1159 -1159
- data/generated/google/apis/gmail_v1.rb +1 -1
- data/generated/google/apis/gmail_v1/service.rb +2 -2
- data/generated/google/apis/iam_v1.rb +1 -1
- data/generated/google/apis/iam_v1/classes.rb +305 -298
- data/generated/google/apis/iam_v1/representations.rb +97 -96
- data/generated/google/apis/iam_v1/service.rb +86 -86
- data/generated/google/apis/kgsearch_v1/classes.rb +6 -6
- data/generated/google/apis/kgsearch_v1/representations.rb +1 -1
- data/generated/google/apis/kgsearch_v1/service.rb +10 -10
- data/generated/google/apis/language_v1.rb +4 -4
- data/generated/google/apis/language_v1/classes.rb +452 -452
- data/generated/google/apis/language_v1/representations.rb +93 -93
- data/generated/google/apis/language_v1/service.rb +48 -48
- data/generated/google/apis/language_v1beta1.rb +4 -4
- data/generated/google/apis/language_v1beta1/classes.rb +84 -84
- data/generated/google/apis/language_v1beta1/representations.rb +22 -22
- data/generated/google/apis/language_v1beta1/service.rb +3 -3
- data/generated/google/apis/logging_v2.rb +1 -1
- data/generated/google/apis/logging_v2/classes.rb +884 -873
- data/generated/google/apis/logging_v2/representations.rb +167 -166
- data/generated/google/apis/logging_v2/service.rb +430 -430
- data/generated/google/apis/logging_v2beta1.rb +1 -1
- data/generated/google/apis/logging_v2beta1/classes.rb +550 -539
- data/generated/google/apis/logging_v2beta1/representations.rb +124 -123
- data/generated/google/apis/logging_v2beta1/service.rb +292 -292
- data/generated/google/apis/manufacturers_v1/classes.rb +322 -322
- data/generated/google/apis/manufacturers_v1/representations.rb +66 -66
- data/generated/google/apis/ml_v1.rb +1 -1
- data/generated/google/apis/ml_v1/classes.rb +501 -494
- data/generated/google/apis/ml_v1/representations.rb +92 -91
- data/generated/google/apis/ml_v1/service.rb +190 -190
- data/generated/google/apis/monitoring_v3.rb +1 -1
- data/generated/google/apis/monitoring_v3/classes.rb +878 -878
- data/generated/google/apis/monitoring_v3/representations.rb +176 -176
- data/generated/google/apis/monitoring_v3/service.rb +223 -262
- data/generated/google/apis/oauth2_v2.rb +1 -1
- data/generated/google/apis/partners_v2.rb +1 -1
- data/generated/google/apis/partners_v2/classes.rb +1506 -1506
- data/generated/google/apis/partners_v2/representations.rb +370 -370
- data/generated/google/apis/partners_v2/service.rb +393 -393
- data/generated/google/apis/people_v1.rb +13 -13
- data/generated/google/apis/people_v1/classes.rb +597 -594
- data/generated/google/apis/people_v1/representations.rb +121 -121
- data/generated/google/apis/people_v1/service.rb +39 -48
- data/generated/google/apis/plus_domains_v1.rb +1 -1
- data/generated/google/apis/plus_v1.rb +1 -1
- data/generated/google/apis/proximitybeacon_v1beta1.rb +1 -1
- data/generated/google/apis/proximitybeacon_v1beta1/classes.rb +323 -327
- data/generated/google/apis/proximitybeacon_v1beta1/representations.rb +100 -100
- data/generated/google/apis/proximitybeacon_v1beta1/service.rb +184 -184
- data/generated/google/apis/pubsub_v1.rb +1 -1
- data/generated/google/apis/pubsub_v1/classes.rb +178 -178
- data/generated/google/apis/pubsub_v1/representations.rb +55 -55
- data/generated/google/apis/pubsub_v1/service.rb +357 -357
- data/generated/google/apis/runtimeconfig_v1.rb +1 -1
- data/generated/google/apis/runtimeconfig_v1/classes.rb +20 -20
- data/generated/google/apis/runtimeconfig_v1/representations.rb +2 -2
- data/generated/google/apis/runtimeconfig_v1/service.rb +12 -7
- data/generated/google/apis/script_v1.rb +16 -16
- data/generated/google/apis/script_v1/classes.rb +113 -113
- data/generated/google/apis/script_v1/representations.rb +28 -28
- data/generated/google/apis/script_v1/service.rb +4 -4
- data/generated/google/apis/searchconsole_v1.rb +1 -1
- data/generated/google/apis/searchconsole_v1/classes.rb +84 -84
- data/generated/google/apis/searchconsole_v1/representations.rb +32 -32
- data/generated/google/apis/searchconsole_v1/service.rb +6 -6
- data/generated/google/apis/servicecontrol_v1.rb +4 -4
- data/generated/google/apis/servicecontrol_v1/classes.rb +1146 -1145
- data/generated/google/apis/servicecontrol_v1/representations.rb +203 -203
- data/generated/google/apis/servicecontrol_v1/service.rb +57 -57
- data/generated/google/apis/servicemanagement_v1.rb +4 -4
- data/generated/google/apis/servicemanagement_v1/classes.rb +3486 -3360
- data/generated/google/apis/servicemanagement_v1/representations.rb +342 -329
- data/generated/google/apis/servicemanagement_v1/service.rb +260 -250
- data/generated/google/apis/serviceuser_v1.rb +1 -1
- data/generated/google/apis/serviceuser_v1/classes.rb +2716 -2596
- data/generated/google/apis/serviceuser_v1/representations.rb +391 -379
- data/generated/google/apis/serviceuser_v1/service.rb +16 -16
- data/generated/google/apis/sheets_v4.rb +1 -1
- data/generated/google/apis/sheets_v4/classes.rb +4255 -4252
- data/generated/google/apis/sheets_v4/representations.rb +548 -548
- data/generated/google/apis/sheets_v4/service.rb +170 -170
- data/generated/google/apis/slides_v1.rb +4 -4
- data/generated/google/apis/slides_v1/classes.rb +2945 -2916
- data/generated/google/apis/slides_v1/representations.rb +700 -697
- data/generated/google/apis/slides_v1/service.rb +44 -44
- data/generated/google/apis/sourcerepo_v1.rb +2 -2
- data/generated/google/apis/sourcerepo_v1/classes.rb +419 -410
- data/generated/google/apis/sourcerepo_v1/representations.rb +88 -87
- data/generated/google/apis/sourcerepo_v1/service.rb +67 -58
- data/generated/google/apis/spanner_v1/classes.rb +2187 -2187
- data/generated/google/apis/spanner_v1/representations.rb +323 -323
- data/generated/google/apis/spanner_v1/service.rb +383 -383
- data/generated/google/apis/speech_v1beta1.rb +1 -1
- data/generated/google/apis/speech_v1beta1/classes.rb +226 -226
- data/generated/google/apis/speech_v1beta1/representations.rb +44 -44
- data/generated/google/apis/speech_v1beta1/service.rb +37 -32
- data/generated/google/apis/sqladmin_v1beta4.rb +1 -1
- data/generated/google/apis/sqladmin_v1beta4/classes.rb +10 -28
- data/generated/google/apis/sqladmin_v1beta4/representations.rb +2 -16
- data/generated/google/apis/sqladmin_v1beta4/service.rb +1 -1
- data/generated/google/apis/storage_v1.rb +1 -1
- data/generated/google/apis/storage_v1/classes.rb +26 -0
- data/generated/google/apis/storage_v1/representations.rb +15 -0
- data/generated/google/apis/storage_v1/service.rb +168 -42
- data/generated/google/apis/storagetransfer_v1.rb +1 -1
- data/generated/google/apis/storagetransfer_v1/classes.rb +218 -218
- data/generated/google/apis/storagetransfer_v1/representations.rb +47 -47
- data/generated/google/apis/storagetransfer_v1/service.rb +68 -68
- data/generated/google/apis/toolresults_v1beta3.rb +1 -1
- data/generated/google/apis/toolresults_v1beta3/classes.rb +7 -4
- data/generated/google/apis/toolresults_v1beta3/service.rb +9 -8
- data/generated/google/apis/translate_v2.rb +11 -4
- data/generated/google/apis/translate_v2/classes.rb +140 -37
- data/generated/google/apis/translate_v2/representations.rb +62 -15
- data/generated/google/apis/translate_v2/service.rb +119 -66
- data/generated/google/apis/vision_v1.rb +1 -1
- data/generated/google/apis/vision_v1/classes.rb +1265 -1273
- data/generated/google/apis/vision_v1/representations.rb +202 -202
- data/generated/google/apis/vision_v1/service.rb +4 -4
- data/generated/google/apis/webmasters_v3.rb +1 -1
- data/generated/google/apis/youtube_analytics_v1.rb +1 -1
- data/generated/google/apis/youtube_partner_v1.rb +1 -1
- data/generated/google/apis/youtube_partner_v1/classes.rb +2 -1
- data/generated/google/apis/youtubereporting_v1.rb +1 -1
- data/generated/google/apis/youtubereporting_v1/classes.rb +91 -91
- data/generated/google/apis/youtubereporting_v1/representations.rb +25 -25
- data/generated/google/apis/youtubereporting_v1/service.rb +94 -94
- data/lib/google/apis/core/api_command.rb +43 -10
- data/lib/google/apis/core/json_representation.rb +1 -1
- data/lib/google/apis/options.rb +6 -2
- data/lib/google/apis/version.rb +1 -1
- metadata +3 -3
@@ -20,9 +20,10 @@ require 'google/apis/errors'
|
|
20
20
|
module Google
|
21
21
|
module Apis
|
22
22
|
module TranslateV2
|
23
|
-
#
|
23
|
+
# Google Cloud Translation API
|
24
24
|
#
|
25
|
-
#
|
25
|
+
# The Google Cloud Translation API lets websites and programs integrate with
|
26
|
+
# Google Translate programmatically.
|
26
27
|
#
|
27
28
|
# @example
|
28
29
|
# require 'google/apis/translate_v2'
|
@@ -30,7 +31,7 @@ module Google
|
|
30
31
|
# Translate = Google::Apis::TranslateV2 # Alias the module
|
31
32
|
# service = Translate::TranslateService.new
|
32
33
|
#
|
33
|
-
# @see https://
|
34
|
+
# @see https://code.google.com/apis/language/translate/v2/getting_started.html
|
34
35
|
class TranslateService < Google::Apis::Core::BaseService
|
35
36
|
# @return [String]
|
36
37
|
# API key. Your API key identifies your project and provides you with API access,
|
@@ -43,106 +44,100 @@ module Google
|
|
43
44
|
# Overrides userIp if both are provided.
|
44
45
|
attr_accessor :quota_user
|
45
46
|
|
46
|
-
# @return [String]
|
47
|
-
# IP address of the site where the request originates. Use this if you want to
|
48
|
-
# enforce per-user limits.
|
49
|
-
attr_accessor :user_ip
|
50
|
-
|
51
47
|
def initialize
|
52
|
-
super('https://
|
53
|
-
@batch_path = 'batch'
|
48
|
+
super('https://translation.googleapis.com/', 'language/translate/')
|
49
|
+
@batch_path = 'batch/translate'
|
54
50
|
end
|
55
51
|
|
56
|
-
#
|
57
|
-
# @param [
|
58
|
-
# The
|
59
|
-
#
|
60
|
-
# Selector specifying which fields to include in a partial response.
|
52
|
+
# Returns a list of supported languages for translation.
|
53
|
+
# @param [String] target
|
54
|
+
# The language to use to return localized, human readable names of supported
|
55
|
+
# languages.
|
61
56
|
# @param [String] quota_user
|
62
57
|
# Available to use for quota purposes for server-side applications. Can be any
|
63
58
|
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
64
59
|
# Overrides userIp if both are provided.
|
65
|
-
# @param [String]
|
66
|
-
#
|
67
|
-
# enforce per-user limits.
|
60
|
+
# @param [String] fields
|
61
|
+
# Selector specifying which fields to include in a partial response.
|
68
62
|
# @param [Google::Apis::RequestOptions] options
|
69
63
|
# Request-specific options
|
70
64
|
#
|
71
65
|
# @yield [result, err] Result & error if block supplied
|
72
|
-
# @yieldparam result [Google::Apis::TranslateV2::
|
66
|
+
# @yieldparam result [Google::Apis::TranslateV2::ListLanguagesResponse] parsed result object
|
73
67
|
# @yieldparam err [StandardError] error object if request failed
|
74
68
|
#
|
75
|
-
# @return [Google::Apis::TranslateV2::
|
69
|
+
# @return [Google::Apis::TranslateV2::ListLanguagesResponse]
|
76
70
|
#
|
77
71
|
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
78
72
|
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
79
73
|
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
80
|
-
def
|
81
|
-
command = make_simple_command(:get, 'v2/
|
82
|
-
command.response_representation = Google::Apis::TranslateV2::
|
83
|
-
command.response_class = Google::Apis::TranslateV2::
|
84
|
-
command.query['
|
85
|
-
command.query['fields'] = fields unless fields.nil?
|
74
|
+
def list_languages(target: nil, quota_user: nil, fields: nil, options: nil, &block)
|
75
|
+
command = make_simple_command(:get, 'v2/languages', options)
|
76
|
+
command.response_representation = Google::Apis::TranslateV2::ListLanguagesResponse::Representation
|
77
|
+
command.response_class = Google::Apis::TranslateV2::ListLanguagesResponse
|
78
|
+
command.query['target'] = target unless target.nil?
|
86
79
|
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
87
|
-
command.query['
|
80
|
+
command.query['fields'] = fields unless fields.nil?
|
88
81
|
execute_or_queue_command(command, &block)
|
89
82
|
end
|
90
83
|
|
91
|
-
#
|
84
|
+
# Translates input text, returning translated text.
|
85
|
+
# @param [Array<String>, String] q
|
86
|
+
# The input text to translate. Repeat this parameter to perform translation
|
87
|
+
# operations on multiple text inputs.
|
92
88
|
# @param [String] target
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
89
|
+
# The language to use for translation of the input text, set to one of the
|
90
|
+
# language codes listed in Language Support.
|
91
|
+
# @param [String] format
|
92
|
+
# The format of the source text, in either HTML (default) or plain-text. A
|
93
|
+
# value of "html" indicates HTML and a value of "text" indicates plain-text.
|
94
|
+
# @param [String] source
|
95
|
+
# The language of the source text, set to one of the language codes listed in
|
96
|
+
# Language Support. If the source language is not specified, the API will
|
97
|
+
# attempt to identify the source language automatically and return it within
|
98
|
+
# the response.
|
99
|
+
# @param [Array<String>, String] cid
|
100
|
+
# The customization id for translate
|
96
101
|
# @param [String] quota_user
|
97
102
|
# Available to use for quota purposes for server-side applications. Can be any
|
98
103
|
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
99
104
|
# Overrides userIp if both are provided.
|
100
|
-
# @param [String]
|
101
|
-
#
|
102
|
-
# enforce per-user limits.
|
105
|
+
# @param [String] fields
|
106
|
+
# Selector specifying which fields to include in a partial response.
|
103
107
|
# @param [Google::Apis::RequestOptions] options
|
104
108
|
# Request-specific options
|
105
109
|
#
|
106
110
|
# @yield [result, err] Result & error if block supplied
|
107
|
-
# @yieldparam result [Google::Apis::TranslateV2::
|
111
|
+
# @yieldparam result [Google::Apis::TranslateV2::ListTranslationsResponse] parsed result object
|
108
112
|
# @yieldparam err [StandardError] error object if request failed
|
109
113
|
#
|
110
|
-
# @return [Google::Apis::TranslateV2::
|
114
|
+
# @return [Google::Apis::TranslateV2::ListTranslationsResponse]
|
111
115
|
#
|
112
116
|
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
113
117
|
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
114
118
|
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
115
|
-
def
|
116
|
-
command = make_simple_command(:get, 'v2
|
117
|
-
command.response_representation = Google::Apis::TranslateV2::
|
118
|
-
command.response_class = Google::Apis::TranslateV2::
|
119
|
+
def list_translations(q, target, format: nil, source: nil, cid: nil, quota_user: nil, fields: nil, options: nil, &block)
|
120
|
+
command = make_simple_command(:get, 'v2', options)
|
121
|
+
command.response_representation = Google::Apis::TranslateV2::ListTranslationsResponse::Representation
|
122
|
+
command.response_class = Google::Apis::TranslateV2::ListTranslationsResponse
|
123
|
+
command.query['format'] = format unless format.nil?
|
124
|
+
command.query['q'] = q unless q.nil?
|
125
|
+
command.query['source'] = source unless source.nil?
|
126
|
+
command.query['cid'] = cid unless cid.nil?
|
119
127
|
command.query['target'] = target unless target.nil?
|
120
|
-
command.query['fields'] = fields unless fields.nil?
|
121
128
|
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
122
|
-
command.query['
|
129
|
+
command.query['fields'] = fields unless fields.nil?
|
123
130
|
execute_or_queue_command(command, &block)
|
124
131
|
end
|
125
132
|
|
126
|
-
#
|
127
|
-
# @param [
|
128
|
-
# The text to translate
|
129
|
-
# @param [String] target
|
130
|
-
# The target language into which the text should be translated
|
131
|
-
# @param [Array<String>, String] cid
|
132
|
-
# The customization id for translate
|
133
|
-
# @param [String] format
|
134
|
-
# The format of the text
|
135
|
-
# @param [String] source
|
136
|
-
# The source language of the text
|
137
|
-
# @param [String] fields
|
138
|
-
# Selector specifying which fields to include in a partial response.
|
133
|
+
# Translates input text, returning translated text.
|
134
|
+
# @param [Google::Apis::TranslateV2::TranslateTextRequest] translate_text_request_object
|
139
135
|
# @param [String] quota_user
|
140
136
|
# Available to use for quota purposes for server-side applications. Can be any
|
141
137
|
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
142
138
|
# Overrides userIp if both are provided.
|
143
|
-
# @param [String]
|
144
|
-
#
|
145
|
-
# enforce per-user limits.
|
139
|
+
# @param [String] fields
|
140
|
+
# Selector specifying which fields to include in a partial response.
|
146
141
|
# @param [Google::Apis::RequestOptions] options
|
147
142
|
# Request-specific options
|
148
143
|
#
|
@@ -155,18 +150,77 @@ module Google
|
|
155
150
|
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
156
151
|
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
157
152
|
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
158
|
-
def
|
159
|
-
command = make_simple_command(:
|
153
|
+
def translate_translation_text(translate_text_request_object = nil, quota_user: nil, fields: nil, options: nil, &block)
|
154
|
+
command = make_simple_command(:post, 'v2', options)
|
155
|
+
command.request_representation = Google::Apis::TranslateV2::TranslateTextRequest::Representation
|
156
|
+
command.request_object = translate_text_request_object
|
160
157
|
command.response_representation = Google::Apis::TranslateV2::ListTranslationsResponse::Representation
|
161
158
|
command.response_class = Google::Apis::TranslateV2::ListTranslationsResponse
|
162
|
-
command.query['
|
163
|
-
command.query['
|
159
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
160
|
+
command.query['fields'] = fields unless fields.nil?
|
161
|
+
execute_or_queue_command(command, &block)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Detects the language of text within a request.
|
165
|
+
# @param [Array<String>, String] q
|
166
|
+
# The input text upon which to perform language detection. Repeat this
|
167
|
+
# parameter to perform language detection on multiple text inputs.
|
168
|
+
# @param [String] quota_user
|
169
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
170
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
171
|
+
# Overrides userIp if both are provided.
|
172
|
+
# @param [String] fields
|
173
|
+
# Selector specifying which fields to include in a partial response.
|
174
|
+
# @param [Google::Apis::RequestOptions] options
|
175
|
+
# Request-specific options
|
176
|
+
#
|
177
|
+
# @yield [result, err] Result & error if block supplied
|
178
|
+
# @yieldparam result [Google::Apis::TranslateV2::ListDetectionsResponse] parsed result object
|
179
|
+
# @yieldparam err [StandardError] error object if request failed
|
180
|
+
#
|
181
|
+
# @return [Google::Apis::TranslateV2::ListDetectionsResponse]
|
182
|
+
#
|
183
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
184
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
185
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
186
|
+
def list_detections(q, quota_user: nil, fields: nil, options: nil, &block)
|
187
|
+
command = make_simple_command(:get, 'v2/detect', options)
|
188
|
+
command.response_representation = Google::Apis::TranslateV2::ListDetectionsResponse::Representation
|
189
|
+
command.response_class = Google::Apis::TranslateV2::ListDetectionsResponse
|
164
190
|
command.query['q'] = q unless q.nil?
|
165
|
-
command.query['
|
166
|
-
command.query['target'] = target unless target.nil?
|
191
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
167
192
|
command.query['fields'] = fields unless fields.nil?
|
193
|
+
execute_or_queue_command(command, &block)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Detects the language of text within a request.
|
197
|
+
# @param [Google::Apis::TranslateV2::DetectLanguageRequest] detect_language_request_object
|
198
|
+
# @param [String] quota_user
|
199
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
200
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
201
|
+
# Overrides userIp if both are provided.
|
202
|
+
# @param [String] fields
|
203
|
+
# Selector specifying which fields to include in a partial response.
|
204
|
+
# @param [Google::Apis::RequestOptions] options
|
205
|
+
# Request-specific options
|
206
|
+
#
|
207
|
+
# @yield [result, err] Result & error if block supplied
|
208
|
+
# @yieldparam result [Google::Apis::TranslateV2::ListDetectionsResponse] parsed result object
|
209
|
+
# @yieldparam err [StandardError] error object if request failed
|
210
|
+
#
|
211
|
+
# @return [Google::Apis::TranslateV2::ListDetectionsResponse]
|
212
|
+
#
|
213
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
214
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
215
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
216
|
+
def detect_detection_language(detect_language_request_object = nil, quota_user: nil, fields: nil, options: nil, &block)
|
217
|
+
command = make_simple_command(:post, 'v2/detect', options)
|
218
|
+
command.request_representation = Google::Apis::TranslateV2::DetectLanguageRequest::Representation
|
219
|
+
command.request_object = detect_language_request_object
|
220
|
+
command.response_representation = Google::Apis::TranslateV2::ListDetectionsResponse::Representation
|
221
|
+
command.response_class = Google::Apis::TranslateV2::ListDetectionsResponse
|
168
222
|
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
169
|
-
command.query['
|
223
|
+
command.query['fields'] = fields unless fields.nil?
|
170
224
|
execute_or_queue_command(command, &block)
|
171
225
|
end
|
172
226
|
|
@@ -175,7 +229,6 @@ module Google
|
|
175
229
|
def apply_command_defaults(command)
|
176
230
|
command.query['key'] = key unless key.nil?
|
177
231
|
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
178
|
-
command.query['userIp'] = user_ip unless user_ip.nil?
|
179
232
|
end
|
180
233
|
end
|
181
234
|
end
|
@@ -27,7 +27,7 @@ module Google
|
|
27
27
|
# @see https://cloud.google.com/vision/
|
28
28
|
module VisionV1
|
29
29
|
VERSION = 'V1'
|
30
|
-
REVISION = '
|
30
|
+
REVISION = '20170523'
|
31
31
|
|
32
32
|
# View and manage your data across Google Cloud Platform services
|
33
33
|
AUTH_CLOUD_PLATFORM = 'https://www.googleapis.com/auth/cloud-platform'
|
@@ -22,19 +22,25 @@ module Google
|
|
22
22
|
module Apis
|
23
23
|
module VisionV1
|
24
24
|
|
25
|
-
#
|
26
|
-
class
|
25
|
+
# Single crop hint that is used to generate a new crop when serving an image.
|
26
|
+
class CropHint
|
27
27
|
include Google::Apis::Core::Hashable
|
28
28
|
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
|
33
|
-
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
|
29
|
+
# Confidence of this being a salient region. Range [0, 1].
|
30
|
+
# Corresponds to the JSON property `confidence`
|
31
|
+
# @return [Float]
|
32
|
+
attr_accessor :confidence
|
33
|
+
|
34
|
+
# Fraction of importance of this salient region with respect to the original
|
35
|
+
# image.
|
36
|
+
# Corresponds to the JSON property `importanceFraction`
|
37
|
+
# @return [Float]
|
38
|
+
attr_accessor :importance_fraction
|
39
|
+
|
40
|
+
# A bounding polygon for the detected image annotation.
|
41
|
+
# Corresponds to the JSON property `boundingPoly`
|
42
|
+
# @return [Google::Apis::VisionV1::BoundingPoly]
|
43
|
+
attr_accessor :bounding_poly
|
38
44
|
|
39
45
|
def initialize(**args)
|
40
46
|
update!(**args)
|
@@ -42,33 +48,31 @@ module Google
|
|
42
48
|
|
43
49
|
# Update properties of this object
|
44
50
|
def update!(**args)
|
45
|
-
@
|
51
|
+
@confidence = args[:confidence] if args.key?(:confidence)
|
52
|
+
@importance_fraction = args[:importance_fraction] if args.key?(:importance_fraction)
|
53
|
+
@bounding_poly = args[:bounding_poly] if args.key?(:bounding_poly)
|
46
54
|
end
|
47
55
|
end
|
48
56
|
|
49
|
-
#
|
50
|
-
|
57
|
+
# A face-specific landmark (for example, a face feature).
|
58
|
+
# Landmark positions may fall outside the bounds of the image
|
59
|
+
# if the face is near one or more edges of the image.
|
60
|
+
# Therefore it is NOT guaranteed that `0 <= x < width` or
|
61
|
+
# `0 <= y < height`.
|
62
|
+
class Landmark
|
51
63
|
include Google::Apis::Core::Hashable
|
52
64
|
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
|
65
|
+
# A 3D position in the image, used primarily for Face detection landmarks.
|
66
|
+
# A valid Position must have both x and y coordinates.
|
67
|
+
# The position coordinates are in the same scale as the original image.
|
68
|
+
# Corresponds to the JSON property `position`
|
69
|
+
# @return [Google::Apis::VisionV1::Position]
|
70
|
+
attr_accessor :position
|
57
71
|
|
58
|
-
#
|
59
|
-
# Corresponds to the JSON property `
|
72
|
+
# Face landmark type.
|
73
|
+
# Corresponds to the JSON property `type`
|
60
74
|
# @return [String]
|
61
|
-
attr_accessor :
|
62
|
-
|
63
|
-
# A bounding polygon for the detected image annotation.
|
64
|
-
# Corresponds to the JSON property `boundingBox`
|
65
|
-
# @return [Google::Apis::VisionV1::BoundingPoly]
|
66
|
-
attr_accessor :bounding_box
|
67
|
-
|
68
|
-
# List of paragraphs in this block (if this blocks is of type text).
|
69
|
-
# Corresponds to the JSON property `paragraphs`
|
70
|
-
# @return [Array<Google::Apis::VisionV1::Paragraph>]
|
71
|
-
attr_accessor :paragraphs
|
75
|
+
attr_accessor :type
|
72
76
|
|
73
77
|
def initialize(**args)
|
74
78
|
update!(**args)
|
@@ -76,44 +80,25 @@ module Google
|
|
76
80
|
|
77
81
|
# Update properties of this object
|
78
82
|
def update!(**args)
|
79
|
-
@
|
80
|
-
@
|
81
|
-
@bounding_box = args[:bounding_box] if args.key?(:bounding_box)
|
82
|
-
@paragraphs = args[:paragraphs] if args.key?(:paragraphs)
|
83
|
+
@position = args[:position] if args.key?(:position)
|
84
|
+
@type = args[:type] if args.key?(:type)
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
86
|
-
#
|
87
|
-
class
|
88
|
+
# Metadata for online images.
|
89
|
+
class WebImage
|
88
90
|
include Google::Apis::Core::Hashable
|
89
91
|
|
90
|
-
#
|
91
|
-
#
|
92
|
-
# Corresponds to the JSON property `
|
93
|
-
# @return [
|
94
|
-
attr_accessor :
|
95
|
-
|
96
|
-
# Deduced entities from similar images on the Internet.
|
97
|
-
# Corresponds to the JSON property `webEntities`
|
98
|
-
# @return [Array<Google::Apis::VisionV1::WebEntity>]
|
99
|
-
attr_accessor :web_entities
|
100
|
-
|
101
|
-
# Web pages containing the matching images from the Internet.
|
102
|
-
# Corresponds to the JSON property `pagesWithMatchingImages`
|
103
|
-
# @return [Array<Google::Apis::VisionV1::WebPage>]
|
104
|
-
attr_accessor :pages_with_matching_images
|
105
|
-
|
106
|
-
# Partial matching images from the Internet.
|
107
|
-
# Those images are similar enough to share some key-point features. For
|
108
|
-
# example an original image will likely have partial matching for its crops.
|
109
|
-
# Corresponds to the JSON property `partialMatchingImages`
|
110
|
-
# @return [Array<Google::Apis::VisionV1::WebImage>]
|
111
|
-
attr_accessor :partial_matching_images
|
92
|
+
# Overall relevancy score for the image.
|
93
|
+
# Not normalized and not comparable across different image queries.
|
94
|
+
# Corresponds to the JSON property `score`
|
95
|
+
# @return [Float]
|
96
|
+
attr_accessor :score
|
112
97
|
|
113
|
-
# The
|
114
|
-
# Corresponds to the JSON property `
|
115
|
-
# @return [
|
116
|
-
attr_accessor :
|
98
|
+
# The result image URL.
|
99
|
+
# Corresponds to the JSON property `url`
|
100
|
+
# @return [String]
|
101
|
+
attr_accessor :url
|
117
102
|
|
118
103
|
def initialize(**args)
|
119
104
|
update!(**args)
|
@@ -121,22 +106,30 @@ module Google
|
|
121
106
|
|
122
107
|
# Update properties of this object
|
123
108
|
def update!(**args)
|
124
|
-
@
|
125
|
-
@
|
126
|
-
@pages_with_matching_images = args[:pages_with_matching_images] if args.key?(:pages_with_matching_images)
|
127
|
-
@partial_matching_images = args[:partial_matching_images] if args.key?(:partial_matching_images)
|
128
|
-
@visually_similar_images = args[:visually_similar_images] if args.key?(:visually_similar_images)
|
109
|
+
@score = args[:score] if args.key?(:score)
|
110
|
+
@url = args[:url] if args.key?(:url)
|
129
111
|
end
|
130
112
|
end
|
131
113
|
|
132
|
-
#
|
133
|
-
class
|
114
|
+
# A word representation.
|
115
|
+
class Word
|
134
116
|
include Google::Apis::Core::Hashable
|
135
117
|
|
136
|
-
#
|
137
|
-
# Corresponds to the JSON property `
|
138
|
-
# @return [
|
139
|
-
attr_accessor :
|
118
|
+
# A bounding polygon for the detected image annotation.
|
119
|
+
# Corresponds to the JSON property `boundingBox`
|
120
|
+
# @return [Google::Apis::VisionV1::BoundingPoly]
|
121
|
+
attr_accessor :bounding_box
|
122
|
+
|
123
|
+
# List of symbols in the word.
|
124
|
+
# The order of the symbols follows the natural reading order.
|
125
|
+
# Corresponds to the JSON property `symbols`
|
126
|
+
# @return [Array<Google::Apis::VisionV1::Symbol>]
|
127
|
+
attr_accessor :symbols
|
128
|
+
|
129
|
+
# Additional information detected on the structural component.
|
130
|
+
# Corresponds to the JSON property `property`
|
131
|
+
# @return [Google::Apis::VisionV1::TextProperty]
|
132
|
+
attr_accessor :property
|
140
133
|
|
141
134
|
def initialize(**args)
|
142
135
|
update!(**args)
|
@@ -144,28 +137,30 @@ module Google
|
|
144
137
|
|
145
138
|
# Update properties of this object
|
146
139
|
def update!(**args)
|
147
|
-
@
|
140
|
+
@bounding_box = args[:bounding_box] if args.key?(:bounding_box)
|
141
|
+
@symbols = args[:symbols] if args.key?(:symbols)
|
142
|
+
@property = args[:property] if args.key?(:property)
|
148
143
|
end
|
149
144
|
end
|
150
145
|
|
151
|
-
#
|
152
|
-
class
|
146
|
+
# Structural unit of text representing a number of words in certain order.
|
147
|
+
class Paragraph
|
153
148
|
include Google::Apis::Core::Hashable
|
154
149
|
|
155
|
-
#
|
156
|
-
# Corresponds to the JSON property `
|
157
|
-
# @return [
|
158
|
-
attr_accessor :
|
150
|
+
# A bounding polygon for the detected image annotation.
|
151
|
+
# Corresponds to the JSON property `boundingBox`
|
152
|
+
# @return [Google::Apis::VisionV1::BoundingPoly]
|
153
|
+
attr_accessor :bounding_box
|
159
154
|
|
160
|
-
#
|
161
|
-
# Corresponds to the JSON property `
|
162
|
-
# @return [
|
163
|
-
attr_accessor :
|
155
|
+
# List of words in this paragraph.
|
156
|
+
# Corresponds to the JSON property `words`
|
157
|
+
# @return [Array<Google::Apis::VisionV1::Word>]
|
158
|
+
attr_accessor :words
|
164
159
|
|
165
|
-
#
|
166
|
-
# Corresponds to the JSON property `
|
167
|
-
# @return [
|
168
|
-
attr_accessor :
|
160
|
+
# Additional information detected on the structural component.
|
161
|
+
# Corresponds to the JSON property `property`
|
162
|
+
# @return [Google::Apis::VisionV1::TextProperty]
|
163
|
+
attr_accessor :property
|
169
164
|
|
170
165
|
def initialize(**args)
|
171
166
|
update!(**args)
|
@@ -173,56 +168,28 @@ module Google
|
|
173
168
|
|
174
169
|
# Update properties of this object
|
175
170
|
def update!(**args)
|
176
|
-
@
|
177
|
-
@
|
178
|
-
@
|
171
|
+
@bounding_box = args[:bounding_box] if args.key?(:bounding_box)
|
172
|
+
@words = args[:words] if args.key?(:words)
|
173
|
+
@property = args[:property] if args.key?(:property)
|
179
174
|
end
|
180
175
|
end
|
181
176
|
|
182
|
-
#
|
183
|
-
class
|
177
|
+
# Client image to perform Google Cloud Vision API tasks over.
|
178
|
+
class Image
|
184
179
|
include Google::Apis::Core::Hashable
|
185
180
|
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
190
|
-
#
|
191
|
-
#
|
192
|
-
|
193
|
-
|
194
|
-
#
|
195
|
-
#
|
196
|
-
# return
|
197
|
-
|
198
|
-
# def NormalizeLatLng(latitude, longitude):
|
199
|
-
# """Wraps decimal degrees latitude and longitude to
|
200
|
-
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
201
|
-
# r = latitude % 360.0
|
202
|
-
# if r <= 90.0:
|
203
|
-
# return r, NormalizeLongitude(longitude)
|
204
|
-
# elif r >= 270.0:
|
205
|
-
# return r - 360, NormalizeLongitude(longitude)
|
206
|
-
# else:
|
207
|
-
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
208
|
-
# assert 180.0 == NormalizeLongitude(180.0)
|
209
|
-
# assert -180.0 == NormalizeLongitude(-180.0)
|
210
|
-
# assert -179.0 == NormalizeLongitude(181.0)
|
211
|
-
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
212
|
-
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
213
|
-
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
214
|
-
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
215
|
-
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
216
|
-
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
217
|
-
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
218
|
-
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
219
|
-
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
220
|
-
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
221
|
-
# The code in logs/storage/validator/logs_validator_traits.cc treats this type
|
222
|
-
# as if it were annotated as ST_LOCATION.
|
223
|
-
# Corresponds to the JSON property `latLng`
|
224
|
-
# @return [Google::Apis::VisionV1::LatLng]
|
225
|
-
attr_accessor :lat_lng
|
181
|
+
# Image content, represented as a stream of bytes.
|
182
|
+
# Note: as with all `bytes` fields, protobuffers use a pure binary
|
183
|
+
# representation, whereas JSON representations use base64.
|
184
|
+
# Corresponds to the JSON property `content`
|
185
|
+
# NOTE: Values are automatically base64 encoded/decoded in the client library.
|
186
|
+
# @return [String]
|
187
|
+
attr_accessor :content
|
188
|
+
|
189
|
+
# External image source (Google Cloud Storage image location).
|
190
|
+
# Corresponds to the JSON property `source`
|
191
|
+
# @return [Google::Apis::VisionV1::ImageSource]
|
192
|
+
attr_accessor :source
|
226
193
|
|
227
194
|
def initialize(**args)
|
228
195
|
update!(**args)
|
@@ -230,37 +197,94 @@ module Google
|
|
230
197
|
|
231
198
|
# Update properties of this object
|
232
199
|
def update!(**args)
|
233
|
-
@
|
200
|
+
@content = args[:content] if args.key?(:content)
|
201
|
+
@source = args[:source] if args.key?(:source)
|
234
202
|
end
|
235
203
|
end
|
236
204
|
|
237
|
-
#
|
238
|
-
class
|
205
|
+
# A face annotation object contains the results of face detection.
|
206
|
+
class FaceAnnotation
|
239
207
|
include Google::Apis::Core::Hashable
|
240
208
|
|
241
|
-
#
|
242
|
-
#
|
243
|
-
# `gs://bucket_name/object_name` (for details, see
|
244
|
-
# [Google Cloud Storage Request
|
245
|
-
# URIs](https://cloud.google.com/storage/docs/reference-uris)).
|
246
|
-
# NOTE: Cloud Storage object versioning is not supported.
|
247
|
-
# Corresponds to the JSON property `gcsImageUri`
|
209
|
+
# Sorrow likelihood.
|
210
|
+
# Corresponds to the JSON property `sorrowLikelihood`
|
248
211
|
# @return [String]
|
249
|
-
attr_accessor :
|
212
|
+
attr_accessor :sorrow_likelihood
|
250
213
|
|
251
|
-
#
|
252
|
-
#
|
253
|
-
#
|
254
|
-
# [
|
255
|
-
|
256
|
-
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
260
|
-
|
261
|
-
|
214
|
+
# Pitch angle, which indicates the upwards/downwards angle that the face is
|
215
|
+
# pointing relative to the image's horizontal plane. Range [-180,180].
|
216
|
+
# Corresponds to the JSON property `tiltAngle`
|
217
|
+
# @return [Float]
|
218
|
+
attr_accessor :tilt_angle
|
219
|
+
|
220
|
+
# A bounding polygon for the detected image annotation.
|
221
|
+
# Corresponds to the JSON property `fdBoundingPoly`
|
222
|
+
# @return [Google::Apis::VisionV1::BoundingPoly]
|
223
|
+
attr_accessor :fd_bounding_poly
|
224
|
+
|
225
|
+
# Surprise likelihood.
|
226
|
+
# Corresponds to the JSON property `surpriseLikelihood`
|
262
227
|
# @return [String]
|
263
|
-
attr_accessor :
|
228
|
+
attr_accessor :surprise_likelihood
|
229
|
+
|
230
|
+
# Detected face landmarks.
|
231
|
+
# Corresponds to the JSON property `landmarks`
|
232
|
+
# @return [Array<Google::Apis::VisionV1::Landmark>]
|
233
|
+
attr_accessor :landmarks
|
234
|
+
|
235
|
+
# Anger likelihood.
|
236
|
+
# Corresponds to the JSON property `angerLikelihood`
|
237
|
+
# @return [String]
|
238
|
+
attr_accessor :anger_likelihood
|
239
|
+
|
240
|
+
# Joy likelihood.
|
241
|
+
# Corresponds to the JSON property `joyLikelihood`
|
242
|
+
# @return [String]
|
243
|
+
attr_accessor :joy_likelihood
|
244
|
+
|
245
|
+
# Face landmarking confidence. Range [0, 1].
|
246
|
+
# Corresponds to the JSON property `landmarkingConfidence`
|
247
|
+
# @return [Float]
|
248
|
+
attr_accessor :landmarking_confidence
|
249
|
+
|
250
|
+
# Detection confidence. Range [0, 1].
|
251
|
+
# Corresponds to the JSON property `detectionConfidence`
|
252
|
+
# @return [Float]
|
253
|
+
attr_accessor :detection_confidence
|
254
|
+
|
255
|
+
# Yaw angle, which indicates the leftward/rightward angle that the face is
|
256
|
+
# pointing relative to the vertical plane perpendicular to the image. Range
|
257
|
+
# [-180,180].
|
258
|
+
# Corresponds to the JSON property `panAngle`
|
259
|
+
# @return [Float]
|
260
|
+
attr_accessor :pan_angle
|
261
|
+
|
262
|
+
# Under-exposed likelihood.
|
263
|
+
# Corresponds to the JSON property `underExposedLikelihood`
|
264
|
+
# @return [String]
|
265
|
+
attr_accessor :under_exposed_likelihood
|
266
|
+
|
267
|
+
# Blurred likelihood.
|
268
|
+
# Corresponds to the JSON property `blurredLikelihood`
|
269
|
+
# @return [String]
|
270
|
+
attr_accessor :blurred_likelihood
|
271
|
+
|
272
|
+
# Headwear likelihood.
|
273
|
+
# Corresponds to the JSON property `headwearLikelihood`
|
274
|
+
# @return [String]
|
275
|
+
attr_accessor :headwear_likelihood
|
276
|
+
|
277
|
+
# A bounding polygon for the detected image annotation.
|
278
|
+
# Corresponds to the JSON property `boundingPoly`
|
279
|
+
# @return [Google::Apis::VisionV1::BoundingPoly]
|
280
|
+
attr_accessor :bounding_poly
|
281
|
+
|
282
|
+
# Roll angle, which indicates the amount of clockwise/anti-clockwise rotation
|
283
|
+
# of the face relative to the image vertical about the axis perpendicular to
|
284
|
+
# the face. Range [-180,180].
|
285
|
+
# Corresponds to the JSON property `rollAngle`
|
286
|
+
# @return [Float]
|
287
|
+
attr_accessor :roll_angle
|
264
288
|
|
265
289
|
def initialize(**args)
|
266
290
|
update!(**args)
|
@@ -268,31 +292,57 @@ module Google
|
|
268
292
|
|
269
293
|
# Update properties of this object
|
270
294
|
def update!(**args)
|
271
|
-
@
|
272
|
-
@
|
295
|
+
@sorrow_likelihood = args[:sorrow_likelihood] if args.key?(:sorrow_likelihood)
|
296
|
+
@tilt_angle = args[:tilt_angle] if args.key?(:tilt_angle)
|
297
|
+
@fd_bounding_poly = args[:fd_bounding_poly] if args.key?(:fd_bounding_poly)
|
298
|
+
@surprise_likelihood = args[:surprise_likelihood] if args.key?(:surprise_likelihood)
|
299
|
+
@landmarks = args[:landmarks] if args.key?(:landmarks)
|
300
|
+
@anger_likelihood = args[:anger_likelihood] if args.key?(:anger_likelihood)
|
301
|
+
@joy_likelihood = args[:joy_likelihood] if args.key?(:joy_likelihood)
|
302
|
+
@landmarking_confidence = args[:landmarking_confidence] if args.key?(:landmarking_confidence)
|
303
|
+
@detection_confidence = args[:detection_confidence] if args.key?(:detection_confidence)
|
304
|
+
@pan_angle = args[:pan_angle] if args.key?(:pan_angle)
|
305
|
+
@under_exposed_likelihood = args[:under_exposed_likelihood] if args.key?(:under_exposed_likelihood)
|
306
|
+
@blurred_likelihood = args[:blurred_likelihood] if args.key?(:blurred_likelihood)
|
307
|
+
@headwear_likelihood = args[:headwear_likelihood] if args.key?(:headwear_likelihood)
|
308
|
+
@bounding_poly = args[:bounding_poly] if args.key?(:bounding_poly)
|
309
|
+
@roll_angle = args[:roll_angle] if args.key?(:roll_angle)
|
273
310
|
end
|
274
311
|
end
|
275
312
|
|
276
|
-
#
|
277
|
-
|
278
|
-
# The position coordinates are in the same scale as the original image.
|
279
|
-
class Position
|
313
|
+
# Multiple image annotation requests are batched into a single service call.
|
314
|
+
class BatchAnnotateImagesRequest
|
280
315
|
include Google::Apis::Core::Hashable
|
281
316
|
|
282
|
-
#
|
283
|
-
# Corresponds to the JSON property `
|
284
|
-
# @return [
|
285
|
-
attr_accessor :
|
317
|
+
# Individual image annotation requests for this batch.
|
318
|
+
# Corresponds to the JSON property `requests`
|
319
|
+
# @return [Array<Google::Apis::VisionV1::AnnotateImageRequest>]
|
320
|
+
attr_accessor :requests
|
286
321
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
attr_accessor :x
|
322
|
+
def initialize(**args)
|
323
|
+
update!(**args)
|
324
|
+
end
|
291
325
|
|
292
|
-
#
|
293
|
-
|
294
|
-
|
295
|
-
|
326
|
+
# Update properties of this object
|
327
|
+
def update!(**args)
|
328
|
+
@requests = args[:requests] if args.key?(:requests)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
# Detected start or end of a structural component.
|
333
|
+
class DetectedBreak
|
334
|
+
include Google::Apis::Core::Hashable
|
335
|
+
|
336
|
+
# True if break prepends the element.
|
337
|
+
# Corresponds to the JSON property `isPrefix`
|
338
|
+
# @return [Boolean]
|
339
|
+
attr_accessor :is_prefix
|
340
|
+
alias_method :is_prefix?, :is_prefix
|
341
|
+
|
342
|
+
# Detected break type.
|
343
|
+
# Corresponds to the JSON property `type`
|
344
|
+
# @return [String]
|
345
|
+
attr_accessor :type
|
296
346
|
|
297
347
|
def initialize(**args)
|
298
348
|
update!(**args)
|
@@ -300,26 +350,36 @@ module Google
|
|
300
350
|
|
301
351
|
# Update properties of this object
|
302
352
|
def update!(**args)
|
303
|
-
@
|
304
|
-
@
|
305
|
-
@z = args[:z] if args.key?(:z)
|
353
|
+
@is_prefix = args[:is_prefix] if args.key?(:is_prefix)
|
354
|
+
@type = args[:type] if args.key?(:type)
|
306
355
|
end
|
307
356
|
end
|
308
357
|
|
309
|
-
#
|
310
|
-
class
|
358
|
+
# Image context and/or feature-specific parameters.
|
359
|
+
class ImageContext
|
311
360
|
include Google::Apis::Core::Hashable
|
312
361
|
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
|
317
|
-
attr_accessor :score
|
362
|
+
# Rectangle determined by min and max `LatLng` pairs.
|
363
|
+
# Corresponds to the JSON property `latLongRect`
|
364
|
+
# @return [Google::Apis::VisionV1::LatLongRect]
|
365
|
+
attr_accessor :lat_long_rect
|
318
366
|
|
319
|
-
#
|
320
|
-
# Corresponds to the JSON property `
|
321
|
-
# @return [
|
322
|
-
attr_accessor :
|
367
|
+
# Parameters for crop hints annotation request.
|
368
|
+
# Corresponds to the JSON property `cropHintsParams`
|
369
|
+
# @return [Google::Apis::VisionV1::CropHintsParams]
|
370
|
+
attr_accessor :crop_hints_params
|
371
|
+
|
372
|
+
# List of languages to use for TEXT_DETECTION. In most cases, an empty value
|
373
|
+
# yields the best results since it enables automatic language detection. For
|
374
|
+
# languages based on the Latin alphabet, setting `language_hints` is not
|
375
|
+
# needed. In rare cases, when the language of the text in the image is known,
|
376
|
+
# setting a hint will help get better results (although it will be a
|
377
|
+
# significant hindrance if the hint is wrong). Text detection returns an
|
378
|
+
# error if one or more of the specified languages is not one of the
|
379
|
+
# [supported languages](/vision/docs/languages).
|
380
|
+
# Corresponds to the JSON property `languageHints`
|
381
|
+
# @return [Array<String>]
|
382
|
+
attr_accessor :language_hints
|
323
383
|
|
324
384
|
def initialize(**args)
|
325
385
|
update!(**args)
|
@@ -327,129 +387,35 @@ module Google
|
|
327
387
|
|
328
388
|
# Update properties of this object
|
329
389
|
def update!(**args)
|
330
|
-
@
|
331
|
-
@
|
390
|
+
@lat_long_rect = args[:lat_long_rect] if args.key?(:lat_long_rect)
|
391
|
+
@crop_hints_params = args[:crop_hints_params] if args.key?(:crop_hints_params)
|
392
|
+
@language_hints = args[:language_hints] if args.key?(:language_hints)
|
332
393
|
end
|
333
394
|
end
|
334
395
|
|
335
|
-
#
|
336
|
-
|
337
|
-
class ColorInfo
|
396
|
+
# Detected page from OCR.
|
397
|
+
class Page
|
338
398
|
include Google::Apis::Core::Hashable
|
339
399
|
|
340
|
-
#
|
341
|
-
# Corresponds to the JSON property `
|
342
|
-
# @return [
|
343
|
-
attr_accessor :
|
400
|
+
# Page width in pixels.
|
401
|
+
# Corresponds to the JSON property `width`
|
402
|
+
# @return [Fixnum]
|
403
|
+
attr_accessor :width
|
344
404
|
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
|
349
|
-
attr_accessor :pixel_fraction
|
405
|
+
# List of blocks of text, images etc on this page.
|
406
|
+
# Corresponds to the JSON property `blocks`
|
407
|
+
# @return [Array<Google::Apis::VisionV1::Block>]
|
408
|
+
attr_accessor :blocks
|
350
409
|
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
354
|
-
|
355
|
-
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
|
360
|
-
# // ...
|
361
|
-
# public static java.awt.Color fromProto(Color protocolor) `
|
362
|
-
# float alpha = protocolor.hasAlpha()
|
363
|
-
# ? protocolor.getAlpha().getValue()
|
364
|
-
# : 1.0;
|
365
|
-
# return new java.awt.Color(
|
366
|
-
# protocolor.getRed(),
|
367
|
-
# protocolor.getGreen(),
|
368
|
-
# protocolor.getBlue(),
|
369
|
-
# alpha);
|
370
|
-
# `
|
371
|
-
# public static Color toProto(java.awt.Color color) `
|
372
|
-
# float red = (float) color.getRed();
|
373
|
-
# float green = (float) color.getGreen();
|
374
|
-
# float blue = (float) color.getBlue();
|
375
|
-
# float denominator = 255.0;
|
376
|
-
# Color.Builder resultBuilder =
|
377
|
-
# Color
|
378
|
-
# .newBuilder()
|
379
|
-
# .setRed(red / denominator)
|
380
|
-
# .setGreen(green / denominator)
|
381
|
-
# .setBlue(blue / denominator);
|
382
|
-
# int alpha = color.getAlpha();
|
383
|
-
# if (alpha != 255) `
|
384
|
-
# result.setAlpha(
|
385
|
-
# FloatValue
|
386
|
-
# .newBuilder()
|
387
|
-
# .setValue(((float) alpha) / denominator)
|
388
|
-
# .build());
|
389
|
-
# `
|
390
|
-
# return resultBuilder.build();
|
391
|
-
# `
|
392
|
-
# // ...
|
393
|
-
# Example (iOS / Obj-C):
|
394
|
-
# // ...
|
395
|
-
# static UIColor* fromProto(Color* protocolor) `
|
396
|
-
# float red = [protocolor red];
|
397
|
-
# float green = [protocolor green];
|
398
|
-
# float blue = [protocolor blue];
|
399
|
-
# FloatValue* alpha_wrapper = [protocolor alpha];
|
400
|
-
# float alpha = 1.0;
|
401
|
-
# if (alpha_wrapper != nil) `
|
402
|
-
# alpha = [alpha_wrapper value];
|
403
|
-
# `
|
404
|
-
# return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
|
405
|
-
# `
|
406
|
-
# static Color* toProto(UIColor* color) `
|
407
|
-
# CGFloat red, green, blue, alpha;
|
408
|
-
# if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) `
|
409
|
-
# return nil;
|
410
|
-
# `
|
411
|
-
# Color* result = [Color alloc] init];
|
412
|
-
# [result setRed:red];
|
413
|
-
# [result setGreen:green];
|
414
|
-
# [result setBlue:blue];
|
415
|
-
# if (alpha <= 0.9999) `
|
416
|
-
# [result setAlpha:floatWrapperWithValue(alpha)];
|
417
|
-
# `
|
418
|
-
# [result autorelease];
|
419
|
-
# return result;
|
420
|
-
# `
|
421
|
-
# // ...
|
422
|
-
# Example (JavaScript):
|
423
|
-
# // ...
|
424
|
-
# var protoToCssColor = function(rgb_color) `
|
425
|
-
# var redFrac = rgb_color.red || 0.0;
|
426
|
-
# var greenFrac = rgb_color.green || 0.0;
|
427
|
-
# var blueFrac = rgb_color.blue || 0.0;
|
428
|
-
# var red = Math.floor(redFrac * 255);
|
429
|
-
# var green = Math.floor(greenFrac * 255);
|
430
|
-
# var blue = Math.floor(blueFrac * 255);
|
431
|
-
# if (!('alpha' in rgb_color)) `
|
432
|
-
# return rgbToCssColor_(red, green, blue);
|
433
|
-
# `
|
434
|
-
# var alphaFrac = rgb_color.alpha.value || 0.0;
|
435
|
-
# var rgbParams = [red, green, blue].join(',');
|
436
|
-
# return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
|
437
|
-
# `;
|
438
|
-
# var rgbToCssColor_ = function(red, green, blue) `
|
439
|
-
# var rgbNumber = new Number((red << 16) | (green << 8) | blue);
|
440
|
-
# var hexString = rgbNumber.toString(16);
|
441
|
-
# var missingZeros = 6 - hexString.length;
|
442
|
-
# var resultBuilder = ['#'];
|
443
|
-
# for (var i = 0; i < missingZeros; i++) `
|
444
|
-
# resultBuilder.push('0');
|
445
|
-
# `
|
446
|
-
# resultBuilder.push(hexString);
|
447
|
-
# return resultBuilder.join('');
|
448
|
-
# `;
|
449
|
-
# // ...
|
450
|
-
# Corresponds to the JSON property `color`
|
451
|
-
# @return [Google::Apis::VisionV1::Color]
|
452
|
-
attr_accessor :color
|
410
|
+
# Additional information detected on the structural component.
|
411
|
+
# Corresponds to the JSON property `property`
|
412
|
+
# @return [Google::Apis::VisionV1::TextProperty]
|
413
|
+
attr_accessor :property
|
414
|
+
|
415
|
+
# Page height in pixels.
|
416
|
+
# Corresponds to the JSON property `height`
|
417
|
+
# @return [Fixnum]
|
418
|
+
attr_accessor :height
|
453
419
|
|
454
420
|
def initialize(**args)
|
455
421
|
update!(**args)
|
@@ -457,75 +423,104 @@ module Google
|
|
457
423
|
|
458
424
|
# Update properties of this object
|
459
425
|
def update!(**args)
|
460
|
-
@
|
461
|
-
@
|
462
|
-
@
|
426
|
+
@width = args[:width] if args.key?(:width)
|
427
|
+
@blocks = args[:blocks] if args.key?(:blocks)
|
428
|
+
@property = args[:property] if args.key?(:property)
|
429
|
+
@height = args[:height] if args.key?(:height)
|
463
430
|
end
|
464
431
|
end
|
465
432
|
|
466
|
-
#
|
467
|
-
|
433
|
+
# Request for performing Google Cloud Vision API tasks over a user-provided
|
434
|
+
# image, with user-requested features.
|
435
|
+
class AnnotateImageRequest
|
468
436
|
include Google::Apis::Core::Hashable
|
469
437
|
|
470
|
-
#
|
471
|
-
# Corresponds to the JSON property `
|
472
|
-
# @return [
|
473
|
-
attr_accessor :
|
438
|
+
# Client image to perform Google Cloud Vision API tasks over.
|
439
|
+
# Corresponds to the JSON property `image`
|
440
|
+
# @return [Google::Apis::VisionV1::Image]
|
441
|
+
attr_accessor :image
|
474
442
|
|
475
|
-
#
|
476
|
-
#
|
477
|
-
#
|
478
|
-
|
479
|
-
# Location information is usually present for landmarks.
|
480
|
-
# Corresponds to the JSON property `locations`
|
481
|
-
# @return [Array<Google::Apis::VisionV1::LocationInfo>]
|
482
|
-
attr_accessor :locations
|
443
|
+
# Requested features.
|
444
|
+
# Corresponds to the JSON property `features`
|
445
|
+
# @return [Array<Google::Apis::VisionV1::Feature>]
|
446
|
+
attr_accessor :features
|
483
447
|
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
487
|
-
|
488
|
-
# @return [String]
|
489
|
-
attr_accessor :mid
|
448
|
+
# Image context and/or feature-specific parameters.
|
449
|
+
# Corresponds to the JSON property `imageContext`
|
450
|
+
# @return [Google::Apis::VisionV1::ImageContext]
|
451
|
+
attr_accessor :image_context
|
490
452
|
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
# image. Range [0, 1].
|
495
|
-
# Corresponds to the JSON property `confidence`
|
496
|
-
# @return [Float]
|
497
|
-
attr_accessor :confidence
|
453
|
+
def initialize(**args)
|
454
|
+
update!(**args)
|
455
|
+
end
|
498
456
|
|
499
|
-
#
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
457
|
+
# Update properties of this object
|
458
|
+
def update!(**args)
|
459
|
+
@image = args[:image] if args.key?(:image)
|
460
|
+
@features = args[:features] if args.key?(:features)
|
461
|
+
@image_context = args[:image_context] if args.key?(:image_context)
|
462
|
+
end
|
463
|
+
end
|
504
464
|
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
465
|
+
# The `Status` type defines a logical error model that is suitable for different
|
466
|
+
# programming environments, including REST APIs and RPC APIs. It is used by
|
467
|
+
# [gRPC](https://github.com/grpc). The error model is designed to be:
|
468
|
+
# - Simple to use and understand for most users
|
469
|
+
# - Flexible enough to meet unexpected needs
|
470
|
+
# # Overview
|
471
|
+
# The `Status` message contains three pieces of data: error code, error message,
|
472
|
+
# and error details. The error code should be an enum value of
|
473
|
+
# google.rpc.Code, but it may accept additional error codes if needed. The
|
474
|
+
# error message should be a developer-facing English message that helps
|
475
|
+
# developers *understand* and *resolve* the error. If a localized user-facing
|
476
|
+
# error message is needed, put the localized message in the error details or
|
477
|
+
# localize it in the client. The optional error details may contain arbitrary
|
478
|
+
# information about the error. There is a predefined set of error detail types
|
479
|
+
# in the package `google.rpc` that can be used for common error conditions.
|
480
|
+
# # Language mapping
|
481
|
+
# The `Status` message is the logical representation of the error model, but it
|
482
|
+
# is not necessarily the actual wire format. When the `Status` message is
|
483
|
+
# exposed in different client libraries and different wire protocols, it can be
|
484
|
+
# mapped differently. For example, it will likely be mapped to some exceptions
|
485
|
+
# in Java, but more likely mapped to some error codes in C.
|
486
|
+
# # Other uses
|
487
|
+
# The error model and the `Status` message can be used in a variety of
|
488
|
+
# environments, either with or without APIs, to provide a
|
489
|
+
# consistent developer experience across different environments.
|
490
|
+
# Example uses of this error model include:
|
491
|
+
# - Partial errors. If a service needs to return partial errors to the client,
|
492
|
+
# it may embed the `Status` in the normal response to indicate the partial
|
493
|
+
# errors.
|
494
|
+
# - Workflow errors. A typical workflow has multiple steps. Each step may
|
495
|
+
# have a `Status` message for error reporting.
|
496
|
+
# - Batch operations. If a client uses batch request and batch response, the
|
497
|
+
# `Status` message should be used directly inside batch response, one for
|
498
|
+
# each error sub-response.
|
499
|
+
# - Asynchronous operations. If an API call embeds asynchronous operation
|
500
|
+
# results in its response, the status of those operations should be
|
501
|
+
# represented directly using the `Status` message.
|
502
|
+
# - Logging. If some API errors are stored in logs, the message `Status` could
|
503
|
+
# be used directly after any stripping needed for security/privacy reasons.
|
504
|
+
class Status
|
505
|
+
include Google::Apis::Core::Hashable
|
509
506
|
|
510
|
-
#
|
511
|
-
#
|
512
|
-
#
|
513
|
-
#
|
514
|
-
|
515
|
-
# Corresponds to the JSON property `topicality`
|
516
|
-
# @return [Float]
|
517
|
-
attr_accessor :topicality
|
507
|
+
# A list of messages that carry the error details. There will be a
|
508
|
+
# common set of message types for APIs to use.
|
509
|
+
# Corresponds to the JSON property `details`
|
510
|
+
# @return [Array<Hash<String,Object>>]
|
511
|
+
attr_accessor :details
|
518
512
|
|
519
|
-
#
|
520
|
-
# Corresponds to the JSON property `
|
521
|
-
# @return [
|
522
|
-
attr_accessor :
|
513
|
+
# The status code, which should be an enum value of google.rpc.Code.
|
514
|
+
# Corresponds to the JSON property `code`
|
515
|
+
# @return [Fixnum]
|
516
|
+
attr_accessor :code
|
523
517
|
|
524
|
-
#
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
528
|
-
|
518
|
+
# A developer-facing error message, which should be in English. Any
|
519
|
+
# user-facing error message should be localized and sent in the
|
520
|
+
# google.rpc.Status.details field, or localized by the client.
|
521
|
+
# Corresponds to the JSON property `message`
|
522
|
+
# @return [String]
|
523
|
+
attr_accessor :message
|
529
524
|
|
530
525
|
def initialize(**args)
|
531
526
|
update!(**args)
|
@@ -533,37 +528,30 @@ module Google
|
|
533
528
|
|
534
529
|
# Update properties of this object
|
535
530
|
def update!(**args)
|
536
|
-
@
|
537
|
-
@
|
538
|
-
@
|
539
|
-
@confidence = args[:confidence] if args.key?(:confidence)
|
540
|
-
@locale = args[:locale] if args.key?(:locale)
|
541
|
-
@bounding_poly = args[:bounding_poly] if args.key?(:bounding_poly)
|
542
|
-
@topicality = args[:topicality] if args.key?(:topicality)
|
543
|
-
@description = args[:description] if args.key?(:description)
|
544
|
-
@properties = args[:properties] if args.key?(:properties)
|
531
|
+
@details = args[:details] if args.key?(:details)
|
532
|
+
@code = args[:code] if args.key?(:code)
|
533
|
+
@message = args[:message] if args.key?(:message)
|
545
534
|
end
|
546
535
|
end
|
547
536
|
|
548
|
-
#
|
549
|
-
class
|
537
|
+
# A single symbol representation.
|
538
|
+
class Symbol
|
550
539
|
include Google::Apis::Core::Hashable
|
551
540
|
|
552
|
-
# Confidence of this being a salient region. Range [0, 1].
|
553
|
-
# Corresponds to the JSON property `confidence`
|
554
|
-
# @return [Float]
|
555
|
-
attr_accessor :confidence
|
556
|
-
|
557
|
-
# Fraction of importance of this salient region with respect to the original
|
558
|
-
# image.
|
559
|
-
# Corresponds to the JSON property `importanceFraction`
|
560
|
-
# @return [Float]
|
561
|
-
attr_accessor :importance_fraction
|
562
|
-
|
563
541
|
# A bounding polygon for the detected image annotation.
|
564
|
-
# Corresponds to the JSON property `
|
542
|
+
# Corresponds to the JSON property `boundingBox`
|
565
543
|
# @return [Google::Apis::VisionV1::BoundingPoly]
|
566
|
-
attr_accessor :
|
544
|
+
attr_accessor :bounding_box
|
545
|
+
|
546
|
+
# The actual UTF-8 representation of the symbol.
|
547
|
+
# Corresponds to the JSON property `text`
|
548
|
+
# @return [String]
|
549
|
+
attr_accessor :text
|
550
|
+
|
551
|
+
# Additional information detected on the structural component.
|
552
|
+
# Corresponds to the JSON property `property`
|
553
|
+
# @return [Google::Apis::VisionV1::TextProperty]
|
554
|
+
attr_accessor :property
|
567
555
|
|
568
556
|
def initialize(**args)
|
569
557
|
update!(**args)
|
@@ -571,88 +559,93 @@ module Google
|
|
571
559
|
|
572
560
|
# Update properties of this object
|
573
561
|
def update!(**args)
|
574
|
-
@
|
575
|
-
@
|
576
|
-
@
|
562
|
+
@bounding_box = args[:bounding_box] if args.key?(:bounding_box)
|
563
|
+
@text = args[:text] if args.key?(:text)
|
564
|
+
@property = args[:property] if args.key?(:property)
|
577
565
|
end
|
578
566
|
end
|
579
567
|
|
580
|
-
#
|
581
|
-
|
582
|
-
# if the face is near one or more edges of the image.
|
583
|
-
# Therefore it is NOT guaranteed that `0 <= x < width` or
|
584
|
-
# `0 <= y < height`.
|
585
|
-
class Landmark
|
568
|
+
# Rectangle determined by min and max `LatLng` pairs.
|
569
|
+
class LatLongRect
|
586
570
|
include Google::Apis::Core::Hashable
|
587
571
|
|
588
|
-
#
|
589
|
-
#
|
590
|
-
#
|
591
|
-
|
592
|
-
|
593
|
-
#
|
594
|
-
#
|
595
|
-
#
|
596
|
-
#
|
597
|
-
#
|
598
|
-
|
599
|
-
|
600
|
-
def
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
#
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
#
|
616
|
-
#
|
617
|
-
#
|
618
|
-
#
|
619
|
-
|
620
|
-
|
621
|
-
#
|
622
|
-
#
|
623
|
-
#
|
624
|
-
|
625
|
-
|
626
|
-
def initialize(**args)
|
627
|
-
update!(**args)
|
628
|
-
end
|
629
|
-
|
630
|
-
# Update properties of this object
|
631
|
-
def update!(**args)
|
632
|
-
@score = args[:score] if args.key?(:score)
|
633
|
-
@url = args[:url] if args.key?(:url)
|
634
|
-
end
|
635
|
-
end
|
636
|
-
|
637
|
-
# A word representation.
|
638
|
-
class Word
|
639
|
-
include Google::Apis::Core::Hashable
|
640
|
-
|
641
|
-
# List of symbols in the word.
|
642
|
-
# The order of the symbols follows the natural reading order.
|
643
|
-
# Corresponds to the JSON property `symbols`
|
644
|
-
# @return [Array<Google::Apis::VisionV1::Symbol>]
|
645
|
-
attr_accessor :symbols
|
646
|
-
|
647
|
-
# Additional information detected on the structural component.
|
648
|
-
# Corresponds to the JSON property `property`
|
649
|
-
# @return [Google::Apis::VisionV1::TextProperty]
|
650
|
-
attr_accessor :property
|
572
|
+
# An object representing a latitude/longitude pair. This is expressed as a pair
|
573
|
+
# of doubles representing degrees latitude and degrees longitude. Unless
|
574
|
+
# specified otherwise, this must conform to the
|
575
|
+
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
|
576
|
+
# standard</a>. Values must be within normalized ranges.
|
577
|
+
# Example of normalization code in Python:
|
578
|
+
# def NormalizeLongitude(longitude):
|
579
|
+
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
580
|
+
# q, r = divmod(longitude, 360.0)
|
581
|
+
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
582
|
+
# return r - 360.0
|
583
|
+
# return r
|
584
|
+
# def NormalizeLatLng(latitude, longitude):
|
585
|
+
# """Wraps decimal degrees latitude and longitude to
|
586
|
+
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
587
|
+
# r = latitude % 360.0
|
588
|
+
# if r <= 90.0:
|
589
|
+
# return r, NormalizeLongitude(longitude)
|
590
|
+
# elif r >= 270.0:
|
591
|
+
# return r - 360, NormalizeLongitude(longitude)
|
592
|
+
# else:
|
593
|
+
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
594
|
+
# assert 180.0 == NormalizeLongitude(180.0)
|
595
|
+
# assert -180.0 == NormalizeLongitude(-180.0)
|
596
|
+
# assert -179.0 == NormalizeLongitude(181.0)
|
597
|
+
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
598
|
+
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
599
|
+
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
600
|
+
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
601
|
+
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
602
|
+
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
603
|
+
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
604
|
+
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
605
|
+
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
606
|
+
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
607
|
+
# Corresponds to the JSON property `minLatLng`
|
608
|
+
# @return [Google::Apis::VisionV1::LatLng]
|
609
|
+
attr_accessor :min_lat_lng
|
651
610
|
|
652
|
-
#
|
653
|
-
#
|
654
|
-
#
|
655
|
-
|
611
|
+
# An object representing a latitude/longitude pair. This is expressed as a pair
|
612
|
+
# of doubles representing degrees latitude and degrees longitude. Unless
|
613
|
+
# specified otherwise, this must conform to the
|
614
|
+
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
|
615
|
+
# standard</a>. Values must be within normalized ranges.
|
616
|
+
# Example of normalization code in Python:
|
617
|
+
# def NormalizeLongitude(longitude):
|
618
|
+
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
619
|
+
# q, r = divmod(longitude, 360.0)
|
620
|
+
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
621
|
+
# return r - 360.0
|
622
|
+
# return r
|
623
|
+
# def NormalizeLatLng(latitude, longitude):
|
624
|
+
# """Wraps decimal degrees latitude and longitude to
|
625
|
+
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
626
|
+
# r = latitude % 360.0
|
627
|
+
# if r <= 90.0:
|
628
|
+
# return r, NormalizeLongitude(longitude)
|
629
|
+
# elif r >= 270.0:
|
630
|
+
# return r - 360, NormalizeLongitude(longitude)
|
631
|
+
# else:
|
632
|
+
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
633
|
+
# assert 180.0 == NormalizeLongitude(180.0)
|
634
|
+
# assert -180.0 == NormalizeLongitude(-180.0)
|
635
|
+
# assert -179.0 == NormalizeLongitude(181.0)
|
636
|
+
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
637
|
+
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
638
|
+
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
639
|
+
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
640
|
+
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
641
|
+
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
642
|
+
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
643
|
+
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
644
|
+
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
645
|
+
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
646
|
+
# Corresponds to the JSON property `maxLatLng`
|
647
|
+
# @return [Google::Apis::VisionV1::LatLng]
|
648
|
+
attr_accessor :max_lat_lng
|
656
649
|
|
657
650
|
def initialize(**args)
|
658
651
|
update!(**args)
|
@@ -660,28 +653,19 @@ module Google
|
|
660
653
|
|
661
654
|
# Update properties of this object
|
662
655
|
def update!(**args)
|
663
|
-
@
|
664
|
-
@
|
665
|
-
@bounding_box = args[:bounding_box] if args.key?(:bounding_box)
|
656
|
+
@min_lat_lng = args[:min_lat_lng] if args.key?(:min_lat_lng)
|
657
|
+
@max_lat_lng = args[:max_lat_lng] if args.key?(:max_lat_lng)
|
666
658
|
end
|
667
659
|
end
|
668
660
|
|
669
|
-
#
|
670
|
-
class
|
661
|
+
# Set of crop hints that are used to generate new crops when serving images.
|
662
|
+
class CropHintsAnnotation
|
671
663
|
include Google::Apis::Core::Hashable
|
672
664
|
|
673
|
-
#
|
674
|
-
#
|
675
|
-
#
|
676
|
-
|
677
|
-
# NOTE: Values are automatically base64 encoded/decoded in the client library.
|
678
|
-
# @return [String]
|
679
|
-
attr_accessor :content
|
680
|
-
|
681
|
-
# External image source (Google Cloud Storage image location).
|
682
|
-
# Corresponds to the JSON property `source`
|
683
|
-
# @return [Google::Apis::VisionV1::ImageSource]
|
684
|
-
attr_accessor :source
|
665
|
+
# Crop hint results.
|
666
|
+
# Corresponds to the JSON property `cropHints`
|
667
|
+
# @return [Array<Google::Apis::VisionV1::CropHint>]
|
668
|
+
attr_accessor :crop_hints
|
685
669
|
|
686
670
|
def initialize(**args)
|
687
671
|
update!(**args)
|
@@ -689,29 +673,57 @@ module Google
|
|
689
673
|
|
690
674
|
# Update properties of this object
|
691
675
|
def update!(**args)
|
692
|
-
@
|
693
|
-
@source = args[:source] if args.key?(:source)
|
676
|
+
@crop_hints = args[:crop_hints] if args.key?(:crop_hints)
|
694
677
|
end
|
695
678
|
end
|
696
679
|
|
697
|
-
#
|
698
|
-
|
680
|
+
# An object representing a latitude/longitude pair. This is expressed as a pair
|
681
|
+
# of doubles representing degrees latitude and degrees longitude. Unless
|
682
|
+
# specified otherwise, this must conform to the
|
683
|
+
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
|
684
|
+
# standard</a>. Values must be within normalized ranges.
|
685
|
+
# Example of normalization code in Python:
|
686
|
+
# def NormalizeLongitude(longitude):
|
687
|
+
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
688
|
+
# q, r = divmod(longitude, 360.0)
|
689
|
+
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
690
|
+
# return r - 360.0
|
691
|
+
# return r
|
692
|
+
# def NormalizeLatLng(latitude, longitude):
|
693
|
+
# """Wraps decimal degrees latitude and longitude to
|
694
|
+
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
695
|
+
# r = latitude % 360.0
|
696
|
+
# if r <= 90.0:
|
697
|
+
# return r, NormalizeLongitude(longitude)
|
698
|
+
# elif r >= 270.0:
|
699
|
+
# return r - 360, NormalizeLongitude(longitude)
|
700
|
+
# else:
|
701
|
+
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
702
|
+
# assert 180.0 == NormalizeLongitude(180.0)
|
703
|
+
# assert -180.0 == NormalizeLongitude(-180.0)
|
704
|
+
# assert -179.0 == NormalizeLongitude(181.0)
|
705
|
+
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
706
|
+
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
707
|
+
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
708
|
+
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
709
|
+
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
710
|
+
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
711
|
+
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
712
|
+
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
713
|
+
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
714
|
+
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
715
|
+
class LatLng
|
699
716
|
include Google::Apis::Core::Hashable
|
700
717
|
|
701
|
-
#
|
702
|
-
# Corresponds to the JSON property `
|
703
|
-
# @return [
|
704
|
-
attr_accessor :
|
705
|
-
|
706
|
-
# A bounding polygon for the detected image annotation.
|
707
|
-
# Corresponds to the JSON property `boundingBox`
|
708
|
-
# @return [Google::Apis::VisionV1::BoundingPoly]
|
709
|
-
attr_accessor :bounding_box
|
718
|
+
# The longitude in degrees. It must be in the range [-180.0, +180.0].
|
719
|
+
# Corresponds to the JSON property `longitude`
|
720
|
+
# @return [Float]
|
721
|
+
attr_accessor :longitude
|
710
722
|
|
711
|
-
#
|
712
|
-
# Corresponds to the JSON property `
|
713
|
-
# @return [
|
714
|
-
attr_accessor :
|
723
|
+
# The latitude in degrees. It must be in the range [-90.0, +90.0].
|
724
|
+
# Corresponds to the JSON property `latitude`
|
725
|
+
# @return [Float]
|
726
|
+
attr_accessor :latitude
|
715
727
|
|
716
728
|
def initialize(**args)
|
717
729
|
update!(**args)
|
@@ -719,95 +731,140 @@ module Google
|
|
719
731
|
|
720
732
|
# Update properties of this object
|
721
733
|
def update!(**args)
|
722
|
-
@
|
723
|
-
@
|
724
|
-
@words = args[:words] if args.key?(:words)
|
734
|
+
@longitude = args[:longitude] if args.key?(:longitude)
|
735
|
+
@latitude = args[:latitude] if args.key?(:latitude)
|
725
736
|
end
|
726
737
|
end
|
727
738
|
|
728
|
-
#
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
739
|
+
# Represents a color in the RGBA color space. This representation is designed
|
740
|
+
# for simplicity of conversion to/from color representations in various
|
741
|
+
# languages over compactness; for example, the fields of this representation
|
742
|
+
# can be trivially provided to the constructor of "java.awt.Color" in Java; it
|
743
|
+
# can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
|
744
|
+
# method in iOS; and, with just a little work, it can be easily formatted into
|
745
|
+
# a CSS "rgba()" string in JavaScript, as well. Here are some examples:
|
746
|
+
# Example (Java):
|
747
|
+
# import com.google.type.Color;
|
748
|
+
# // ...
|
749
|
+
# public static java.awt.Color fromProto(Color protocolor) `
|
750
|
+
# float alpha = protocolor.hasAlpha()
|
751
|
+
# ? protocolor.getAlpha().getValue()
|
752
|
+
# : 1.0;
|
753
|
+
# return new java.awt.Color(
|
754
|
+
# protocolor.getRed(),
|
755
|
+
# protocolor.getGreen(),
|
756
|
+
# protocolor.getBlue(),
|
757
|
+
# alpha);
|
758
|
+
# `
|
759
|
+
# public static Color toProto(java.awt.Color color) `
|
760
|
+
# float red = (float) color.getRed();
|
761
|
+
# float green = (float) color.getGreen();
|
762
|
+
# float blue = (float) color.getBlue();
|
763
|
+
# float denominator = 255.0;
|
764
|
+
# Color.Builder resultBuilder =
|
765
|
+
# Color
|
766
|
+
# .newBuilder()
|
767
|
+
# .setRed(red / denominator)
|
768
|
+
# .setGreen(green / denominator)
|
769
|
+
# .setBlue(blue / denominator);
|
770
|
+
# int alpha = color.getAlpha();
|
771
|
+
# if (alpha != 255) `
|
772
|
+
# result.setAlpha(
|
773
|
+
# FloatValue
|
774
|
+
# .newBuilder()
|
775
|
+
# .setValue(((float) alpha) / denominator)
|
776
|
+
# .build());
|
777
|
+
# `
|
778
|
+
# return resultBuilder.build();
|
779
|
+
# `
|
780
|
+
# // ...
|
781
|
+
# Example (iOS / Obj-C):
|
782
|
+
# // ...
|
783
|
+
# static UIColor* fromProto(Color* protocolor) `
|
784
|
+
# float red = [protocolor red];
|
785
|
+
# float green = [protocolor green];
|
786
|
+
# float blue = [protocolor blue];
|
787
|
+
# FloatValue* alpha_wrapper = [protocolor alpha];
|
788
|
+
# float alpha = 1.0;
|
789
|
+
# if (alpha_wrapper != nil) `
|
790
|
+
# alpha = [alpha_wrapper value];
|
791
|
+
# `
|
792
|
+
# return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
|
793
|
+
# `
|
794
|
+
# static Color* toProto(UIColor* color) `
|
795
|
+
# CGFloat red, green, blue, alpha;
|
796
|
+
# if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) `
|
797
|
+
# return nil;
|
798
|
+
# `
|
799
|
+
# Color* result = [Color alloc] init];
|
800
|
+
# [result setRed:red];
|
801
|
+
# [result setGreen:green];
|
802
|
+
# [result setBlue:blue];
|
803
|
+
# if (alpha <= 0.9999) `
|
804
|
+
# [result setAlpha:floatWrapperWithValue(alpha)];
|
805
|
+
# `
|
806
|
+
# [result autorelease];
|
807
|
+
# return result;
|
808
|
+
# `
|
809
|
+
# // ...
|
810
|
+
# Example (JavaScript):
|
811
|
+
# // ...
|
812
|
+
# var protoToCssColor = function(rgb_color) `
|
813
|
+
# var redFrac = rgb_color.red || 0.0;
|
814
|
+
# var greenFrac = rgb_color.green || 0.0;
|
815
|
+
# var blueFrac = rgb_color.blue || 0.0;
|
816
|
+
# var red = Math.floor(redFrac * 255);
|
817
|
+
# var green = Math.floor(greenFrac * 255);
|
818
|
+
# var blue = Math.floor(blueFrac * 255);
|
819
|
+
# if (!('alpha' in rgb_color)) `
|
820
|
+
# return rgbToCssColor_(red, green, blue);
|
821
|
+
# `
|
822
|
+
# var alphaFrac = rgb_color.alpha.value || 0.0;
|
823
|
+
# var rgbParams = [red, green, blue].join(',');
|
824
|
+
# return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
|
825
|
+
# `;
|
826
|
+
# var rgbToCssColor_ = function(red, green, blue) `
|
827
|
+
# var rgbNumber = new Number((red << 16) | (green << 8) | blue);
|
828
|
+
# var hexString = rgbNumber.toString(16);
|
829
|
+
# var missingZeros = 6 - hexString.length;
|
830
|
+
# var resultBuilder = ['#'];
|
831
|
+
# for (var i = 0; i < missingZeros; i++) `
|
832
|
+
# resultBuilder.push('0');
|
833
|
+
# `
|
834
|
+
# resultBuilder.push(hexString);
|
835
|
+
# return resultBuilder.join('');
|
836
|
+
# `;
|
837
|
+
# // ...
|
838
|
+
class Color
|
839
|
+
include Google::Apis::Core::Hashable
|
762
840
|
|
763
|
-
#
|
764
|
-
# Corresponds to the JSON property `
|
841
|
+
# The amount of red in the color as a value in the interval [0, 1].
|
842
|
+
# Corresponds to the JSON property `red`
|
765
843
|
# @return [Float]
|
766
|
-
attr_accessor :
|
767
|
-
|
768
|
-
# Under-exposed likelihood.
|
769
|
-
# Corresponds to the JSON property `underExposedLikelihood`
|
770
|
-
# @return [String]
|
771
|
-
attr_accessor :under_exposed_likelihood
|
844
|
+
attr_accessor :red
|
772
845
|
|
773
|
-
#
|
774
|
-
#
|
775
|
-
# [-180,180].
|
776
|
-
# Corresponds to the JSON property `panAngle`
|
846
|
+
# The amount of green in the color as a value in the interval [0, 1].
|
847
|
+
# Corresponds to the JSON property `green`
|
777
848
|
# @return [Float]
|
778
|
-
attr_accessor :
|
849
|
+
attr_accessor :green
|
779
850
|
|
780
|
-
#
|
781
|
-
# Corresponds to the JSON property `
|
851
|
+
# The amount of blue in the color as a value in the interval [0, 1].
|
852
|
+
# Corresponds to the JSON property `blue`
|
782
853
|
# @return [Float]
|
783
|
-
attr_accessor :
|
784
|
-
|
785
|
-
# Blurred likelihood.
|
786
|
-
# Corresponds to the JSON property `blurredLikelihood`
|
787
|
-
# @return [String]
|
788
|
-
attr_accessor :blurred_likelihood
|
789
|
-
|
790
|
-
# Headwear likelihood.
|
791
|
-
# Corresponds to the JSON property `headwearLikelihood`
|
792
|
-
# @return [String]
|
793
|
-
attr_accessor :headwear_likelihood
|
794
|
-
|
795
|
-
# A bounding polygon for the detected image annotation.
|
796
|
-
# Corresponds to the JSON property `boundingPoly`
|
797
|
-
# @return [Google::Apis::VisionV1::BoundingPoly]
|
798
|
-
attr_accessor :bounding_poly
|
854
|
+
attr_accessor :blue
|
799
855
|
|
800
|
-
#
|
801
|
-
#
|
802
|
-
#
|
803
|
-
#
|
856
|
+
# The fraction of this color that should be applied to the pixel. That is,
|
857
|
+
# the final pixel color is defined by the equation:
|
858
|
+
# pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
|
859
|
+
# This means that a value of 1.0 corresponds to a solid color, whereas
|
860
|
+
# a value of 0.0 corresponds to a completely transparent color. This
|
861
|
+
# uses a wrapper message rather than a simple float scalar so that it is
|
862
|
+
# possible to distinguish between a default value and the value being unset.
|
863
|
+
# If omitted, this color object is to be rendered as a solid color
|
864
|
+
# (as if the alpha value had been explicitly given with a value of 1.0).
|
865
|
+
# Corresponds to the JSON property `alpha`
|
804
866
|
# @return [Float]
|
805
|
-
attr_accessor :
|
806
|
-
|
807
|
-
# Sorrow likelihood.
|
808
|
-
# Corresponds to the JSON property `sorrowLikelihood`
|
809
|
-
# @return [String]
|
810
|
-
attr_accessor :sorrow_likelihood
|
867
|
+
attr_accessor :alpha
|
811
868
|
|
812
869
|
def initialize(**args)
|
813
870
|
update!(**args)
|
@@ -815,32 +872,29 @@ module Google
|
|
815
872
|
|
816
873
|
# Update properties of this object
|
817
874
|
def update!(**args)
|
818
|
-
@
|
819
|
-
@
|
820
|
-
@
|
821
|
-
@
|
822
|
-
@surprise_likelihood = args[:surprise_likelihood] if args.key?(:surprise_likelihood)
|
823
|
-
@joy_likelihood = args[:joy_likelihood] if args.key?(:joy_likelihood)
|
824
|
-
@landmarking_confidence = args[:landmarking_confidence] if args.key?(:landmarking_confidence)
|
825
|
-
@under_exposed_likelihood = args[:under_exposed_likelihood] if args.key?(:under_exposed_likelihood)
|
826
|
-
@pan_angle = args[:pan_angle] if args.key?(:pan_angle)
|
827
|
-
@detection_confidence = args[:detection_confidence] if args.key?(:detection_confidence)
|
828
|
-
@blurred_likelihood = args[:blurred_likelihood] if args.key?(:blurred_likelihood)
|
829
|
-
@headwear_likelihood = args[:headwear_likelihood] if args.key?(:headwear_likelihood)
|
830
|
-
@bounding_poly = args[:bounding_poly] if args.key?(:bounding_poly)
|
831
|
-
@roll_angle = args[:roll_angle] if args.key?(:roll_angle)
|
832
|
-
@sorrow_likelihood = args[:sorrow_likelihood] if args.key?(:sorrow_likelihood)
|
875
|
+
@red = args[:red] if args.key?(:red)
|
876
|
+
@green = args[:green] if args.key?(:green)
|
877
|
+
@blue = args[:blue] if args.key?(:blue)
|
878
|
+
@alpha = args[:alpha] if args.key?(:alpha)
|
833
879
|
end
|
834
880
|
end
|
835
881
|
|
836
|
-
#
|
837
|
-
|
882
|
+
# Users describe the type of Google Cloud Vision API tasks to perform over
|
883
|
+
# images by using *Feature*s. Each Feature indicates a type of image
|
884
|
+
# detection task to perform. Features encode the Cloud Vision API
|
885
|
+
# vertical to operate on and the number of top-scoring results to return.
|
886
|
+
class Feature
|
838
887
|
include Google::Apis::Core::Hashable
|
839
888
|
|
840
|
-
#
|
841
|
-
# Corresponds to the JSON property `
|
842
|
-
# @return [
|
843
|
-
attr_accessor :
|
889
|
+
# The feature type.
|
890
|
+
# Corresponds to the JSON property `type`
|
891
|
+
# @return [String]
|
892
|
+
attr_accessor :type
|
893
|
+
|
894
|
+
# Maximum number of results of this type.
|
895
|
+
# Corresponds to the JSON property `maxResults`
|
896
|
+
# @return [Fixnum]
|
897
|
+
attr_accessor :max_results
|
844
898
|
|
845
899
|
def initialize(**args)
|
846
900
|
update!(**args)
|
@@ -848,24 +902,19 @@ module Google
|
|
848
902
|
|
849
903
|
# Update properties of this object
|
850
904
|
def update!(**args)
|
851
|
-
@
|
905
|
+
@type = args[:type] if args.key?(:type)
|
906
|
+
@max_results = args[:max_results] if args.key?(:max_results)
|
852
907
|
end
|
853
908
|
end
|
854
909
|
|
855
|
-
#
|
856
|
-
class
|
910
|
+
# Stores image properties, such as dominant colors.
|
911
|
+
class ImageProperties
|
857
912
|
include Google::Apis::Core::Hashable
|
858
913
|
|
859
|
-
#
|
860
|
-
# Corresponds to the JSON property `
|
861
|
-
# @return [
|
862
|
-
attr_accessor :
|
863
|
-
|
864
|
-
# True if break prepends the element.
|
865
|
-
# Corresponds to the JSON property `isPrefix`
|
866
|
-
# @return [Boolean]
|
867
|
-
attr_accessor :is_prefix
|
868
|
-
alias_method :is_prefix?, :is_prefix
|
914
|
+
# Set of dominant colors and their corresponding scores.
|
915
|
+
# Corresponds to the JSON property `dominantColors`
|
916
|
+
# @return [Google::Apis::VisionV1::DominantColorsAnnotation]
|
917
|
+
attr_accessor :dominant_colors
|
869
918
|
|
870
919
|
def initialize(**args)
|
871
920
|
update!(**args)
|
@@ -873,36 +922,37 @@ module Google
|
|
873
922
|
|
874
923
|
# Update properties of this object
|
875
924
|
def update!(**args)
|
876
|
-
@
|
877
|
-
@is_prefix = args[:is_prefix] if args.key?(:is_prefix)
|
925
|
+
@dominant_colors = args[:dominant_colors] if args.key?(:dominant_colors)
|
878
926
|
end
|
879
927
|
end
|
880
928
|
|
881
|
-
#
|
882
|
-
|
929
|
+
# Set of features pertaining to the image, computed by computer vision
|
930
|
+
# methods over safe-search verticals (for example, adult, spoof, medical,
|
931
|
+
# violence).
|
932
|
+
class SafeSearchAnnotation
|
883
933
|
include Google::Apis::Core::Hashable
|
884
934
|
|
885
|
-
#
|
886
|
-
#
|
887
|
-
#
|
888
|
-
|
935
|
+
# Spoof likelihood. The likelihood that an modification
|
936
|
+
# was made to the image's canonical version to make it appear
|
937
|
+
# funny or offensive.
|
938
|
+
# Corresponds to the JSON property `spoof`
|
939
|
+
# @return [String]
|
940
|
+
attr_accessor :spoof
|
889
941
|
|
890
|
-
#
|
891
|
-
#
|
892
|
-
#
|
893
|
-
|
894
|
-
# setting a hint will help get better results (although it will be a
|
895
|
-
# significant hindrance if the hint is wrong). Text detection returns an
|
896
|
-
# error if one or more of the specified languages is not one of the
|
897
|
-
# [supported languages](/vision/docs/languages).
|
898
|
-
# Corresponds to the JSON property `languageHints`
|
899
|
-
# @return [Array<String>]
|
900
|
-
attr_accessor :language_hints
|
942
|
+
# Likelihood that this is a medical image.
|
943
|
+
# Corresponds to the JSON property `medical`
|
944
|
+
# @return [String]
|
945
|
+
attr_accessor :medical
|
901
946
|
|
902
|
-
#
|
903
|
-
# Corresponds to the JSON property `
|
904
|
-
# @return [
|
905
|
-
attr_accessor :
|
947
|
+
# Violence likelihood.
|
948
|
+
# Corresponds to the JSON property `violence`
|
949
|
+
# @return [String]
|
950
|
+
attr_accessor :violence
|
951
|
+
|
952
|
+
# Represents the adult content likelihood for the image.
|
953
|
+
# Corresponds to the JSON property `adult`
|
954
|
+
# @return [String]
|
955
|
+
attr_accessor :adult
|
906
956
|
|
907
957
|
def initialize(**args)
|
908
958
|
update!(**args)
|
@@ -910,35 +960,51 @@ module Google
|
|
910
960
|
|
911
961
|
# Update properties of this object
|
912
962
|
def update!(**args)
|
913
|
-
@
|
914
|
-
@
|
915
|
-
@
|
963
|
+
@spoof = args[:spoof] if args.key?(:spoof)
|
964
|
+
@medical = args[:medical] if args.key?(:medical)
|
965
|
+
@violence = args[:violence] if args.key?(:violence)
|
966
|
+
@adult = args[:adult] if args.key?(:adult)
|
916
967
|
end
|
917
968
|
end
|
918
969
|
|
919
|
-
#
|
920
|
-
class
|
970
|
+
# Set of dominant colors and their corresponding scores.
|
971
|
+
class DominantColorsAnnotation
|
921
972
|
include Google::Apis::Core::Hashable
|
922
973
|
|
923
|
-
#
|
924
|
-
# Corresponds to the JSON property `
|
925
|
-
# @return [
|
926
|
-
attr_accessor :
|
974
|
+
# RGB color values with their score and pixel fraction.
|
975
|
+
# Corresponds to the JSON property `colors`
|
976
|
+
# @return [Array<Google::Apis::VisionV1::ColorInfo>]
|
977
|
+
attr_accessor :colors
|
927
978
|
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
attr_accessor :blocks
|
979
|
+
def initialize(**args)
|
980
|
+
update!(**args)
|
981
|
+
end
|
932
982
|
|
933
|
-
#
|
934
|
-
|
935
|
-
|
936
|
-
|
983
|
+
# Update properties of this object
|
984
|
+
def update!(**args)
|
985
|
+
@colors = args[:colors] if args.key?(:colors)
|
986
|
+
end
|
987
|
+
end
|
937
988
|
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
989
|
+
# TextAnnotation contains a structured representation of OCR extracted text.
|
990
|
+
# The hierarchy of an OCR extracted text structure is like this:
|
991
|
+
# TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
|
992
|
+
# Each structural component, starting from Page, may further have their own
|
993
|
+
# properties. Properties describe detected languages, breaks etc.. Please
|
994
|
+
# refer to the google.cloud.vision.v1.TextAnnotation.TextProperty message
|
995
|
+
# definition below for more detail.
|
996
|
+
class TextAnnotation
|
997
|
+
include Google::Apis::Core::Hashable
|
998
|
+
|
999
|
+
# List of pages detected by OCR.
|
1000
|
+
# Corresponds to the JSON property `pages`
|
1001
|
+
# @return [Array<Google::Apis::VisionV1::Page>]
|
1002
|
+
attr_accessor :pages
|
1003
|
+
|
1004
|
+
# UTF-8 text detected on the pages.
|
1005
|
+
# Corresponds to the JSON property `text`
|
1006
|
+
# @return [String]
|
1007
|
+
attr_accessor :text
|
942
1008
|
|
943
1009
|
def initialize(**args)
|
944
1010
|
update!(**args)
|
@@ -946,32 +1012,26 @@ module Google
|
|
946
1012
|
|
947
1013
|
# Update properties of this object
|
948
1014
|
def update!(**args)
|
949
|
-
@
|
950
|
-
@
|
951
|
-
@property = args[:property] if args.key?(:property)
|
952
|
-
@height = args[:height] if args.key?(:height)
|
1015
|
+
@pages = args[:pages] if args.key?(:pages)
|
1016
|
+
@text = args[:text] if args.key?(:text)
|
953
1017
|
end
|
954
1018
|
end
|
955
1019
|
|
956
|
-
#
|
957
|
-
|
958
|
-
class AnnotateImageRequest
|
1020
|
+
# Detected language for a structural component.
|
1021
|
+
class DetectedLanguage
|
959
1022
|
include Google::Apis::Core::Hashable
|
960
1023
|
|
961
|
-
#
|
962
|
-
#
|
963
|
-
#
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
# Corresponds to the JSON property `features`
|
968
|
-
# @return [Array<Google::Apis::VisionV1::Feature>]
|
969
|
-
attr_accessor :features
|
1024
|
+
# The BCP-47 language code, such as "en-US" or "sr-Latn". For more
|
1025
|
+
# information, see
|
1026
|
+
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
|
1027
|
+
# Corresponds to the JSON property `languageCode`
|
1028
|
+
# @return [String]
|
1029
|
+
attr_accessor :language_code
|
970
1030
|
|
971
|
-
#
|
972
|
-
# Corresponds to the JSON property `
|
973
|
-
# @return [
|
974
|
-
attr_accessor :
|
1031
|
+
# Confidence of detected language. Range [0, 1].
|
1032
|
+
# Corresponds to the JSON property `confidence`
|
1033
|
+
# @return [Float]
|
1034
|
+
attr_accessor :confidence
|
975
1035
|
|
976
1036
|
def initialize(**args)
|
977
1037
|
update!(**args)
|
@@ -979,71 +1039,25 @@ module Google
|
|
979
1039
|
|
980
1040
|
# Update properties of this object
|
981
1041
|
def update!(**args)
|
982
|
-
@
|
983
|
-
@
|
984
|
-
@image_context = args[:image_context] if args.key?(:image_context)
|
1042
|
+
@language_code = args[:language_code] if args.key?(:language_code)
|
1043
|
+
@confidence = args[:confidence] if args.key?(:confidence)
|
985
1044
|
end
|
986
1045
|
end
|
987
1046
|
|
988
|
-
#
|
989
|
-
#
|
990
|
-
|
991
|
-
# - Simple to use and understand for most users
|
992
|
-
# - Flexible enough to meet unexpected needs
|
993
|
-
# # Overview
|
994
|
-
# The `Status` message contains three pieces of data: error code, error message,
|
995
|
-
# and error details. The error code should be an enum value of
|
996
|
-
# google.rpc.Code, but it may accept additional error codes if needed. The
|
997
|
-
# error message should be a developer-facing English message that helps
|
998
|
-
# developers *understand* and *resolve* the error. If a localized user-facing
|
999
|
-
# error message is needed, put the localized message in the error details or
|
1000
|
-
# localize it in the client. The optional error details may contain arbitrary
|
1001
|
-
# information about the error. There is a predefined set of error detail types
|
1002
|
-
# in the package `google.rpc` which can be used for common error conditions.
|
1003
|
-
# # Language mapping
|
1004
|
-
# The `Status` message is the logical representation of the error model, but it
|
1005
|
-
# is not necessarily the actual wire format. When the `Status` message is
|
1006
|
-
# exposed in different client libraries and different wire protocols, it can be
|
1007
|
-
# mapped differently. For example, it will likely be mapped to some exceptions
|
1008
|
-
# in Java, but more likely mapped to some error codes in C.
|
1009
|
-
# # Other uses
|
1010
|
-
# The error model and the `Status` message can be used in a variety of
|
1011
|
-
# environments, either with or without APIs, to provide a
|
1012
|
-
# consistent developer experience across different environments.
|
1013
|
-
# Example uses of this error model include:
|
1014
|
-
# - Partial errors. If a service needs to return partial errors to the client,
|
1015
|
-
# it may embed the `Status` in the normal response to indicate the partial
|
1016
|
-
# errors.
|
1017
|
-
# - Workflow errors. A typical workflow has multiple steps. Each step may
|
1018
|
-
# have a `Status` message for error reporting purpose.
|
1019
|
-
# - Batch operations. If a client uses batch request and batch response, the
|
1020
|
-
# `Status` message should be used directly inside batch response, one for
|
1021
|
-
# each error sub-response.
|
1022
|
-
# - Asynchronous operations. If an API call embeds asynchronous operation
|
1023
|
-
# results in its response, the status of those operations should be
|
1024
|
-
# represented directly using the `Status` message.
|
1025
|
-
# - Logging. If some API errors are stored in logs, the message `Status` could
|
1026
|
-
# be used directly after any stripping needed for security/privacy reasons.
|
1027
|
-
class Status
|
1047
|
+
# A vertex represents a 2D point in the image.
|
1048
|
+
# NOTE: the vertex coordinates are in the same scale as the original image.
|
1049
|
+
class Vertex
|
1028
1050
|
include Google::Apis::Core::Hashable
|
1029
1051
|
|
1030
|
-
#
|
1031
|
-
#
|
1032
|
-
# Corresponds to the JSON property `details`
|
1033
|
-
# @return [Array<Hash<String,Object>>]
|
1034
|
-
attr_accessor :details
|
1035
|
-
|
1036
|
-
# The status code, which should be an enum value of google.rpc.Code.
|
1037
|
-
# Corresponds to the JSON property `code`
|
1052
|
+
# Y coordinate.
|
1053
|
+
# Corresponds to the JSON property `y`
|
1038
1054
|
# @return [Fixnum]
|
1039
|
-
attr_accessor :
|
1055
|
+
attr_accessor :y
|
1040
1056
|
|
1041
|
-
#
|
1042
|
-
#
|
1043
|
-
#
|
1044
|
-
|
1045
|
-
# @return [String]
|
1046
|
-
attr_accessor :message
|
1057
|
+
# X coordinate.
|
1058
|
+
# Corresponds to the JSON property `x`
|
1059
|
+
# @return [Fixnum]
|
1060
|
+
attr_accessor :x
|
1047
1061
|
|
1048
1062
|
def initialize(**args)
|
1049
1063
|
update!(**args)
|
@@ -1051,97 +1065,24 @@ module Google
|
|
1051
1065
|
|
1052
1066
|
# Update properties of this object
|
1053
1067
|
def update!(**args)
|
1054
|
-
@
|
1055
|
-
@
|
1056
|
-
@message = args[:message] if args.key?(:message)
|
1068
|
+
@y = args[:y] if args.key?(:y)
|
1069
|
+
@x = args[:x] if args.key?(:x)
|
1057
1070
|
end
|
1058
1071
|
end
|
1059
1072
|
|
1060
|
-
#
|
1061
|
-
class
|
1073
|
+
# Additional information detected on the structural component.
|
1074
|
+
class TextProperty
|
1062
1075
|
include Google::Apis::Core::Hashable
|
1063
1076
|
|
1064
|
-
#
|
1065
|
-
#
|
1066
|
-
#
|
1067
|
-
|
1068
|
-
# standard</a>. Values must be within normalized ranges.
|
1069
|
-
# Example of normalization code in Python:
|
1070
|
-
# def NormalizeLongitude(longitude):
|
1071
|
-
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
1072
|
-
# q, r = divmod(longitude, 360.0)
|
1073
|
-
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
1074
|
-
# return r - 360.0
|
1075
|
-
# return r
|
1076
|
-
# def NormalizeLatLng(latitude, longitude):
|
1077
|
-
# """Wraps decimal degrees latitude and longitude to
|
1078
|
-
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
1079
|
-
# r = latitude % 360.0
|
1080
|
-
# if r <= 90.0:
|
1081
|
-
# return r, NormalizeLongitude(longitude)
|
1082
|
-
# elif r >= 270.0:
|
1083
|
-
# return r - 360, NormalizeLongitude(longitude)
|
1084
|
-
# else:
|
1085
|
-
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
1086
|
-
# assert 180.0 == NormalizeLongitude(180.0)
|
1087
|
-
# assert -180.0 == NormalizeLongitude(-180.0)
|
1088
|
-
# assert -179.0 == NormalizeLongitude(181.0)
|
1089
|
-
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
1090
|
-
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
1091
|
-
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
1092
|
-
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
1093
|
-
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
1094
|
-
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
1095
|
-
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
1096
|
-
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
1097
|
-
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
1098
|
-
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
1099
|
-
# The code in logs/storage/validator/logs_validator_traits.cc treats this type
|
1100
|
-
# as if it were annotated as ST_LOCATION.
|
1101
|
-
# Corresponds to the JSON property `minLatLng`
|
1102
|
-
# @return [Google::Apis::VisionV1::LatLng]
|
1103
|
-
attr_accessor :min_lat_lng
|
1077
|
+
# Detected start or end of a structural component.
|
1078
|
+
# Corresponds to the JSON property `detectedBreak`
|
1079
|
+
# @return [Google::Apis::VisionV1::DetectedBreak]
|
1080
|
+
attr_accessor :detected_break
|
1104
1081
|
|
1105
|
-
#
|
1106
|
-
#
|
1107
|
-
#
|
1108
|
-
|
1109
|
-
# standard</a>. Values must be within normalized ranges.
|
1110
|
-
# Example of normalization code in Python:
|
1111
|
-
# def NormalizeLongitude(longitude):
|
1112
|
-
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
1113
|
-
# q, r = divmod(longitude, 360.0)
|
1114
|
-
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
1115
|
-
# return r - 360.0
|
1116
|
-
# return r
|
1117
|
-
# def NormalizeLatLng(latitude, longitude):
|
1118
|
-
# """Wraps decimal degrees latitude and longitude to
|
1119
|
-
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
1120
|
-
# r = latitude % 360.0
|
1121
|
-
# if r <= 90.0:
|
1122
|
-
# return r, NormalizeLongitude(longitude)
|
1123
|
-
# elif r >= 270.0:
|
1124
|
-
# return r - 360, NormalizeLongitude(longitude)
|
1125
|
-
# else:
|
1126
|
-
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
1127
|
-
# assert 180.0 == NormalizeLongitude(180.0)
|
1128
|
-
# assert -180.0 == NormalizeLongitude(-180.0)
|
1129
|
-
# assert -179.0 == NormalizeLongitude(181.0)
|
1130
|
-
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
1131
|
-
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
1132
|
-
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
1133
|
-
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
1134
|
-
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
1135
|
-
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
1136
|
-
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
1137
|
-
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
1138
|
-
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
1139
|
-
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
1140
|
-
# The code in logs/storage/validator/logs_validator_traits.cc treats this type
|
1141
|
-
# as if it were annotated as ST_LOCATION.
|
1142
|
-
# Corresponds to the JSON property `maxLatLng`
|
1143
|
-
# @return [Google::Apis::VisionV1::LatLng]
|
1144
|
-
attr_accessor :max_lat_lng
|
1082
|
+
# A list of detected languages together with confidence.
|
1083
|
+
# Corresponds to the JSON property `detectedLanguages`
|
1084
|
+
# @return [Array<Google::Apis::VisionV1::DetectedLanguage>]
|
1085
|
+
attr_accessor :detected_languages
|
1145
1086
|
|
1146
1087
|
def initialize(**args)
|
1147
1088
|
update!(**args)
|
@@ -1149,29 +1090,49 @@ module Google
|
|
1149
1090
|
|
1150
1091
|
# Update properties of this object
|
1151
1092
|
def update!(**args)
|
1152
|
-
@
|
1153
|
-
@
|
1093
|
+
@detected_break = args[:detected_break] if args.key?(:detected_break)
|
1094
|
+
@detected_languages = args[:detected_languages] if args.key?(:detected_languages)
|
1154
1095
|
end
|
1155
1096
|
end
|
1156
1097
|
|
1157
|
-
# A
|
1158
|
-
class
|
1098
|
+
# A bounding polygon for the detected image annotation.
|
1099
|
+
class BoundingPoly
|
1159
1100
|
include Google::Apis::Core::Hashable
|
1160
1101
|
|
1161
|
-
#
|
1162
|
-
# Corresponds to the JSON property `
|
1163
|
-
# @return [Google::Apis::VisionV1::
|
1164
|
-
attr_accessor :
|
1102
|
+
# The bounding polygon vertices.
|
1103
|
+
# Corresponds to the JSON property `vertices`
|
1104
|
+
# @return [Array<Google::Apis::VisionV1::Vertex>]
|
1105
|
+
attr_accessor :vertices
|
1165
1106
|
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
attr_accessor :bounding_box
|
1107
|
+
def initialize(**args)
|
1108
|
+
update!(**args)
|
1109
|
+
end
|
1170
1110
|
|
1171
|
-
#
|
1172
|
-
|
1111
|
+
# Update properties of this object
|
1112
|
+
def update!(**args)
|
1113
|
+
@vertices = args[:vertices] if args.key?(:vertices)
|
1114
|
+
end
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
# Entity deduced from similar images on the Internet.
|
1118
|
+
class WebEntity
|
1119
|
+
include Google::Apis::Core::Hashable
|
1120
|
+
|
1121
|
+
# Opaque entity ID.
|
1122
|
+
# Corresponds to the JSON property `entityId`
|
1173
1123
|
# @return [String]
|
1174
|
-
attr_accessor :
|
1124
|
+
attr_accessor :entity_id
|
1125
|
+
|
1126
|
+
# Canonical description of the entity, in English.
|
1127
|
+
# Corresponds to the JSON property `description`
|
1128
|
+
# @return [String]
|
1129
|
+
attr_accessor :description
|
1130
|
+
|
1131
|
+
# Overall relevancy score for the entity.
|
1132
|
+
# Not normalized and not comparable across different image queries.
|
1133
|
+
# Corresponds to the JSON property `score`
|
1134
|
+
# @return [Float]
|
1135
|
+
attr_accessor :score
|
1175
1136
|
|
1176
1137
|
def initialize(**args)
|
1177
1138
|
update!(**args)
|
@@ -1179,20 +1140,116 @@ module Google
|
|
1179
1140
|
|
1180
1141
|
# Update properties of this object
|
1181
1142
|
def update!(**args)
|
1182
|
-
@
|
1183
|
-
@
|
1184
|
-
@
|
1143
|
+
@entity_id = args[:entity_id] if args.key?(:entity_id)
|
1144
|
+
@description = args[:description] if args.key?(:description)
|
1145
|
+
@score = args[:score] if args.key?(:score)
|
1185
1146
|
end
|
1186
1147
|
end
|
1187
1148
|
|
1188
|
-
#
|
1189
|
-
class
|
1149
|
+
# Response to an image annotation request.
|
1150
|
+
class AnnotateImageResponse
|
1190
1151
|
include Google::Apis::Core::Hashable
|
1191
1152
|
|
1192
|
-
#
|
1193
|
-
# Corresponds to the JSON property `
|
1194
|
-
# @return [Array<Google::Apis::VisionV1::
|
1195
|
-
attr_accessor :
|
1153
|
+
# If present, logo detection has completed successfully.
|
1154
|
+
# Corresponds to the JSON property `logoAnnotations`
|
1155
|
+
# @return [Array<Google::Apis::VisionV1::EntityAnnotation>]
|
1156
|
+
attr_accessor :logo_annotations
|
1157
|
+
|
1158
|
+
# Set of crop hints that are used to generate new crops when serving images.
|
1159
|
+
# Corresponds to the JSON property `cropHintsAnnotation`
|
1160
|
+
# @return [Google::Apis::VisionV1::CropHintsAnnotation]
|
1161
|
+
attr_accessor :crop_hints_annotation
|
1162
|
+
|
1163
|
+
# Relevant information for the image from the Internet.
|
1164
|
+
# Corresponds to the JSON property `webDetection`
|
1165
|
+
# @return [Google::Apis::VisionV1::WebDetection]
|
1166
|
+
attr_accessor :web_detection
|
1167
|
+
|
1168
|
+
# If present, label detection has completed successfully.
|
1169
|
+
# Corresponds to the JSON property `labelAnnotations`
|
1170
|
+
# @return [Array<Google::Apis::VisionV1::EntityAnnotation>]
|
1171
|
+
attr_accessor :label_annotations
|
1172
|
+
|
1173
|
+
# Set of features pertaining to the image, computed by computer vision
|
1174
|
+
# methods over safe-search verticals (for example, adult, spoof, medical,
|
1175
|
+
# violence).
|
1176
|
+
# Corresponds to the JSON property `safeSearchAnnotation`
|
1177
|
+
# @return [Google::Apis::VisionV1::SafeSearchAnnotation]
|
1178
|
+
attr_accessor :safe_search_annotation
|
1179
|
+
|
1180
|
+
# The `Status` type defines a logical error model that is suitable for different
|
1181
|
+
# programming environments, including REST APIs and RPC APIs. It is used by
|
1182
|
+
# [gRPC](https://github.com/grpc). The error model is designed to be:
|
1183
|
+
# - Simple to use and understand for most users
|
1184
|
+
# - Flexible enough to meet unexpected needs
|
1185
|
+
# # Overview
|
1186
|
+
# The `Status` message contains three pieces of data: error code, error message,
|
1187
|
+
# and error details. The error code should be an enum value of
|
1188
|
+
# google.rpc.Code, but it may accept additional error codes if needed. The
|
1189
|
+
# error message should be a developer-facing English message that helps
|
1190
|
+
# developers *understand* and *resolve* the error. If a localized user-facing
|
1191
|
+
# error message is needed, put the localized message in the error details or
|
1192
|
+
# localize it in the client. The optional error details may contain arbitrary
|
1193
|
+
# information about the error. There is a predefined set of error detail types
|
1194
|
+
# in the package `google.rpc` that can be used for common error conditions.
|
1195
|
+
# # Language mapping
|
1196
|
+
# The `Status` message is the logical representation of the error model, but it
|
1197
|
+
# is not necessarily the actual wire format. When the `Status` message is
|
1198
|
+
# exposed in different client libraries and different wire protocols, it can be
|
1199
|
+
# mapped differently. For example, it will likely be mapped to some exceptions
|
1200
|
+
# in Java, but more likely mapped to some error codes in C.
|
1201
|
+
# # Other uses
|
1202
|
+
# The error model and the `Status` message can be used in a variety of
|
1203
|
+
# environments, either with or without APIs, to provide a
|
1204
|
+
# consistent developer experience across different environments.
|
1205
|
+
# Example uses of this error model include:
|
1206
|
+
# - Partial errors. If a service needs to return partial errors to the client,
|
1207
|
+
# it may embed the `Status` in the normal response to indicate the partial
|
1208
|
+
# errors.
|
1209
|
+
# - Workflow errors. A typical workflow has multiple steps. Each step may
|
1210
|
+
# have a `Status` message for error reporting.
|
1211
|
+
# - Batch operations. If a client uses batch request and batch response, the
|
1212
|
+
# `Status` message should be used directly inside batch response, one for
|
1213
|
+
# each error sub-response.
|
1214
|
+
# - Asynchronous operations. If an API call embeds asynchronous operation
|
1215
|
+
# results in its response, the status of those operations should be
|
1216
|
+
# represented directly using the `Status` message.
|
1217
|
+
# - Logging. If some API errors are stored in logs, the message `Status` could
|
1218
|
+
# be used directly after any stripping needed for security/privacy reasons.
|
1219
|
+
# Corresponds to the JSON property `error`
|
1220
|
+
# @return [Google::Apis::VisionV1::Status]
|
1221
|
+
attr_accessor :error
|
1222
|
+
|
1223
|
+
# TextAnnotation contains a structured representation of OCR extracted text.
|
1224
|
+
# The hierarchy of an OCR extracted text structure is like this:
|
1225
|
+
# TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
|
1226
|
+
# Each structural component, starting from Page, may further have their own
|
1227
|
+
# properties. Properties describe detected languages, breaks etc.. Please
|
1228
|
+
# refer to the google.cloud.vision.v1.TextAnnotation.TextProperty message
|
1229
|
+
# definition below for more detail.
|
1230
|
+
# Corresponds to the JSON property `fullTextAnnotation`
|
1231
|
+
# @return [Google::Apis::VisionV1::TextAnnotation]
|
1232
|
+
attr_accessor :full_text_annotation
|
1233
|
+
|
1234
|
+
# If present, landmark detection has completed successfully.
|
1235
|
+
# Corresponds to the JSON property `landmarkAnnotations`
|
1236
|
+
# @return [Array<Google::Apis::VisionV1::EntityAnnotation>]
|
1237
|
+
attr_accessor :landmark_annotations
|
1238
|
+
|
1239
|
+
# If present, text (OCR) detection has completed successfully.
|
1240
|
+
# Corresponds to the JSON property `textAnnotations`
|
1241
|
+
# @return [Array<Google::Apis::VisionV1::EntityAnnotation>]
|
1242
|
+
attr_accessor :text_annotations
|
1243
|
+
|
1244
|
+
# If present, face detection has completed successfully.
|
1245
|
+
# Corresponds to the JSON property `faceAnnotations`
|
1246
|
+
# @return [Array<Google::Apis::VisionV1::FaceAnnotation>]
|
1247
|
+
attr_accessor :face_annotations
|
1248
|
+
|
1249
|
+
# Stores image properties, such as dominant colors.
|
1250
|
+
# Corresponds to the JSON property `imagePropertiesAnnotation`
|
1251
|
+
# @return [Google::Apis::VisionV1::ImageProperties]
|
1252
|
+
attr_accessor :image_properties_annotation
|
1196
1253
|
|
1197
1254
|
def initialize(**args)
|
1198
1255
|
update!(**args)
|
@@ -1200,59 +1257,33 @@ module Google
|
|
1200
1257
|
|
1201
1258
|
# Update properties of this object
|
1202
1259
|
def update!(**args)
|
1203
|
-
@
|
1260
|
+
@logo_annotations = args[:logo_annotations] if args.key?(:logo_annotations)
|
1261
|
+
@crop_hints_annotation = args[:crop_hints_annotation] if args.key?(:crop_hints_annotation)
|
1262
|
+
@web_detection = args[:web_detection] if args.key?(:web_detection)
|
1263
|
+
@label_annotations = args[:label_annotations] if args.key?(:label_annotations)
|
1264
|
+
@safe_search_annotation = args[:safe_search_annotation] if args.key?(:safe_search_annotation)
|
1265
|
+
@error = args[:error] if args.key?(:error)
|
1266
|
+
@full_text_annotation = args[:full_text_annotation] if args.key?(:full_text_annotation)
|
1267
|
+
@landmark_annotations = args[:landmark_annotations] if args.key?(:landmark_annotations)
|
1268
|
+
@text_annotations = args[:text_annotations] if args.key?(:text_annotations)
|
1269
|
+
@face_annotations = args[:face_annotations] if args.key?(:face_annotations)
|
1270
|
+
@image_properties_annotation = args[:image_properties_annotation] if args.key?(:image_properties_annotation)
|
1204
1271
|
end
|
1205
1272
|
end
|
1206
1273
|
|
1207
|
-
#
|
1208
|
-
|
1209
|
-
# specified otherwise, this must conform to the
|
1210
|
-
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
|
1211
|
-
# standard</a>. Values must be within normalized ranges.
|
1212
|
-
# Example of normalization code in Python:
|
1213
|
-
# def NormalizeLongitude(longitude):
|
1214
|
-
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
1215
|
-
# q, r = divmod(longitude, 360.0)
|
1216
|
-
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
1217
|
-
# return r - 360.0
|
1218
|
-
# return r
|
1219
|
-
# def NormalizeLatLng(latitude, longitude):
|
1220
|
-
# """Wraps decimal degrees latitude and longitude to
|
1221
|
-
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
1222
|
-
# r = latitude % 360.0
|
1223
|
-
# if r <= 90.0:
|
1224
|
-
# return r, NormalizeLongitude(longitude)
|
1225
|
-
# elif r >= 270.0:
|
1226
|
-
# return r - 360, NormalizeLongitude(longitude)
|
1227
|
-
# else:
|
1228
|
-
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
1229
|
-
# assert 180.0 == NormalizeLongitude(180.0)
|
1230
|
-
# assert -180.0 == NormalizeLongitude(-180.0)
|
1231
|
-
# assert -179.0 == NormalizeLongitude(181.0)
|
1232
|
-
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
1233
|
-
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
1234
|
-
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
1235
|
-
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
1236
|
-
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
1237
|
-
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
1238
|
-
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
1239
|
-
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
1240
|
-
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
1241
|
-
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
1242
|
-
# The code in logs/storage/validator/logs_validator_traits.cc treats this type
|
1243
|
-
# as if it were annotated as ST_LOCATION.
|
1244
|
-
class LatLng
|
1274
|
+
# Parameters for crop hints annotation request.
|
1275
|
+
class CropHintsParams
|
1245
1276
|
include Google::Apis::Core::Hashable
|
1246
1277
|
|
1247
|
-
#
|
1248
|
-
#
|
1249
|
-
#
|
1250
|
-
|
1251
|
-
|
1252
|
-
#
|
1253
|
-
# Corresponds to the JSON property `
|
1254
|
-
# @return [Float]
|
1255
|
-
attr_accessor :
|
1278
|
+
# Aspect ratios in floats, representing the ratio of the width to the height
|
1279
|
+
# of the image. For example, if the desired aspect ratio is 4/3, the
|
1280
|
+
# corresponding float value should be 1.33333. If not specified, the
|
1281
|
+
# best possible crop is returned. The number of provided aspect ratios is
|
1282
|
+
# limited to a maximum of 16; any aspect ratios provided after the 16th are
|
1283
|
+
# ignored.
|
1284
|
+
# Corresponds to the JSON property `aspectRatios`
|
1285
|
+
# @return [Array<Float>]
|
1286
|
+
attr_accessor :aspect_ratios
|
1256
1287
|
|
1257
1288
|
def initialize(**args)
|
1258
1289
|
update!(**args)
|
@@ -1260,140 +1291,33 @@ module Google
|
|
1260
1291
|
|
1261
1292
|
# Update properties of this object
|
1262
1293
|
def update!(**args)
|
1263
|
-
@
|
1264
|
-
@longitude = args[:longitude] if args.key?(:longitude)
|
1294
|
+
@aspect_ratios = args[:aspect_ratios] if args.key?(:aspect_ratios)
|
1265
1295
|
end
|
1266
1296
|
end
|
1267
1297
|
|
1268
|
-
#
|
1269
|
-
|
1270
|
-
# languages over compactness; for example, the fields of this representation
|
1271
|
-
# can be trivially provided to the constructor of "java.awt.Color" in Java; it
|
1272
|
-
# can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
|
1273
|
-
# method in iOS; and, with just a little work, it can be easily formatted into
|
1274
|
-
# a CSS "rgba()" string in JavaScript, as well. Here are some examples:
|
1275
|
-
# Example (Java):
|
1276
|
-
# import com.google.type.Color;
|
1277
|
-
# // ...
|
1278
|
-
# public static java.awt.Color fromProto(Color protocolor) `
|
1279
|
-
# float alpha = protocolor.hasAlpha()
|
1280
|
-
# ? protocolor.getAlpha().getValue()
|
1281
|
-
# : 1.0;
|
1282
|
-
# return new java.awt.Color(
|
1283
|
-
# protocolor.getRed(),
|
1284
|
-
# protocolor.getGreen(),
|
1285
|
-
# protocolor.getBlue(),
|
1286
|
-
# alpha);
|
1287
|
-
# `
|
1288
|
-
# public static Color toProto(java.awt.Color color) `
|
1289
|
-
# float red = (float) color.getRed();
|
1290
|
-
# float green = (float) color.getGreen();
|
1291
|
-
# float blue = (float) color.getBlue();
|
1292
|
-
# float denominator = 255.0;
|
1293
|
-
# Color.Builder resultBuilder =
|
1294
|
-
# Color
|
1295
|
-
# .newBuilder()
|
1296
|
-
# .setRed(red / denominator)
|
1297
|
-
# .setGreen(green / denominator)
|
1298
|
-
# .setBlue(blue / denominator);
|
1299
|
-
# int alpha = color.getAlpha();
|
1300
|
-
# if (alpha != 255) `
|
1301
|
-
# result.setAlpha(
|
1302
|
-
# FloatValue
|
1303
|
-
# .newBuilder()
|
1304
|
-
# .setValue(((float) alpha) / denominator)
|
1305
|
-
# .build());
|
1306
|
-
# `
|
1307
|
-
# return resultBuilder.build();
|
1308
|
-
# `
|
1309
|
-
# // ...
|
1310
|
-
# Example (iOS / Obj-C):
|
1311
|
-
# // ...
|
1312
|
-
# static UIColor* fromProto(Color* protocolor) `
|
1313
|
-
# float red = [protocolor red];
|
1314
|
-
# float green = [protocolor green];
|
1315
|
-
# float blue = [protocolor blue];
|
1316
|
-
# FloatValue* alpha_wrapper = [protocolor alpha];
|
1317
|
-
# float alpha = 1.0;
|
1318
|
-
# if (alpha_wrapper != nil) `
|
1319
|
-
# alpha = [alpha_wrapper value];
|
1320
|
-
# `
|
1321
|
-
# return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
|
1322
|
-
# `
|
1323
|
-
# static Color* toProto(UIColor* color) `
|
1324
|
-
# CGFloat red, green, blue, alpha;
|
1325
|
-
# if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) `
|
1326
|
-
# return nil;
|
1327
|
-
# `
|
1328
|
-
# Color* result = [Color alloc] init];
|
1329
|
-
# [result setRed:red];
|
1330
|
-
# [result setGreen:green];
|
1331
|
-
# [result setBlue:blue];
|
1332
|
-
# if (alpha <= 0.9999) `
|
1333
|
-
# [result setAlpha:floatWrapperWithValue(alpha)];
|
1334
|
-
# `
|
1335
|
-
# [result autorelease];
|
1336
|
-
# return result;
|
1337
|
-
# `
|
1338
|
-
# // ...
|
1339
|
-
# Example (JavaScript):
|
1340
|
-
# // ...
|
1341
|
-
# var protoToCssColor = function(rgb_color) `
|
1342
|
-
# var redFrac = rgb_color.red || 0.0;
|
1343
|
-
# var greenFrac = rgb_color.green || 0.0;
|
1344
|
-
# var blueFrac = rgb_color.blue || 0.0;
|
1345
|
-
# var red = Math.floor(redFrac * 255);
|
1346
|
-
# var green = Math.floor(greenFrac * 255);
|
1347
|
-
# var blue = Math.floor(blueFrac * 255);
|
1348
|
-
# if (!('alpha' in rgb_color)) `
|
1349
|
-
# return rgbToCssColor_(red, green, blue);
|
1350
|
-
# `
|
1351
|
-
# var alphaFrac = rgb_color.alpha.value || 0.0;
|
1352
|
-
# var rgbParams = [red, green, blue].join(',');
|
1353
|
-
# return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
|
1354
|
-
# `;
|
1355
|
-
# var rgbToCssColor_ = function(red, green, blue) `
|
1356
|
-
# var rgbNumber = new Number((red << 16) | (green << 8) | blue);
|
1357
|
-
# var hexString = rgbNumber.toString(16);
|
1358
|
-
# var missingZeros = 6 - hexString.length;
|
1359
|
-
# var resultBuilder = ['#'];
|
1360
|
-
# for (var i = 0; i < missingZeros; i++) `
|
1361
|
-
# resultBuilder.push('0');
|
1362
|
-
# `
|
1363
|
-
# resultBuilder.push(hexString);
|
1364
|
-
# return resultBuilder.join('');
|
1365
|
-
# `;
|
1366
|
-
# // ...
|
1367
|
-
class Color
|
1298
|
+
# Logical element on the page.
|
1299
|
+
class Block
|
1368
1300
|
include Google::Apis::Core::Hashable
|
1369
1301
|
|
1370
|
-
#
|
1371
|
-
# Corresponds to the JSON property `
|
1372
|
-
# @return [
|
1373
|
-
attr_accessor :
|
1302
|
+
# Additional information detected on the structural component.
|
1303
|
+
# Corresponds to the JSON property `property`
|
1304
|
+
# @return [Google::Apis::VisionV1::TextProperty]
|
1305
|
+
attr_accessor :property
|
1374
1306
|
|
1375
|
-
#
|
1376
|
-
# Corresponds to the JSON property `
|
1377
|
-
# @return [
|
1378
|
-
attr_accessor :
|
1307
|
+
# Detected block type (text, image etc) for this block.
|
1308
|
+
# Corresponds to the JSON property `blockType`
|
1309
|
+
# @return [String]
|
1310
|
+
attr_accessor :block_type
|
1379
1311
|
|
1380
|
-
#
|
1381
|
-
# Corresponds to the JSON property `
|
1382
|
-
# @return [
|
1383
|
-
attr_accessor :
|
1312
|
+
# A bounding polygon for the detected image annotation.
|
1313
|
+
# Corresponds to the JSON property `boundingBox`
|
1314
|
+
# @return [Google::Apis::VisionV1::BoundingPoly]
|
1315
|
+
attr_accessor :bounding_box
|
1384
1316
|
|
1385
|
-
#
|
1386
|
-
#
|
1387
|
-
#
|
1388
|
-
|
1389
|
-
# a value of 0.0 corresponds to a completely transparent color. This
|
1390
|
-
# uses a wrapper message rather than a simple float scalar so that it is
|
1391
|
-
# possible to distinguish between a default value and the value being unset.
|
1392
|
-
# If omitted, this color object is to be rendered as a solid color
|
1393
|
-
# (as if the alpha value had been explicitly given with a value of 1.0).
|
1394
|
-
# Corresponds to the JSON property `alpha`
|
1395
|
-
# @return [Float]
|
1396
|
-
attr_accessor :alpha
|
1317
|
+
# List of paragraphs in this block (if this blocks is of type text).
|
1318
|
+
# Corresponds to the JSON property `paragraphs`
|
1319
|
+
# @return [Array<Google::Apis::VisionV1::Paragraph>]
|
1320
|
+
attr_accessor :paragraphs
|
1397
1321
|
|
1398
1322
|
def initialize(**args)
|
1399
1323
|
update!(**args)
|
@@ -1401,21 +1325,31 @@ module Google
|
|
1401
1325
|
|
1402
1326
|
# Update properties of this object
|
1403
1327
|
def update!(**args)
|
1404
|
-
@
|
1405
|
-
@
|
1406
|
-
@
|
1407
|
-
@
|
1328
|
+
@property = args[:property] if args.key?(:property)
|
1329
|
+
@block_type = args[:block_type] if args.key?(:block_type)
|
1330
|
+
@bounding_box = args[:bounding_box] if args.key?(:bounding_box)
|
1331
|
+
@paragraphs = args[:paragraphs] if args.key?(:paragraphs)
|
1408
1332
|
end
|
1409
1333
|
end
|
1410
1334
|
|
1411
|
-
#
|
1412
|
-
class
|
1335
|
+
# A `Property` consists of a user-supplied name/value pair.
|
1336
|
+
class Property
|
1413
1337
|
include Google::Apis::Core::Hashable
|
1414
1338
|
|
1415
|
-
#
|
1416
|
-
# Corresponds to the JSON property `
|
1417
|
-
# @return [
|
1418
|
-
attr_accessor :
|
1339
|
+
# Value of numeric properties.
|
1340
|
+
# Corresponds to the JSON property `uint64Value`
|
1341
|
+
# @return [Fixnum]
|
1342
|
+
attr_accessor :uint64_value
|
1343
|
+
|
1344
|
+
# Name of the property.
|
1345
|
+
# Corresponds to the JSON property `name`
|
1346
|
+
# @return [String]
|
1347
|
+
attr_accessor :name
|
1348
|
+
|
1349
|
+
# Value of the property.
|
1350
|
+
# Corresponds to the JSON property `value`
|
1351
|
+
# @return [String]
|
1352
|
+
attr_accessor :value
|
1419
1353
|
|
1420
1354
|
def initialize(**args)
|
1421
1355
|
update!(**args)
|
@@ -1423,26 +1357,54 @@ module Google
|
|
1423
1357
|
|
1424
1358
|
# Update properties of this object
|
1425
1359
|
def update!(**args)
|
1426
|
-
@
|
1360
|
+
@uint64_value = args[:uint64_value] if args.key?(:uint64_value)
|
1361
|
+
@name = args[:name] if args.key?(:name)
|
1362
|
+
@value = args[:value] if args.key?(:value)
|
1427
1363
|
end
|
1428
1364
|
end
|
1429
1365
|
|
1430
|
-
#
|
1431
|
-
|
1432
|
-
# detection task to perform. Features encode the Cloud Vision API
|
1433
|
-
# vertical to operate on and the number of top-scoring results to return.
|
1434
|
-
class Feature
|
1366
|
+
# Detected entity location information.
|
1367
|
+
class LocationInfo
|
1435
1368
|
include Google::Apis::Core::Hashable
|
1436
1369
|
|
1437
|
-
#
|
1438
|
-
#
|
1439
|
-
#
|
1440
|
-
|
1441
|
-
|
1442
|
-
#
|
1443
|
-
#
|
1444
|
-
#
|
1445
|
-
|
1370
|
+
# An object representing a latitude/longitude pair. This is expressed as a pair
|
1371
|
+
# of doubles representing degrees latitude and degrees longitude. Unless
|
1372
|
+
# specified otherwise, this must conform to the
|
1373
|
+
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
|
1374
|
+
# standard</a>. Values must be within normalized ranges.
|
1375
|
+
# Example of normalization code in Python:
|
1376
|
+
# def NormalizeLongitude(longitude):
|
1377
|
+
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
1378
|
+
# q, r = divmod(longitude, 360.0)
|
1379
|
+
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
1380
|
+
# return r - 360.0
|
1381
|
+
# return r
|
1382
|
+
# def NormalizeLatLng(latitude, longitude):
|
1383
|
+
# """Wraps decimal degrees latitude and longitude to
|
1384
|
+
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
1385
|
+
# r = latitude % 360.0
|
1386
|
+
# if r <= 90.0:
|
1387
|
+
# return r, NormalizeLongitude(longitude)
|
1388
|
+
# elif r >= 270.0:
|
1389
|
+
# return r - 360, NormalizeLongitude(longitude)
|
1390
|
+
# else:
|
1391
|
+
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
1392
|
+
# assert 180.0 == NormalizeLongitude(180.0)
|
1393
|
+
# assert -180.0 == NormalizeLongitude(-180.0)
|
1394
|
+
# assert -179.0 == NormalizeLongitude(181.0)
|
1395
|
+
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
1396
|
+
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
1397
|
+
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
1398
|
+
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
1399
|
+
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
1400
|
+
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
1401
|
+
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
1402
|
+
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
1403
|
+
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
1404
|
+
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
1405
|
+
# Corresponds to the JSON property `latLng`
|
1406
|
+
# @return [Google::Apis::VisionV1::LatLng]
|
1407
|
+
attr_accessor :lat_lng
|
1446
1408
|
|
1447
1409
|
def initialize(**args)
|
1448
1410
|
update!(**args)
|
@@ -1450,38 +1412,37 @@ module Google
|
|
1450
1412
|
|
1451
1413
|
# Update properties of this object
|
1452
1414
|
def update!(**args)
|
1453
|
-
@
|
1454
|
-
@max_results = args[:max_results] if args.key?(:max_results)
|
1415
|
+
@lat_lng = args[:lat_lng] if args.key?(:lat_lng)
|
1455
1416
|
end
|
1456
1417
|
end
|
1457
1418
|
|
1458
|
-
#
|
1459
|
-
|
1460
|
-
# violence).
|
1461
|
-
class SafeSearchAnnotation
|
1419
|
+
# External image source (Google Cloud Storage image location).
|
1420
|
+
class ImageSource
|
1462
1421
|
include Google::Apis::Core::Hashable
|
1463
1422
|
|
1464
|
-
#
|
1465
|
-
#
|
1466
|
-
#
|
1467
|
-
|
1468
|
-
|
1469
|
-
#
|
1470
|
-
# Corresponds to the JSON property `
|
1423
|
+
# NOTE: For new code `image_uri` below is preferred.
|
1424
|
+
# Google Cloud Storage image URI, which must be in the following form:
|
1425
|
+
# `gs://bucket_name/object_name` (for details, see
|
1426
|
+
# [Google Cloud Storage Request
|
1427
|
+
# URIs](https://cloud.google.com/storage/docs/reference-uris)).
|
1428
|
+
# NOTE: Cloud Storage object versioning is not supported.
|
1429
|
+
# Corresponds to the JSON property `gcsImageUri`
|
1471
1430
|
# @return [String]
|
1472
|
-
attr_accessor :
|
1431
|
+
attr_accessor :gcs_image_uri
|
1473
1432
|
|
1474
|
-
#
|
1475
|
-
#
|
1476
|
-
#
|
1477
|
-
|
1478
|
-
|
1479
|
-
#
|
1480
|
-
#
|
1481
|
-
#
|
1482
|
-
#
|
1433
|
+
# Image URI which supports:
|
1434
|
+
# 1) Google Cloud Storage image URI, which must be in the following form:
|
1435
|
+
# `gs://bucket_name/object_name` (for details, see
|
1436
|
+
# [Google Cloud Storage Request
|
1437
|
+
# URIs](https://cloud.google.com/storage/docs/reference-uris)).
|
1438
|
+
# NOTE: Cloud Storage object versioning is not supported.
|
1439
|
+
# 2) Publicly accessible image HTTP/HTTPS URL.
|
1440
|
+
# This is preferred over the legacy `gcs_image_uri` above. When both
|
1441
|
+
# `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
|
1442
|
+
# precedence.
|
1443
|
+
# Corresponds to the JSON property `imageUri`
|
1483
1444
|
# @return [String]
|
1484
|
-
attr_accessor :
|
1445
|
+
attr_accessor :image_uri
|
1485
1446
|
|
1486
1447
|
def initialize(**args)
|
1487
1448
|
update!(**args)
|
@@ -1489,21 +1450,19 @@ module Google
|
|
1489
1450
|
|
1490
1451
|
# Update properties of this object
|
1491
1452
|
def update!(**args)
|
1492
|
-
@
|
1493
|
-
@
|
1494
|
-
@adult = args[:adult] if args.key?(:adult)
|
1495
|
-
@spoof = args[:spoof] if args.key?(:spoof)
|
1453
|
+
@gcs_image_uri = args[:gcs_image_uri] if args.key?(:gcs_image_uri)
|
1454
|
+
@image_uri = args[:image_uri] if args.key?(:image_uri)
|
1496
1455
|
end
|
1497
1456
|
end
|
1498
1457
|
|
1499
|
-
#
|
1500
|
-
class
|
1458
|
+
# Response to a batch image annotation request.
|
1459
|
+
class BatchAnnotateImagesResponse
|
1501
1460
|
include Google::Apis::Core::Hashable
|
1502
1461
|
|
1503
|
-
#
|
1504
|
-
# Corresponds to the JSON property `
|
1505
|
-
# @return [Array<Google::Apis::VisionV1::
|
1506
|
-
attr_accessor :
|
1462
|
+
# Individual responses to image annotation requests within the batch.
|
1463
|
+
# Corresponds to the JSON property `responses`
|
1464
|
+
# @return [Array<Google::Apis::VisionV1::AnnotateImageResponse>]
|
1465
|
+
attr_accessor :responses
|
1507
1466
|
|
1508
1467
|
def initialize(**args)
|
1509
1468
|
update!(**args)
|
@@ -1511,56 +1470,41 @@ module Google
|
|
1511
1470
|
|
1512
1471
|
# Update properties of this object
|
1513
1472
|
def update!(**args)
|
1514
|
-
@
|
1473
|
+
@responses = args[:responses] if args.key?(:responses)
|
1515
1474
|
end
|
1516
1475
|
end
|
1517
1476
|
|
1518
|
-
#
|
1519
|
-
|
1520
|
-
# TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
|
1521
|
-
# Each structural component, starting from Page, may further have their own
|
1522
|
-
# properties. Properties describe detected languages, breaks etc.. Please
|
1523
|
-
# refer to the google.cloud.vision.v1.TextAnnotation.TextProperty message
|
1524
|
-
# definition below for more detail.
|
1525
|
-
class TextAnnotation
|
1477
|
+
# Relevant information for the image from the Internet.
|
1478
|
+
class WebDetection
|
1526
1479
|
include Google::Apis::Core::Hashable
|
1527
1480
|
|
1528
|
-
#
|
1529
|
-
#
|
1530
|
-
#
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
# Corresponds to the JSON property `text`
|
1535
|
-
# @return [String]
|
1536
|
-
attr_accessor :text
|
1537
|
-
|
1538
|
-
def initialize(**args)
|
1539
|
-
update!(**args)
|
1540
|
-
end
|
1481
|
+
# Partial matching images from the Internet.
|
1482
|
+
# Those images are similar enough to share some key-point features. For
|
1483
|
+
# example an original image will likely have partial matching for its crops.
|
1484
|
+
# Corresponds to the JSON property `partialMatchingImages`
|
1485
|
+
# @return [Array<Google::Apis::VisionV1::WebImage>]
|
1486
|
+
attr_accessor :partial_matching_images
|
1541
1487
|
|
1542
|
-
#
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
end
|
1547
|
-
end
|
1488
|
+
# The visually similar image results.
|
1489
|
+
# Corresponds to the JSON property `visuallySimilarImages`
|
1490
|
+
# @return [Array<Google::Apis::VisionV1::WebImage>]
|
1491
|
+
attr_accessor :visually_similar_images
|
1548
1492
|
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1493
|
+
# Fully matching images from the Internet.
|
1494
|
+
# Can include resized copies of the query image.
|
1495
|
+
# Corresponds to the JSON property `fullMatchingImages`
|
1496
|
+
# @return [Array<Google::Apis::VisionV1::WebImage>]
|
1497
|
+
attr_accessor :full_matching_images
|
1552
1498
|
|
1553
|
-
#
|
1554
|
-
#
|
1555
|
-
#
|
1556
|
-
|
1557
|
-
# @return [String]
|
1558
|
-
attr_accessor :language_code
|
1499
|
+
# Deduced entities from similar images on the Internet.
|
1500
|
+
# Corresponds to the JSON property `webEntities`
|
1501
|
+
# @return [Array<Google::Apis::VisionV1::WebEntity>]
|
1502
|
+
attr_accessor :web_entities
|
1559
1503
|
|
1560
|
-
#
|
1561
|
-
# Corresponds to the JSON property `
|
1562
|
-
# @return [
|
1563
|
-
attr_accessor :
|
1504
|
+
# Web pages containing the matching images from the Internet.
|
1505
|
+
# Corresponds to the JSON property `pagesWithMatchingImages`
|
1506
|
+
# @return [Array<Google::Apis::VisionV1::WebPage>]
|
1507
|
+
attr_accessor :pages_with_matching_images
|
1564
1508
|
|
1565
1509
|
def initialize(**args)
|
1566
1510
|
update!(**args)
|
@@ -1568,25 +1512,34 @@ module Google
|
|
1568
1512
|
|
1569
1513
|
# Update properties of this object
|
1570
1514
|
def update!(**args)
|
1571
|
-
@
|
1572
|
-
@
|
1515
|
+
@partial_matching_images = args[:partial_matching_images] if args.key?(:partial_matching_images)
|
1516
|
+
@visually_similar_images = args[:visually_similar_images] if args.key?(:visually_similar_images)
|
1517
|
+
@full_matching_images = args[:full_matching_images] if args.key?(:full_matching_images)
|
1518
|
+
@web_entities = args[:web_entities] if args.key?(:web_entities)
|
1519
|
+
@pages_with_matching_images = args[:pages_with_matching_images] if args.key?(:pages_with_matching_images)
|
1573
1520
|
end
|
1574
1521
|
end
|
1575
1522
|
|
1576
|
-
# A
|
1577
|
-
#
|
1578
|
-
|
1523
|
+
# A 3D position in the image, used primarily for Face detection landmarks.
|
1524
|
+
# A valid Position must have both x and y coordinates.
|
1525
|
+
# The position coordinates are in the same scale as the original image.
|
1526
|
+
class Position
|
1579
1527
|
include Google::Apis::Core::Hashable
|
1580
1528
|
|
1529
|
+
# Y coordinate.
|
1530
|
+
# Corresponds to the JSON property `y`
|
1531
|
+
# @return [Float]
|
1532
|
+
attr_accessor :y
|
1533
|
+
|
1581
1534
|
# X coordinate.
|
1582
1535
|
# Corresponds to the JSON property `x`
|
1583
|
-
# @return [
|
1536
|
+
# @return [Float]
|
1584
1537
|
attr_accessor :x
|
1585
1538
|
|
1586
|
-
#
|
1587
|
-
# Corresponds to the JSON property `
|
1588
|
-
# @return [
|
1589
|
-
attr_accessor :
|
1539
|
+
# Z coordinate (or depth).
|
1540
|
+
# Corresponds to the JSON property `z`
|
1541
|
+
# @return [Float]
|
1542
|
+
attr_accessor :z
|
1590
1543
|
|
1591
1544
|
def initialize(**args)
|
1592
1545
|
update!(**args)
|
@@ -1594,24 +1547,26 @@ module Google
|
|
1594
1547
|
|
1595
1548
|
# Update properties of this object
|
1596
1549
|
def update!(**args)
|
1597
|
-
@x = args[:x] if args.key?(:x)
|
1598
1550
|
@y = args[:y] if args.key?(:y)
|
1551
|
+
@x = args[:x] if args.key?(:x)
|
1552
|
+
@z = args[:z] if args.key?(:z)
|
1599
1553
|
end
|
1600
1554
|
end
|
1601
1555
|
|
1602
|
-
#
|
1603
|
-
class
|
1556
|
+
# Metadata for web pages.
|
1557
|
+
class WebPage
|
1604
1558
|
include Google::Apis::Core::Hashable
|
1605
1559
|
|
1606
|
-
#
|
1607
|
-
#
|
1608
|
-
#
|
1609
|
-
|
1560
|
+
# Overall relevancy score for the web page.
|
1561
|
+
# Not normalized and not comparable across different image queries.
|
1562
|
+
# Corresponds to the JSON property `score`
|
1563
|
+
# @return [Float]
|
1564
|
+
attr_accessor :score
|
1610
1565
|
|
1611
|
-
#
|
1612
|
-
# Corresponds to the JSON property `
|
1613
|
-
# @return [
|
1614
|
-
attr_accessor :
|
1566
|
+
# The result web page URL.
|
1567
|
+
# Corresponds to the JSON property `url`
|
1568
|
+
# @return [String]
|
1569
|
+
attr_accessor :url
|
1615
1570
|
|
1616
1571
|
def initialize(**args)
|
1617
1572
|
update!(**args)
|
@@ -1619,27 +1574,126 @@ module Google
|
|
1619
1574
|
|
1620
1575
|
# Update properties of this object
|
1621
1576
|
def update!(**args)
|
1622
|
-
@
|
1623
|
-
@
|
1577
|
+
@score = args[:score] if args.key?(:score)
|
1578
|
+
@url = args[:url] if args.key?(:url)
|
1624
1579
|
end
|
1625
1580
|
end
|
1626
1581
|
|
1627
|
-
#
|
1628
|
-
|
1582
|
+
# Color information consists of RGB channels, score, and the fraction of
|
1583
|
+
# the image that the color occupies in the image.
|
1584
|
+
class ColorInfo
|
1629
1585
|
include Google::Apis::Core::Hashable
|
1630
1586
|
|
1631
|
-
#
|
1632
|
-
#
|
1633
|
-
#
|
1634
|
-
|
1587
|
+
# The fraction of pixels the color occupies in the image.
|
1588
|
+
# Value in range [0, 1].
|
1589
|
+
# Corresponds to the JSON property `pixelFraction`
|
1590
|
+
# @return [Float]
|
1591
|
+
attr_accessor :pixel_fraction
|
1635
1592
|
|
1636
|
-
#
|
1637
|
-
#
|
1638
|
-
#
|
1639
|
-
|
1593
|
+
# Represents a color in the RGBA color space. This representation is designed
|
1594
|
+
# for simplicity of conversion to/from color representations in various
|
1595
|
+
# languages over compactness; for example, the fields of this representation
|
1596
|
+
# can be trivially provided to the constructor of "java.awt.Color" in Java; it
|
1597
|
+
# can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
|
1598
|
+
# method in iOS; and, with just a little work, it can be easily formatted into
|
1599
|
+
# a CSS "rgba()" string in JavaScript, as well. Here are some examples:
|
1600
|
+
# Example (Java):
|
1601
|
+
# import com.google.type.Color;
|
1602
|
+
# // ...
|
1603
|
+
# public static java.awt.Color fromProto(Color protocolor) `
|
1604
|
+
# float alpha = protocolor.hasAlpha()
|
1605
|
+
# ? protocolor.getAlpha().getValue()
|
1606
|
+
# : 1.0;
|
1607
|
+
# return new java.awt.Color(
|
1608
|
+
# protocolor.getRed(),
|
1609
|
+
# protocolor.getGreen(),
|
1610
|
+
# protocolor.getBlue(),
|
1611
|
+
# alpha);
|
1612
|
+
# `
|
1613
|
+
# public static Color toProto(java.awt.Color color) `
|
1614
|
+
# float red = (float) color.getRed();
|
1615
|
+
# float green = (float) color.getGreen();
|
1616
|
+
# float blue = (float) color.getBlue();
|
1617
|
+
# float denominator = 255.0;
|
1618
|
+
# Color.Builder resultBuilder =
|
1619
|
+
# Color
|
1620
|
+
# .newBuilder()
|
1621
|
+
# .setRed(red / denominator)
|
1622
|
+
# .setGreen(green / denominator)
|
1623
|
+
# .setBlue(blue / denominator);
|
1624
|
+
# int alpha = color.getAlpha();
|
1625
|
+
# if (alpha != 255) `
|
1626
|
+
# result.setAlpha(
|
1627
|
+
# FloatValue
|
1628
|
+
# .newBuilder()
|
1629
|
+
# .setValue(((float) alpha) / denominator)
|
1630
|
+
# .build());
|
1631
|
+
# `
|
1632
|
+
# return resultBuilder.build();
|
1633
|
+
# `
|
1634
|
+
# // ...
|
1635
|
+
# Example (iOS / Obj-C):
|
1636
|
+
# // ...
|
1637
|
+
# static UIColor* fromProto(Color* protocolor) `
|
1638
|
+
# float red = [protocolor red];
|
1639
|
+
# float green = [protocolor green];
|
1640
|
+
# float blue = [protocolor blue];
|
1641
|
+
# FloatValue* alpha_wrapper = [protocolor alpha];
|
1642
|
+
# float alpha = 1.0;
|
1643
|
+
# if (alpha_wrapper != nil) `
|
1644
|
+
# alpha = [alpha_wrapper value];
|
1645
|
+
# `
|
1646
|
+
# return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
|
1647
|
+
# `
|
1648
|
+
# static Color* toProto(UIColor* color) `
|
1649
|
+
# CGFloat red, green, blue, alpha;
|
1650
|
+
# if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) `
|
1651
|
+
# return nil;
|
1652
|
+
# `
|
1653
|
+
# Color* result = [Color alloc] init];
|
1654
|
+
# [result setRed:red];
|
1655
|
+
# [result setGreen:green];
|
1656
|
+
# [result setBlue:blue];
|
1657
|
+
# if (alpha <= 0.9999) `
|
1658
|
+
# [result setAlpha:floatWrapperWithValue(alpha)];
|
1659
|
+
# `
|
1660
|
+
# [result autorelease];
|
1661
|
+
# return result;
|
1662
|
+
# `
|
1663
|
+
# // ...
|
1664
|
+
# Example (JavaScript):
|
1665
|
+
# // ...
|
1666
|
+
# var protoToCssColor = function(rgb_color) `
|
1667
|
+
# var redFrac = rgb_color.red || 0.0;
|
1668
|
+
# var greenFrac = rgb_color.green || 0.0;
|
1669
|
+
# var blueFrac = rgb_color.blue || 0.0;
|
1670
|
+
# var red = Math.floor(redFrac * 255);
|
1671
|
+
# var green = Math.floor(greenFrac * 255);
|
1672
|
+
# var blue = Math.floor(blueFrac * 255);
|
1673
|
+
# if (!('alpha' in rgb_color)) `
|
1674
|
+
# return rgbToCssColor_(red, green, blue);
|
1675
|
+
# `
|
1676
|
+
# var alphaFrac = rgb_color.alpha.value || 0.0;
|
1677
|
+
# var rgbParams = [red, green, blue].join(',');
|
1678
|
+
# return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
|
1679
|
+
# `;
|
1680
|
+
# var rgbToCssColor_ = function(red, green, blue) `
|
1681
|
+
# var rgbNumber = new Number((red << 16) | (green << 8) | blue);
|
1682
|
+
# var hexString = rgbNumber.toString(16);
|
1683
|
+
# var missingZeros = 6 - hexString.length;
|
1684
|
+
# var resultBuilder = ['#'];
|
1685
|
+
# for (var i = 0; i < missingZeros; i++) `
|
1686
|
+
# resultBuilder.push('0');
|
1687
|
+
# `
|
1688
|
+
# resultBuilder.push(hexString);
|
1689
|
+
# return resultBuilder.join('');
|
1690
|
+
# `;
|
1691
|
+
# // ...
|
1692
|
+
# Corresponds to the JSON property `color`
|
1693
|
+
# @return [Google::Apis::VisionV1::Color]
|
1694
|
+
attr_accessor :color
|
1640
1695
|
|
1641
|
-
#
|
1642
|
-
# Not normalized and not comparable across different image queries.
|
1696
|
+
# Image-specific score for this color. Value in range [0, 1].
|
1643
1697
|
# Corresponds to the JSON property `score`
|
1644
1698
|
# @return [Float]
|
1645
1699
|
attr_accessor :score
|
@@ -1650,135 +1704,75 @@ module Google
|
|
1650
1704
|
|
1651
1705
|
# Update properties of this object
|
1652
1706
|
def update!(**args)
|
1653
|
-
@
|
1654
|
-
@
|
1707
|
+
@pixel_fraction = args[:pixel_fraction] if args.key?(:pixel_fraction)
|
1708
|
+
@color = args[:color] if args.key?(:color)
|
1655
1709
|
@score = args[:score] if args.key?(:score)
|
1656
1710
|
end
|
1657
1711
|
end
|
1658
1712
|
|
1659
|
-
#
|
1660
|
-
class
|
1661
|
-
include Google::Apis::Core::Hashable
|
1662
|
-
|
1663
|
-
# The bounding polygon vertices.
|
1664
|
-
# Corresponds to the JSON property `vertices`
|
1665
|
-
# @return [Array<Google::Apis::VisionV1::Vertex>]
|
1666
|
-
attr_accessor :vertices
|
1667
|
-
|
1668
|
-
def initialize(**args)
|
1669
|
-
update!(**args)
|
1670
|
-
end
|
1671
|
-
|
1672
|
-
# Update properties of this object
|
1673
|
-
def update!(**args)
|
1674
|
-
@vertices = args[:vertices] if args.key?(:vertices)
|
1675
|
-
end
|
1676
|
-
end
|
1677
|
-
|
1678
|
-
# Response to an image annotation request.
|
1679
|
-
class AnnotateImageResponse
|
1713
|
+
# Set of detected entity features.
|
1714
|
+
class EntityAnnotation
|
1680
1715
|
include Google::Apis::Core::Hashable
|
1681
1716
|
|
1682
|
-
#
|
1683
|
-
#
|
1684
|
-
#
|
1685
|
-
#
|
1686
|
-
|
1687
|
-
# # Overview
|
1688
|
-
# The `Status` message contains three pieces of data: error code, error message,
|
1689
|
-
# and error details. The error code should be an enum value of
|
1690
|
-
# google.rpc.Code, but it may accept additional error codes if needed. The
|
1691
|
-
# error message should be a developer-facing English message that helps
|
1692
|
-
# developers *understand* and *resolve* the error. If a localized user-facing
|
1693
|
-
# error message is needed, put the localized message in the error details or
|
1694
|
-
# localize it in the client. The optional error details may contain arbitrary
|
1695
|
-
# information about the error. There is a predefined set of error detail types
|
1696
|
-
# in the package `google.rpc` which can be used for common error conditions.
|
1697
|
-
# # Language mapping
|
1698
|
-
# The `Status` message is the logical representation of the error model, but it
|
1699
|
-
# is not necessarily the actual wire format. When the `Status` message is
|
1700
|
-
# exposed in different client libraries and different wire protocols, it can be
|
1701
|
-
# mapped differently. For example, it will likely be mapped to some exceptions
|
1702
|
-
# in Java, but more likely mapped to some error codes in C.
|
1703
|
-
# # Other uses
|
1704
|
-
# The error model and the `Status` message can be used in a variety of
|
1705
|
-
# environments, either with or without APIs, to provide a
|
1706
|
-
# consistent developer experience across different environments.
|
1707
|
-
# Example uses of this error model include:
|
1708
|
-
# - Partial errors. If a service needs to return partial errors to the client,
|
1709
|
-
# it may embed the `Status` in the normal response to indicate the partial
|
1710
|
-
# errors.
|
1711
|
-
# - Workflow errors. A typical workflow has multiple steps. Each step may
|
1712
|
-
# have a `Status` message for error reporting purpose.
|
1713
|
-
# - Batch operations. If a client uses batch request and batch response, the
|
1714
|
-
# `Status` message should be used directly inside batch response, one for
|
1715
|
-
# each error sub-response.
|
1716
|
-
# - Asynchronous operations. If an API call embeds asynchronous operation
|
1717
|
-
# results in its response, the status of those operations should be
|
1718
|
-
# represented directly using the `Status` message.
|
1719
|
-
# - Logging. If some API errors are stored in logs, the message `Status` could
|
1720
|
-
# be used directly after any stripping needed for security/privacy reasons.
|
1721
|
-
# Corresponds to the JSON property `error`
|
1722
|
-
# @return [Google::Apis::VisionV1::Status]
|
1723
|
-
attr_accessor :error
|
1724
|
-
|
1725
|
-
# TextAnnotation contains a structured representation of OCR extracted text.
|
1726
|
-
# The hierarchy of an OCR extracted text structure is like this:
|
1727
|
-
# TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
|
1728
|
-
# Each structural component, starting from Page, may further have their own
|
1729
|
-
# properties. Properties describe detected languages, breaks etc.. Please
|
1730
|
-
# refer to the google.cloud.vision.v1.TextAnnotation.TextProperty message
|
1731
|
-
# definition below for more detail.
|
1732
|
-
# Corresponds to the JSON property `fullTextAnnotation`
|
1733
|
-
# @return [Google::Apis::VisionV1::TextAnnotation]
|
1734
|
-
attr_accessor :full_text_annotation
|
1735
|
-
|
1736
|
-
# If present, landmark detection has completed successfully.
|
1737
|
-
# Corresponds to the JSON property `landmarkAnnotations`
|
1738
|
-
# @return [Array<Google::Apis::VisionV1::EntityAnnotation>]
|
1739
|
-
attr_accessor :landmark_annotations
|
1717
|
+
# Some entities may have optional user-supplied `Property` (name/value)
|
1718
|
+
# fields, such a score or string that qualifies the entity.
|
1719
|
+
# Corresponds to the JSON property `properties`
|
1720
|
+
# @return [Array<Google::Apis::VisionV1::Property>]
|
1721
|
+
attr_accessor :properties
|
1740
1722
|
|
1741
|
-
#
|
1742
|
-
# Corresponds to the JSON property `
|
1743
|
-
# @return [
|
1744
|
-
attr_accessor :
|
1723
|
+
# Overall score of the result. Range [0, 1].
|
1724
|
+
# Corresponds to the JSON property `score`
|
1725
|
+
# @return [Float]
|
1726
|
+
attr_accessor :score
|
1745
1727
|
|
1746
|
-
#
|
1747
|
-
#
|
1748
|
-
#
|
1749
|
-
|
1728
|
+
# The location information for the detected entity. Multiple
|
1729
|
+
# `LocationInfo` elements can be present because one location may
|
1730
|
+
# indicate the location of the scene in the image, and another location
|
1731
|
+
# may indicate the location of the place where the image was taken.
|
1732
|
+
# Location information is usually present for landmarks.
|
1733
|
+
# Corresponds to the JSON property `locations`
|
1734
|
+
# @return [Array<Google::Apis::VisionV1::LocationInfo>]
|
1735
|
+
attr_accessor :locations
|
1750
1736
|
|
1751
|
-
#
|
1752
|
-
#
|
1753
|
-
#
|
1754
|
-
|
1737
|
+
# Opaque entity ID. Some IDs may be available in
|
1738
|
+
# [Google Knowledge Graph Search API](https://developers.google.com/knowledge-
|
1739
|
+
# graph/).
|
1740
|
+
# Corresponds to the JSON property `mid`
|
1741
|
+
# @return [String]
|
1742
|
+
attr_accessor :mid
|
1755
1743
|
|
1756
|
-
#
|
1757
|
-
#
|
1758
|
-
#
|
1759
|
-
|
1744
|
+
# The accuracy of the entity detection in an image.
|
1745
|
+
# For example, for an image in which the "Eiffel Tower" entity is detected,
|
1746
|
+
# this field represents the confidence that there is a tower in the query
|
1747
|
+
# image. Range [0, 1].
|
1748
|
+
# Corresponds to the JSON property `confidence`
|
1749
|
+
# @return [Float]
|
1750
|
+
attr_accessor :confidence
|
1760
1751
|
|
1761
|
-
#
|
1762
|
-
#
|
1763
|
-
#
|
1764
|
-
|
1752
|
+
# The language code for the locale in which the entity textual
|
1753
|
+
# `description` is expressed.
|
1754
|
+
# Corresponds to the JSON property `locale`
|
1755
|
+
# @return [String]
|
1756
|
+
attr_accessor :locale
|
1765
1757
|
|
1766
|
-
#
|
1767
|
-
# Corresponds to the JSON property `
|
1768
|
-
# @return [Google::Apis::VisionV1::
|
1769
|
-
attr_accessor :
|
1758
|
+
# A bounding polygon for the detected image annotation.
|
1759
|
+
# Corresponds to the JSON property `boundingPoly`
|
1760
|
+
# @return [Google::Apis::VisionV1::BoundingPoly]
|
1761
|
+
attr_accessor :bounding_poly
|
1770
1762
|
|
1771
|
-
#
|
1772
|
-
#
|
1773
|
-
#
|
1774
|
-
|
1775
|
-
# @return [Google::Apis::VisionV1::SafeSearchAnnotation]
|
1776
|
-
attr_accessor :safe_search_annotation
|
1763
|
+
# Entity textual description, expressed in its `locale` language.
|
1764
|
+
# Corresponds to the JSON property `description`
|
1765
|
+
# @return [String]
|
1766
|
+
attr_accessor :description
|
1777
1767
|
|
1778
|
-
#
|
1779
|
-
#
|
1780
|
-
#
|
1781
|
-
|
1768
|
+
# The relevancy of the ICA (Image Content Annotation) label to the
|
1769
|
+
# image. For example, the relevancy of "tower" is likely higher to an image
|
1770
|
+
# containing the detected "Eiffel Tower" than to an image containing a
|
1771
|
+
# detected distant towering building, even though the confidence that
|
1772
|
+
# there is a tower in each image may be the same. Range [0, 1].
|
1773
|
+
# Corresponds to the JSON property `topicality`
|
1774
|
+
# @return [Float]
|
1775
|
+
attr_accessor :topicality
|
1782
1776
|
|
1783
1777
|
def initialize(**args)
|
1784
1778
|
update!(**args)
|
@@ -1786,17 +1780,15 @@ module Google
|
|
1786
1780
|
|
1787
1781
|
# Update properties of this object
|
1788
1782
|
def update!(**args)
|
1789
|
-
@
|
1790
|
-
@
|
1791
|
-
@
|
1792
|
-
@
|
1793
|
-
@
|
1794
|
-
@
|
1795
|
-
@
|
1796
|
-
@
|
1797
|
-
@
|
1798
|
-
@safe_search_annotation = args[:safe_search_annotation] if args.key?(:safe_search_annotation)
|
1799
|
-
@label_annotations = args[:label_annotations] if args.key?(:label_annotations)
|
1783
|
+
@properties = args[:properties] if args.key?(:properties)
|
1784
|
+
@score = args[:score] if args.key?(:score)
|
1785
|
+
@locations = args[:locations] if args.key?(:locations)
|
1786
|
+
@mid = args[:mid] if args.key?(:mid)
|
1787
|
+
@confidence = args[:confidence] if args.key?(:confidence)
|
1788
|
+
@locale = args[:locale] if args.key?(:locale)
|
1789
|
+
@bounding_poly = args[:bounding_poly] if args.key?(:bounding_poly)
|
1790
|
+
@description = args[:description] if args.key?(:description)
|
1791
|
+
@topicality = args[:topicality] if args.key?(:topicality)
|
1800
1792
|
end
|
1801
1793
|
end
|
1802
1794
|
end
|