google-cloud-vision 0.28.0 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -0
- data/lib/google/cloud/vision.rb +33 -0
- data/lib/google/cloud/vision/v1.rb +42 -16
- data/lib/google/cloud/vision/v1/credentials.rb +33 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +15 -1
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +224 -46
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +36 -14
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +34 -7
- data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +92 -0
- data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/protobuf/wrappers.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/type/color.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/overview.rb +32 -6
- data/lib/google/cloud/vision/v1/geometry_pb.rb +6 -0
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +124 -27
- data/lib/google/cloud/vision/v1/image_annotator_client_config.json +5 -0
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +72 -0
- data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +9 -2
- data/lib/google/cloud/vision/v1/text_annotation_pb.rb +5 -0
- data/lib/google/cloud/vision/v1/web_detection_pb.rb +10 -0
- data/lib/google/cloud/vision/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc41171a8d422e7f64207e8dc1aca24666e227e849e9096886a18592c4899611
|
4
|
+
data.tar.gz: 8a9759d3870dbf1ef87f3a7c433f6bc731a8f2218393838d473a3c02f00733a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71cda3f0d570c19f57f7cac596005ea6c99a9e7d59a296845a1749723a520d287dd4b609fee2e0bfb0a31bfa1f071a131d0b5ab3ccfc2162087fbe2854a47256
|
7
|
+
data.tar.gz: 9740457dd6ce47815fa5d6317543ad37ae6af95230a35749680a96f0dc44eec9a876f8a4cbb7efdc4ff1fc43f753bec449e465a62ea97e1935d0b0ca2272d365
|
data/README.md
CHANGED
@@ -31,10 +31,39 @@ landmark = image.landmark
|
|
31
31
|
landmark.description #=> "Mount Rushmore"
|
32
32
|
```
|
33
33
|
|
34
|
+
## Enabling Logging
|
35
|
+
|
36
|
+
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below, or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger) that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb) and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
37
|
+
|
38
|
+
Configuring a Ruby stdlib logger:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
require "logger"
|
42
|
+
|
43
|
+
module MyLogger
|
44
|
+
LOGGER = Logger.new $stderr, level: Logger::WARN
|
45
|
+
def logger
|
46
|
+
LOGGER
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
51
|
+
module GRPC
|
52
|
+
extend MyLogger
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
34
56
|
## Supported Ruby Versions
|
35
57
|
|
36
58
|
This library is supported on Ruby 2.0+.
|
37
59
|
|
60
|
+
However, Ruby 2.3 or later is strongly recommended, as earlier releases have
|
61
|
+
reached or are nearing end-of-life. After June 1, 2018, Google will provide
|
62
|
+
official support only for Ruby versions that are considered current and
|
63
|
+
supported by Ruby Core (that is, Ruby versions that are either in normal
|
64
|
+
maintenance or in security maintenance).
|
65
|
+
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
|
66
|
+
|
38
67
|
## Versioning
|
39
68
|
|
40
69
|
This library follows [Semantic Versioning](http://semver.org/).
|
data/lib/google/cloud/vision.rb
CHANGED
@@ -40,6 +40,39 @@ module Google
|
|
40
40
|
# [Authentication
|
41
41
|
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
42
42
|
#
|
43
|
+
# ## Enabling Logging
|
44
|
+
#
|
45
|
+
# To enable logging for this library, set the logger for the underlying
|
46
|
+
# [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The
|
47
|
+
# logger that you set may be a Ruby stdlib
|
48
|
+
# [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html)
|
49
|
+
# as shown below, or a
|
50
|
+
# [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
51
|
+
# that will write logs to [Stackdriver
|
52
|
+
# Logging](https://cloud.google.com/logging/). See
|
53
|
+
# [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
54
|
+
# and the gRPC
|
55
|
+
# [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb)
|
56
|
+
# for additional information.
|
57
|
+
#
|
58
|
+
# Configuring a Ruby stdlib logger:
|
59
|
+
#
|
60
|
+
# ```ruby
|
61
|
+
# require "logger"
|
62
|
+
#
|
63
|
+
# module MyLogger
|
64
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
65
|
+
# def logger
|
66
|
+
# LOGGER
|
67
|
+
# end
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
71
|
+
# module GRPC
|
72
|
+
# extend MyLogger
|
73
|
+
# end
|
74
|
+
# ```
|
75
|
+
#
|
43
76
|
# ## Creating images
|
44
77
|
#
|
45
78
|
# The Cloud Vision API supports UTF-8, UTF-16, and UTF-32 text encodings.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -13,15 +13,16 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
require "google/cloud/vision/v1/image_annotator_client"
|
16
|
+
require "google/cloud/vision/v1/image_annotator_pb"
|
16
17
|
|
17
18
|
module Google
|
18
19
|
module Cloud
|
19
20
|
# rubocop:disable LineLength
|
20
21
|
|
21
22
|
##
|
22
|
-
# # Ruby Client for
|
23
|
+
# # Ruby Client for Cloud Vision API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
23
24
|
#
|
24
|
-
# [
|
25
|
+
# [Cloud Vision API][Product Documentation]:
|
25
26
|
# Integrates Google Vision features, including image labeling, face, logo, and
|
26
27
|
# landmark detection, optical character recognition (OCR), and detection of
|
27
28
|
# explicit content, into applications.
|
@@ -32,8 +33,9 @@ module Google
|
|
32
33
|
# steps:
|
33
34
|
#
|
34
35
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
35
|
-
# 2. [Enable
|
36
|
-
# 3. [
|
36
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
37
|
+
# 3. [Enable the Cloud Vision API.](https://console.cloud.google.com/apis/api/vision)
|
38
|
+
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
39
|
#
|
38
40
|
# ### Preview
|
39
41
|
# #### ImageAnnotatorClient
|
@@ -53,13 +55,38 @@ module Google
|
|
53
55
|
# ```
|
54
56
|
#
|
55
57
|
# ### Next Steps
|
56
|
-
# - Read the [
|
58
|
+
# - Read the [Cloud Vision API Product documentation][Product Documentation]
|
57
59
|
# to learn more about the product and see How-to Guides.
|
58
60
|
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
59
61
|
# to see the full list of Cloud APIs that we cover.
|
60
62
|
#
|
61
63
|
# [Product Documentation]: https://cloud.google.com/vision
|
62
64
|
#
|
65
|
+
# ## Enabling Logging
|
66
|
+
#
|
67
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
68
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
69
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
70
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
71
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
72
|
+
#
|
73
|
+
# Configuring a Ruby stdlib logger:
|
74
|
+
#
|
75
|
+
# ```ruby
|
76
|
+
# require "logger"
|
77
|
+
#
|
78
|
+
# module MyLogger
|
79
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
80
|
+
# def logger
|
81
|
+
# LOGGER
|
82
|
+
# end
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
86
|
+
# module GRPC
|
87
|
+
# extend MyLogger
|
88
|
+
# end
|
89
|
+
# ```
|
63
90
|
#
|
64
91
|
module Vision
|
65
92
|
module V1
|
@@ -94,28 +121,27 @@ module Google
|
|
94
121
|
# or the specified config is missing data points.
|
95
122
|
# @param timeout [Numeric]
|
96
123
|
# The default timeout, in seconds, for calls made through this client.
|
124
|
+
# @param metadata [Hash]
|
125
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
126
|
+
# @param exception_transformer [Proc]
|
127
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
128
|
+
# custom error handling.
|
97
129
|
def self.new \
|
98
|
-
service_path: nil,
|
99
|
-
port: nil,
|
100
|
-
channel: nil,
|
101
|
-
chan_creds: nil,
|
102
|
-
updater_proc: nil,
|
103
130
|
credentials: nil,
|
104
131
|
scopes: nil,
|
105
132
|
client_config: nil,
|
106
133
|
timeout: nil,
|
134
|
+
metadata: nil,
|
135
|
+
exception_transformer: nil,
|
107
136
|
lib_name: nil,
|
108
137
|
lib_version: nil
|
109
138
|
kwargs = {
|
110
|
-
service_path: service_path,
|
111
|
-
port: port,
|
112
|
-
channel: channel,
|
113
|
-
chan_creds: chan_creds,
|
114
|
-
updater_proc: updater_proc,
|
115
139
|
credentials: credentials,
|
116
140
|
scopes: scopes,
|
117
141
|
client_config: client_config,
|
118
142
|
timeout: timeout,
|
143
|
+
metadata: metadata,
|
144
|
+
exception_transformer: exception_transformer,
|
119
145
|
lib_name: lib_name,
|
120
146
|
lib_version: lib_version
|
121
147
|
}.select { |_, v| v != nil }
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "googleauth"
|
16
|
+
|
17
|
+
module Google
|
18
|
+
module Cloud
|
19
|
+
module Vision
|
20
|
+
module V1
|
21
|
+
class Credentials < Google::Auth::Credentials
|
22
|
+
SCOPE = [
|
23
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
24
|
+
"https://www.googleapis.com/auth/cloud-vision"
|
25
|
+
].freeze
|
26
|
+
PATH_ENV_VARS = %w(VISION_KEYFILE GOOGLE_CLOUD_KEYFILE GCLOUD_KEYFILE)
|
27
|
+
JSON_ENV_VARS = %w(VISION_KEYFILE_JSON GOOGLE_CLOUD_KEYFILE_JSON GCLOUD_KEYFILE_JSON)
|
28
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -26,10 +26,24 @@ module Google
|
|
26
26
|
# Y coordinate.
|
27
27
|
class Vertex; end
|
28
28
|
|
29
|
+
# A vertex represents a 2D point in the image.
|
30
|
+
# NOTE: the normalized vertex coordinates are relative to the original image
|
31
|
+
# and range from 0 to 1.
|
32
|
+
# @!attribute [rw] x
|
33
|
+
# @return [Float]
|
34
|
+
# X coordinate.
|
35
|
+
# @!attribute [rw] y
|
36
|
+
# @return [Float]
|
37
|
+
# Y coordinate.
|
38
|
+
class NormalizedVertex; end
|
39
|
+
|
29
40
|
# A bounding polygon for the detected image annotation.
|
30
41
|
# @!attribute [rw] vertices
|
31
42
|
# @return [Array<Google::Cloud::Vision::V1::Vertex>]
|
32
43
|
# The bounding polygon vertices.
|
44
|
+
# @!attribute [rw] normalized_vertices
|
45
|
+
# @return [Array<Google::Cloud::Vision::V1::NormalizedVertex>]
|
46
|
+
# The bounding polygon normalized vertices.
|
33
47
|
class BoundingPoly; end
|
34
48
|
|
35
49
|
# A 3D position in the image, used primarily for Face detection landmarks.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -16,29 +16,34 @@ module Google
|
|
16
16
|
module Cloud
|
17
17
|
module Vision
|
18
18
|
##
|
19
|
-
# #
|
19
|
+
# # Cloud Vision API Contents
|
20
20
|
#
|
21
21
|
# | Class | Description |
|
22
22
|
# | ----- | ----------- |
|
23
|
-
# | [ImageAnnotatorClient][] |
|
23
|
+
# | [ImageAnnotatorClient][] | Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. |
|
24
24
|
# | [Data Types][] | Data types for Google::Cloud::Vision::V1 |
|
25
25
|
#
|
26
26
|
# [ImageAnnotatorClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-vision/latest/google/cloud/vision/v1/imageannotatorclient
|
27
27
|
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-vision/latest/google/cloud/vision/v1/datatypes
|
28
28
|
#
|
29
29
|
module V1
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# vertical to operate on and the number of top-scoring results to return.
|
30
|
+
# The type of Google Cloud Vision API detection to perform, and the maximum
|
31
|
+
# number of results to return for that type. Multiple +Feature+ objects can
|
32
|
+
# be specified in the +features+ list.
|
34
33
|
# @!attribute [rw] type
|
35
34
|
# @return [Google::Cloud::Vision::V1::Feature::Type]
|
36
35
|
# The feature type.
|
37
36
|
# @!attribute [rw] max_results
|
38
37
|
# @return [Integer]
|
39
|
-
# Maximum number of results of this type.
|
38
|
+
# Maximum number of results of this type. Does not apply to
|
39
|
+
# +TEXT_DETECTION+, +DOCUMENT_TEXT_DETECTION+, or +CROP_HINTS+.
|
40
|
+
# @!attribute [rw] model
|
41
|
+
# @return [String]
|
42
|
+
# Model to use for the feature.
|
43
|
+
# Supported values: "builtin/stable" (the default if unset) and
|
44
|
+
# "builtin/latest".
|
40
45
|
class Feature
|
41
|
-
# Type of
|
46
|
+
# Type of Google Cloud Vision API feature to be extracted.
|
42
47
|
module Type
|
43
48
|
# Unspecified feature type.
|
44
49
|
TYPE_UNSPECIFIED = 0
|
@@ -55,17 +60,21 @@ module Google
|
|
55
60
|
# Run label detection.
|
56
61
|
LABEL_DETECTION = 4
|
57
62
|
|
58
|
-
# Run OCR.
|
63
|
+
# Run text detection / optical character recognition (OCR). Text detection
|
64
|
+
# is optimized for areas of text within a larger image; if the image is
|
65
|
+
# a document, use +DOCUMENT_TEXT_DETECTION+ instead.
|
59
66
|
TEXT_DETECTION = 5
|
60
67
|
|
61
68
|
# Run dense text document OCR. Takes precedence when both
|
62
|
-
# DOCUMENT_TEXT_DETECTION and TEXT_DETECTION are present.
|
69
|
+
# +DOCUMENT_TEXT_DETECTION+ and +TEXT_DETECTION+ are present.
|
63
70
|
DOCUMENT_TEXT_DETECTION = 11
|
64
71
|
|
65
|
-
# Run
|
72
|
+
# Run Safe Search to detect potentially unsafe
|
73
|
+
# or undesirable content.
|
66
74
|
SAFE_SEARCH_DETECTION = 6
|
67
75
|
|
68
|
-
# Compute a set of image properties, such as the
|
76
|
+
# Compute a set of image properties, such as the
|
77
|
+
# image's dominant colors.
|
69
78
|
IMAGE_PROPERTIES = 7
|
70
79
|
|
71
80
|
# Run crop hints.
|
@@ -76,26 +85,33 @@ module Google
|
|
76
85
|
end
|
77
86
|
end
|
78
87
|
|
79
|
-
# External image source (Google Cloud Storage image location).
|
88
|
+
# External image source (Google Cloud Storage or web URL image location).
|
80
89
|
# @!attribute [rw] gcs_image_uri
|
81
90
|
# @return [String]
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
91
|
+
# **Use +image_uri+ instead.**
|
92
|
+
#
|
93
|
+
# The Google Cloud Storage URI of the form
|
94
|
+
# +gs://bucket_name/object_name+. Object versioning is not supported. See
|
85
95
|
# [Google Cloud Storage Request
|
86
|
-
# URIs](https://cloud.google.com/storage/docs/reference-uris)
|
87
|
-
# NOTE: Cloud Storage object versioning is not supported.
|
96
|
+
# URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
|
88
97
|
# @!attribute [rw] image_uri
|
89
98
|
# @return [String]
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
+
# The URI of the source image. Can be either:
|
100
|
+
#
|
101
|
+
# 1. A Google Cloud Storage URI of the form
|
102
|
+
# +gs://bucket_name/object_name+. Object versioning is not supported. See
|
103
|
+
# [Google Cloud Storage Request
|
104
|
+
# URIs](https://cloud.google.com/storage/docs/reference-uris) for more
|
105
|
+
# info.
|
106
|
+
#
|
107
|
+
# 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
|
108
|
+
# HTTP/HTTPS URLs, Google cannot guarantee that the request will be
|
109
|
+
# completed. Your request may fail if the specified host denies the
|
110
|
+
# request (e.g. due to request throttling or DOS prevention), or if Google
|
111
|
+
# throttles requests to the site for abuse prevention. You should not
|
112
|
+
# depend on externally-hosted images for production applications.
|
113
|
+
#
|
114
|
+
# When both +gcs_image_uri+ and +image_uri+ are specified, +image_uri+ takes
|
99
115
|
# precedence.
|
100
116
|
class ImageSource; end
|
101
117
|
|
@@ -103,13 +119,13 @@ module Google
|
|
103
119
|
# @!attribute [rw] content
|
104
120
|
# @return [String]
|
105
121
|
# Image content, represented as a stream of bytes.
|
106
|
-
# Note:
|
122
|
+
# Note: As with all +bytes+ fields, protobuffers use a pure binary
|
107
123
|
# representation, whereas JSON representations use base64.
|
108
124
|
# @!attribute [rw] source
|
109
125
|
# @return [Google::Cloud::Vision::V1::ImageSource]
|
110
|
-
# Google Cloud Storage image location
|
111
|
-
# are provided for an image, +content+
|
112
|
-
# used to perform the image annotation request.
|
126
|
+
# Google Cloud Storage image location, or publicly-accessible image
|
127
|
+
# URL. If both +content+ and +source+ are provided for an image, +content+
|
128
|
+
# takes precedence and is used to perform the image annotation request.
|
113
129
|
class Image; end
|
114
130
|
|
115
131
|
# A face annotation object contains the results of face detection.
|
@@ -176,10 +192,6 @@ module Google
|
|
176
192
|
# Headwear likelihood.
|
177
193
|
class FaceAnnotation
|
178
194
|
# A face-specific landmark (for example, a face feature).
|
179
|
-
# Landmark positions may fall outside the bounds of the image
|
180
|
-
# if the face is near one or more edges of the image.
|
181
|
-
# Therefore it is NOT guaranteed that +0 <= x < width+ or
|
182
|
-
# +0 <= y < height+.
|
183
195
|
# @!attribute [rw] type
|
184
196
|
# @return [Google::Cloud::Vision::V1::FaceAnnotation::Landmark::Type]
|
185
197
|
# Face landmark type.
|
@@ -313,13 +325,17 @@ module Google
|
|
313
325
|
# @!attribute [rw] value
|
314
326
|
# @return [String]
|
315
327
|
# Value of the property.
|
328
|
+
# @!attribute [rw] uint64_value
|
329
|
+
# @return [Integer]
|
330
|
+
# Value of numeric properties.
|
316
331
|
class Property; end
|
317
332
|
|
318
333
|
# Set of detected entity features.
|
319
334
|
# @!attribute [rw] mid
|
320
335
|
# @return [String]
|
321
336
|
# Opaque entity ID. Some IDs may be available in
|
322
|
-
# [Google Knowledge Graph Search
|
337
|
+
# [Google Knowledge Graph Search
|
338
|
+
# API](https://developers.google.com/knowledge-graph/).
|
323
339
|
# @!attribute [rw] locale
|
324
340
|
# @return [String]
|
325
341
|
# The language code for the locale in which the entity textual
|
@@ -332,6 +348,7 @@ module Google
|
|
332
348
|
# Overall score of the result. Range [0, 1].
|
333
349
|
# @!attribute [rw] confidence
|
334
350
|
# @return [Float]
|
351
|
+
# **Deprecated. Use +score+ instead.**
|
335
352
|
# The accuracy of the entity detection in an image.
|
336
353
|
# For example, for an image in which the "Eiffel Tower" entity is detected,
|
337
354
|
# this field represents the confidence that there is a tower in the query
|
@@ -345,10 +362,8 @@ module Google
|
|
345
362
|
# there is a tower in each image may be the same. Range [0, 1].
|
346
363
|
# @!attribute [rw] bounding_poly
|
347
364
|
# @return [Google::Cloud::Vision::V1::BoundingPoly]
|
348
|
-
# Image region to which this entity belongs.
|
349
|
-
# for +LABEL_DETECTION+ features.
|
350
|
-
# are produced for the entire text detected in an image region, followed by
|
351
|
-
# +boundingPoly+s for each word within the detected text.
|
365
|
+
# Image region to which this entity belongs. Not produced
|
366
|
+
# for +LABEL_DETECTION+ features.
|
352
367
|
# @!attribute [rw] locations
|
353
368
|
# @return [Array<Google::Cloud::Vision::V1::LocationInfo>]
|
354
369
|
# The location information for the detected entity. Multiple
|
@@ -367,7 +382,9 @@ module Google
|
|
367
382
|
# violence).
|
368
383
|
# @!attribute [rw] adult
|
369
384
|
# @return [Google::Cloud::Vision::V1::Likelihood]
|
370
|
-
# Represents the adult content likelihood for the image.
|
385
|
+
# Represents the adult content likelihood for the image. Adult content may
|
386
|
+
# contain elements such as nudity, pornographic images or cartoons, or
|
387
|
+
# sexual activities.
|
371
388
|
# @!attribute [rw] spoof
|
372
389
|
# @return [Google::Cloud::Vision::V1::Likelihood]
|
373
390
|
# Spoof likelihood. The likelihood that an modification
|
@@ -378,7 +395,13 @@ module Google
|
|
378
395
|
# Likelihood that this is a medical image.
|
379
396
|
# @!attribute [rw] violence
|
380
397
|
# @return [Google::Cloud::Vision::V1::Likelihood]
|
381
|
-
#
|
398
|
+
# Likelihood that this image contains violent content.
|
399
|
+
# @!attribute [rw] racy
|
400
|
+
# @return [Google::Cloud::Vision::V1::Likelihood]
|
401
|
+
# Likelihood that the request image contains racy content. Racy content may
|
402
|
+
# include (but is not limited to) skimpy or sheer clothing, strategically
|
403
|
+
# covered nudity, lewd or provocative poses, or close-ups of sensitive
|
404
|
+
# body areas.
|
382
405
|
class SafeSearchAnnotation; end
|
383
406
|
|
384
407
|
# Rectangle determined by min and max +LatLng+ pairs.
|
@@ -433,6 +456,7 @@ module Google
|
|
433
456
|
# Set of crop hints that are used to generate new crops when serving images.
|
434
457
|
# @!attribute [rw] crop_hints
|
435
458
|
# @return [Array<Google::Cloud::Vision::V1::CropHint>]
|
459
|
+
# Crop hint results.
|
436
460
|
class CropHintsAnnotation; end
|
437
461
|
|
438
462
|
# Parameters for crop hints annotation request.
|
@@ -446,10 +470,16 @@ module Google
|
|
446
470
|
# ignored.
|
447
471
|
class CropHintsParams; end
|
448
472
|
|
473
|
+
# Parameters for web detection request.
|
474
|
+
# @!attribute [rw] include_geo_results
|
475
|
+
# @return [true, false]
|
476
|
+
# Whether to include results derived from the geo information in the image.
|
477
|
+
class WebDetectionParams; end
|
478
|
+
|
449
479
|
# Image context and/or feature-specific parameters.
|
450
480
|
# @!attribute [rw] lat_long_rect
|
451
481
|
# @return [Google::Cloud::Vision::V1::LatLongRect]
|
452
|
-
#
|
482
|
+
# Not used.
|
453
483
|
# @!attribute [rw] language_hints
|
454
484
|
# @return [Array<String>]
|
455
485
|
# List of languages to use for TEXT_DETECTION. In most cases, an empty value
|
@@ -463,6 +493,9 @@ module Google
|
|
463
493
|
# @!attribute [rw] crop_hints_params
|
464
494
|
# @return [Google::Cloud::Vision::V1::CropHintsParams]
|
465
495
|
# Parameters for crop hints annotation request.
|
496
|
+
# @!attribute [rw] web_detection_params
|
497
|
+
# @return [Google::Cloud::Vision::V1::WebDetectionParams]
|
498
|
+
# Parameters for web detection.
|
466
499
|
class ImageContext; end
|
467
500
|
|
468
501
|
# Request for performing Google Cloud Vision API tasks over a user-provided
|
@@ -478,6 +511,17 @@ module Google
|
|
478
511
|
# Additional context that may accompany the image.
|
479
512
|
class AnnotateImageRequest; end
|
480
513
|
|
514
|
+
# If an image was produced from a file (e.g. a PDF), this message gives
|
515
|
+
# information about the source of that image.
|
516
|
+
# @!attribute [rw] uri
|
517
|
+
# @return [String]
|
518
|
+
# The URI of the file used to produce the image.
|
519
|
+
# @!attribute [rw] page_number
|
520
|
+
# @return [Integer]
|
521
|
+
# If the file was a PDF or TIFF, this field gives the page number within
|
522
|
+
# the file used to produce the image.
|
523
|
+
class ImageAnnotationContext; end
|
524
|
+
|
481
525
|
# Response to an image annotation request.
|
482
526
|
# @!attribute [rw] face_annotations
|
483
527
|
# @return [Array<Google::Cloud::Vision::V1::FaceAnnotation>]
|
@@ -493,8 +537,7 @@ module Google
|
|
493
537
|
# If present, label detection has completed successfully.
|
494
538
|
# @!attribute [rw] text_annotations
|
495
539
|
# @return [Array<Google::Cloud::Vision::V1::EntityAnnotation>]
|
496
|
-
# If present, text (OCR) detection
|
497
|
-
# completed successfully.
|
540
|
+
# If present, text (OCR) detection has completed successfully.
|
498
541
|
# @!attribute [rw] full_text_annotation
|
499
542
|
# @return [Google::Cloud::Vision::V1::TextAnnotation]
|
500
543
|
# If present, text (OCR) detection or document (OCR) text detection has
|
@@ -518,8 +561,22 @@ module Google
|
|
518
561
|
# If set, represents the error message for the operation.
|
519
562
|
# Note that filled-in image annotations are guaranteed to be
|
520
563
|
# correct, even when +error+ is set.
|
564
|
+
# @!attribute [rw] context
|
565
|
+
# @return [Google::Cloud::Vision::V1::ImageAnnotationContext]
|
566
|
+
# If present, contextual information is needed to understand where this image
|
567
|
+
# comes from.
|
521
568
|
class AnnotateImageResponse; end
|
522
569
|
|
570
|
+
# Response to a single file annotation request. A file may contain one or more
|
571
|
+
# images, which individually have their own responses.
|
572
|
+
# @!attribute [rw] input_config
|
573
|
+
# @return [Google::Cloud::Vision::V1::InputConfig]
|
574
|
+
# Information about the file for which this response is generated.
|
575
|
+
# @!attribute [rw] responses
|
576
|
+
# @return [Array<Google::Cloud::Vision::V1::AnnotateImageResponse>]
|
577
|
+
# Individual responses to images found within the file.
|
578
|
+
class AnnotateFileResponse; end
|
579
|
+
|
523
580
|
# Multiple image annotation requests are batched into a single service call.
|
524
581
|
# @!attribute [rw] requests
|
525
582
|
# @return [Array<Google::Cloud::Vision::V1::AnnotateImageRequest>]
|
@@ -532,6 +589,127 @@ module Google
|
|
532
589
|
# Individual responses to image annotation requests within the batch.
|
533
590
|
class BatchAnnotateImagesResponse; end
|
534
591
|
|
592
|
+
# An offline file annotation request.
|
593
|
+
# @!attribute [rw] input_config
|
594
|
+
# @return [Google::Cloud::Vision::V1::InputConfig]
|
595
|
+
# Required. Information about the input file.
|
596
|
+
# @!attribute [rw] features
|
597
|
+
# @return [Array<Google::Cloud::Vision::V1::Feature>]
|
598
|
+
# Required. Requested features.
|
599
|
+
# @!attribute [rw] image_context
|
600
|
+
# @return [Google::Cloud::Vision::V1::ImageContext]
|
601
|
+
# Additional context that may accompany the image(s) in the file.
|
602
|
+
# @!attribute [rw] output_config
|
603
|
+
# @return [Google::Cloud::Vision::V1::OutputConfig]
|
604
|
+
# Required. The desired output location and metadata (e.g. format).
|
605
|
+
class AsyncAnnotateFileRequest; end
|
606
|
+
|
607
|
+
# The response for a single offline file annotation request.
|
608
|
+
# @!attribute [rw] output_config
|
609
|
+
# @return [Google::Cloud::Vision::V1::OutputConfig]
|
610
|
+
# The output location and metadata from AsyncAnnotateFileRequest.
|
611
|
+
class AsyncAnnotateFileResponse; end
|
612
|
+
|
613
|
+
# Multiple async file annotation requests are batched into a single service
|
614
|
+
# call.
|
615
|
+
# @!attribute [rw] requests
|
616
|
+
# @return [Array<Google::Cloud::Vision::V1::AsyncAnnotateFileRequest>]
|
617
|
+
# Individual async file annotation requests for this batch.
|
618
|
+
class AsyncBatchAnnotateFilesRequest; end
|
619
|
+
|
620
|
+
# Response to an async batch file annotation request.
|
621
|
+
# @!attribute [rw] responses
|
622
|
+
# @return [Array<Google::Cloud::Vision::V1::AsyncAnnotateFileResponse>]
|
623
|
+
# The list of file annotation responses, one for each request in
|
624
|
+
# AsyncBatchAnnotateFilesRequest.
|
625
|
+
class AsyncBatchAnnotateFilesResponse; end
|
626
|
+
|
627
|
+
# The desired input location and metadata.
|
628
|
+
# @!attribute [rw] gcs_source
|
629
|
+
# @return [Google::Cloud::Vision::V1::GcsSource]
|
630
|
+
# The Google Cloud Storage location to read the input from.
|
631
|
+
# @!attribute [rw] mime_type
|
632
|
+
# @return [String]
|
633
|
+
# The type of the file. Currently only "application/pdf" and "image/tiff"
|
634
|
+
# are supported. Wildcards are not supported.
|
635
|
+
class InputConfig; end
|
636
|
+
|
637
|
+
# The desired output location and metadata.
|
638
|
+
# @!attribute [rw] gcs_destination
|
639
|
+
# @return [Google::Cloud::Vision::V1::GcsDestination]
|
640
|
+
# The Google Cloud Storage location to write the output(s) to.
|
641
|
+
# @!attribute [rw] batch_size
|
642
|
+
# @return [Integer]
|
643
|
+
# The max number of response protos to put into each output JSON file on
|
644
|
+
# Google Cloud Storage.
|
645
|
+
# The valid range is [1, 100]. If not specified, the default value is 20.
|
646
|
+
#
|
647
|
+
# For example, for one pdf file with 100 pages, 100 response protos will
|
648
|
+
# be generated. If +batch_size+ = 20, then 5 json files each
|
649
|
+
# containing 20 response protos will be written under the prefix
|
650
|
+
# +gcs_destination+.+uri+.
|
651
|
+
#
|
652
|
+
# Currently, batch_size only applies to GcsDestination, with potential future
|
653
|
+
# support for other output configurations.
|
654
|
+
class OutputConfig; end
|
655
|
+
|
656
|
+
# The Google Cloud Storage location where the input will be read from.
|
657
|
+
# @!attribute [rw] uri
|
658
|
+
# @return [String]
|
659
|
+
# Google Cloud Storage URI for the input file. This must only be a
|
660
|
+
# Google Cloud Storage object. Wildcards are not currently supported.
|
661
|
+
class GcsSource; end
|
662
|
+
|
663
|
+
# The Google Cloud Storage location where the output will be written to.
|
664
|
+
# @!attribute [rw] uri
|
665
|
+
# @return [String]
|
666
|
+
# Google Cloud Storage URI where the results will be stored. Results will
|
667
|
+
# be in JSON format and preceded by its corresponding input URI. This field
|
668
|
+
# can either represent a single file, or a prefix for multiple outputs.
|
669
|
+
# Prefixes must end in a +/+.
|
670
|
+
#
|
671
|
+
# Examples:
|
672
|
+
#
|
673
|
+
# * File: gs://bucket-name/filename.json
|
674
|
+
# * Prefix: gs://bucket-name/prefix/here/
|
675
|
+
# * File: gs://bucket-name/prefix/here
|
676
|
+
#
|
677
|
+
# If multiple outputs, each response is still AnnotateFileResponse, each of
|
678
|
+
# which contains some subset of the full list of AnnotateImageResponse.
|
679
|
+
# Multiple outputs can happen if, for example, the output JSON is too large
|
680
|
+
# and overflows into multiple sharded files.
|
681
|
+
class GcsDestination; end
|
682
|
+
|
683
|
+
# Contains metadata for the BatchAnnotateImages operation.
|
684
|
+
# @!attribute [rw] state
|
685
|
+
# @return [Google::Cloud::Vision::V1::OperationMetadata::State]
|
686
|
+
# Current state of the batch operation.
|
687
|
+
# @!attribute [rw] create_time
|
688
|
+
# @return [Google::Protobuf::Timestamp]
|
689
|
+
# The time when the batch request was received.
|
690
|
+
# @!attribute [rw] update_time
|
691
|
+
# @return [Google::Protobuf::Timestamp]
|
692
|
+
# The time when the operation result was last updated.
|
693
|
+
class OperationMetadata
|
694
|
+
# Batch operation states.
|
695
|
+
module State
|
696
|
+
# Invalid.
|
697
|
+
STATE_UNSPECIFIED = 0
|
698
|
+
|
699
|
+
# Request is received.
|
700
|
+
CREATED = 1
|
701
|
+
|
702
|
+
# Request is actively being processed.
|
703
|
+
RUNNING = 2
|
704
|
+
|
705
|
+
# The batch processing is done.
|
706
|
+
DONE = 3
|
707
|
+
|
708
|
+
# The batch processing was cancelled.
|
709
|
+
CANCELLED = 4
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
535
713
|
# A bucketized representation of likelihood, which is intended to give clients
|
536
714
|
# highly stable results across model upgrades.
|
537
715
|
module Likelihood
|