google-cloud-vision 0.22.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/vision.rb +133 -6
- data/lib/google/cloud/vision/annotate.rb +55 -24
- data/lib/google/cloud/vision/annotation.rb +93 -11
- data/lib/google/cloud/vision/annotation/crop_hint.rb +126 -0
- data/lib/google/cloud/vision/annotation/text.rb +789 -11
- data/lib/google/cloud/vision/annotation/web.rb +420 -0
- data/lib/google/cloud/vision/image.rb +153 -17
- data/lib/google/cloud/vision/project.rb +29 -8
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +148 -81
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +231 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +73 -0
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +4 -4
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +24 -0
- data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +3 -3
- data/lib/google/cloud/vision/v1/text_annotation_pb.rb +88 -0
- data/lib/google/cloud/vision/v1/web_detection_pb.rb +40 -0
- data/lib/google/cloud/vision/version.rb +1 -1
- metadata +8 -2
@@ -0,0 +1,231 @@
|
|
1
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
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
|
+
# http://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
|
+
module Google
|
16
|
+
module Cloud
|
17
|
+
module Vision
|
18
|
+
module V1
|
19
|
+
# TextAnnotation contains a structured representation of OCR extracted text.
|
20
|
+
# The hierarchy of an OCR extracted text structure is like this:
|
21
|
+
# TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
|
22
|
+
# Each structural component, starting from Page, may further have their own
|
23
|
+
# properties. Properties describe detected languages, breaks etc.. Please
|
24
|
+
# refer to the Google::Cloud::Vision::V1::TextAnnotation::TextProperty message
|
25
|
+
# definition below for more detail.
|
26
|
+
# @!attribute [rw] pages
|
27
|
+
# @return [Array<Google::Cloud::Vision::V1::Page>]
|
28
|
+
# List of pages detected by OCR.
|
29
|
+
# @!attribute [rw] text
|
30
|
+
# @return [String]
|
31
|
+
# UTF-8 text detected on the pages.
|
32
|
+
class TextAnnotation
|
33
|
+
# Detected language for a structural component.
|
34
|
+
# @!attribute [rw] language_code
|
35
|
+
# @return [String]
|
36
|
+
# The BCP-47 language code, such as "en-US" or "sr-Latn". For more
|
37
|
+
# information, see
|
38
|
+
# http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
|
39
|
+
# @!attribute [rw] confidence
|
40
|
+
# @return [Float]
|
41
|
+
# Confidence of detected language. Range [0, 1].
|
42
|
+
class DetectedLanguage; end
|
43
|
+
|
44
|
+
# Detected start or end of a structural component.
|
45
|
+
# @!attribute [rw] type
|
46
|
+
# @return [Google::Cloud::Vision::V1::TextAnnotation::DetectedBreak::BreakType]
|
47
|
+
# @!attribute [rw] is_prefix
|
48
|
+
# @return [true, false]
|
49
|
+
# True if break prepends the element.
|
50
|
+
class DetectedBreak
|
51
|
+
# Enum to denote the type of break found. New line, space etc.
|
52
|
+
module BreakType
|
53
|
+
# Unknown break label type.
|
54
|
+
UNKNOWN = 0
|
55
|
+
|
56
|
+
# Regular space.
|
57
|
+
SPACE = 1
|
58
|
+
|
59
|
+
# Sure space (very wide).
|
60
|
+
SURE_SPACE = 2
|
61
|
+
|
62
|
+
# Line-wrapping break.
|
63
|
+
EOL_SURE_SPACE = 3
|
64
|
+
|
65
|
+
# End-line hyphen that is not present in text; does
|
66
|
+
HYPHEN = 4
|
67
|
+
|
68
|
+
# not co-occur with SPACE, LEADER_SPACE, or
|
69
|
+
# LINE_BREAK.
|
70
|
+
# Line break that ends a paragraph.
|
71
|
+
LINE_BREAK = 5
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Additional information detected on the structural component.
|
76
|
+
# @!attribute [rw] detected_languages
|
77
|
+
# @return [Array<Google::Cloud::Vision::V1::TextAnnotation::DetectedLanguage>]
|
78
|
+
# A list of detected languages together with confidence.
|
79
|
+
# @!attribute [rw] detected_break
|
80
|
+
# @return [Google::Cloud::Vision::V1::TextAnnotation::DetectedBreak]
|
81
|
+
# Detected start or end of a text segment.
|
82
|
+
class TextProperty; end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Detected page from OCR.
|
86
|
+
# @!attribute [rw] property
|
87
|
+
# @return [Google::Cloud::Vision::V1::TextAnnotation::TextProperty]
|
88
|
+
# Additional information detected on the page.
|
89
|
+
# @!attribute [rw] width
|
90
|
+
# @return [Integer]
|
91
|
+
# Page width in pixels.
|
92
|
+
# @!attribute [rw] height
|
93
|
+
# @return [Integer]
|
94
|
+
# Page height in pixels.
|
95
|
+
# @!attribute [rw] blocks
|
96
|
+
# @return [Array<Google::Cloud::Vision::V1::Block>]
|
97
|
+
# List of blocks of text, images etc on this page.
|
98
|
+
class Page; end
|
99
|
+
|
100
|
+
# Logical element on the page.
|
101
|
+
# @!attribute [rw] property
|
102
|
+
# @return [Google::Cloud::Vision::V1::TextAnnotation::TextProperty]
|
103
|
+
# Additional information detected for the block.
|
104
|
+
# @!attribute [rw] bounding_box
|
105
|
+
# @return [Google::Cloud::Vision::V1::BoundingPoly]
|
106
|
+
# The bounding box for the block.
|
107
|
+
# The vertices are in the order of top-left, top-right, bottom-right,
|
108
|
+
# bottom-left. When a rotation of the bounding box is detected the rotation
|
109
|
+
# is represented as around the top-left corner as defined when the text is
|
110
|
+
# read in the 'natural' orientation.
|
111
|
+
# For example:
|
112
|
+
# * when the text is horizontal it might look like:
|
113
|
+
# 0----1
|
114
|
+
# | |
|
115
|
+
# 3----2
|
116
|
+
# * when it's rotated 180 degrees around the top-left corner it becomes:
|
117
|
+
# 2----3
|
118
|
+
# | |
|
119
|
+
# 1----0
|
120
|
+
# and the vertice order will still be (0, 1, 2, 3).
|
121
|
+
# @!attribute [rw] paragraphs
|
122
|
+
# @return [Array<Google::Cloud::Vision::V1::Paragraph>]
|
123
|
+
# List of paragraphs in this block (if this blocks is of type text).
|
124
|
+
# @!attribute [rw] block_type
|
125
|
+
# @return [Google::Cloud::Vision::V1::Block::BlockType]
|
126
|
+
# Detected block type (text, image etc) for this block.
|
127
|
+
class Block
|
128
|
+
# Type of a block (text, image etc) as identified by OCR.
|
129
|
+
module BlockType
|
130
|
+
# Unknown block type.
|
131
|
+
UNKNOWN = 0
|
132
|
+
|
133
|
+
# Regular text block.
|
134
|
+
TEXT = 1
|
135
|
+
|
136
|
+
# Table block.
|
137
|
+
TABLE = 2
|
138
|
+
|
139
|
+
# Image block.
|
140
|
+
PICTURE = 3
|
141
|
+
|
142
|
+
# Horizontal/vertical line box.
|
143
|
+
RULER = 4
|
144
|
+
|
145
|
+
# Barcode block.
|
146
|
+
BARCODE = 5
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Structural unit of text representing a number of words in certain order.
|
151
|
+
# @!attribute [rw] property
|
152
|
+
# @return [Google::Cloud::Vision::V1::TextAnnotation::TextProperty]
|
153
|
+
# Additional information detected for the paragraph.
|
154
|
+
# @!attribute [rw] bounding_box
|
155
|
+
# @return [Google::Cloud::Vision::V1::BoundingPoly]
|
156
|
+
# The bounding box for the paragraph.
|
157
|
+
# The vertices are in the order of top-left, top-right, bottom-right,
|
158
|
+
# bottom-left. When a rotation of the bounding box is detected the rotation
|
159
|
+
# is represented as around the top-left corner as defined when the text is
|
160
|
+
# read in the 'natural' orientation.
|
161
|
+
# For example:
|
162
|
+
# * when the text is horizontal it might look like:
|
163
|
+
# 0----1
|
164
|
+
# | |
|
165
|
+
# 3----2
|
166
|
+
# * when it's rotated 180 degrees around the top-left corner it becomes:
|
167
|
+
# 2----3
|
168
|
+
# | |
|
169
|
+
# 1----0
|
170
|
+
# and the vertice order will still be (0, 1, 2, 3).
|
171
|
+
# @!attribute [rw] words
|
172
|
+
# @return [Array<Google::Cloud::Vision::V1::Word>]
|
173
|
+
# List of words in this paragraph.
|
174
|
+
class Paragraph; end
|
175
|
+
|
176
|
+
# A word representation.
|
177
|
+
# @!attribute [rw] property
|
178
|
+
# @return [Google::Cloud::Vision::V1::TextAnnotation::TextProperty]
|
179
|
+
# Additional information detected for the word.
|
180
|
+
# @!attribute [rw] bounding_box
|
181
|
+
# @return [Google::Cloud::Vision::V1::BoundingPoly]
|
182
|
+
# The bounding box for the word.
|
183
|
+
# The vertices are in the order of top-left, top-right, bottom-right,
|
184
|
+
# bottom-left. When a rotation of the bounding box is detected the rotation
|
185
|
+
# is represented as around the top-left corner as defined when the text is
|
186
|
+
# read in the 'natural' orientation.
|
187
|
+
# For example:
|
188
|
+
# * when the text is horizontal it might look like:
|
189
|
+
# 0----1
|
190
|
+
# | |
|
191
|
+
# 3----2
|
192
|
+
# * when it's rotated 180 degrees around the top-left corner it becomes:
|
193
|
+
# 2----3
|
194
|
+
# | |
|
195
|
+
# 1----0
|
196
|
+
# and the vertice order will still be (0, 1, 2, 3).
|
197
|
+
# @!attribute [rw] symbols
|
198
|
+
# @return [Array<Google::Cloud::Vision::V1::Symbol>]
|
199
|
+
# List of symbols in the word.
|
200
|
+
# The order of the symbols follows the natural reading order.
|
201
|
+
class Word; end
|
202
|
+
|
203
|
+
# A single symbol representation.
|
204
|
+
# @!attribute [rw] property
|
205
|
+
# @return [Google::Cloud::Vision::V1::TextAnnotation::TextProperty]
|
206
|
+
# Additional information detected for the symbol.
|
207
|
+
# @!attribute [rw] bounding_box
|
208
|
+
# @return [Google::Cloud::Vision::V1::BoundingPoly]
|
209
|
+
# The bounding box for the symbol.
|
210
|
+
# The vertices are in the order of top-left, top-right, bottom-right,
|
211
|
+
# bottom-left. When a rotation of the bounding box is detected the rotation
|
212
|
+
# is represented as around the top-left corner as defined when the text is
|
213
|
+
# read in the 'natural' orientation.
|
214
|
+
# For example:
|
215
|
+
# * when the text is horizontal it might look like:
|
216
|
+
# 0----1
|
217
|
+
# | |
|
218
|
+
# 3----2
|
219
|
+
# * when it's rotated 180 degrees around the top-left corner it becomes:
|
220
|
+
# 2----3
|
221
|
+
# | |
|
222
|
+
# 1----0
|
223
|
+
# and the vertice order will still be (0, 1, 2, 3).
|
224
|
+
# @!attribute [rw] text
|
225
|
+
# @return [String]
|
226
|
+
# The actual UTF-8 representation of the symbol.
|
227
|
+
class Symbol; end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
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
|
+
# http://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
|
+
module Google
|
16
|
+
module Cloud
|
17
|
+
module Vision
|
18
|
+
module V1
|
19
|
+
# Relevant information for the image from the Internet.
|
20
|
+
# @!attribute [rw] web_entities
|
21
|
+
# @return [Array<Google::Cloud::Vision::V1::WebDetection::WebEntity>]
|
22
|
+
# Deduced entities from similar images on the Internet.
|
23
|
+
# @!attribute [rw] full_matching_images
|
24
|
+
# @return [Array<Google::Cloud::Vision::V1::WebDetection::WebImage>]
|
25
|
+
# Fully matching images from the Internet.
|
26
|
+
# They're definite neardups and most often a copy of the query image with
|
27
|
+
# merely a size change.
|
28
|
+
# @!attribute [rw] partial_matching_images
|
29
|
+
# @return [Array<Google::Cloud::Vision::V1::WebDetection::WebImage>]
|
30
|
+
# Partial matching images from the Internet.
|
31
|
+
# Those images are similar enough to share some key-point features. For
|
32
|
+
# example an original image will likely have partial matching for its crops.
|
33
|
+
# @!attribute [rw] pages_with_matching_images
|
34
|
+
# @return [Array<Google::Cloud::Vision::V1::WebDetection::WebPage>]
|
35
|
+
# Web pages containing the matching images from the Internet.
|
36
|
+
class WebDetection
|
37
|
+
# Entity deduced from similar images on the Internet.
|
38
|
+
# @!attribute [rw] entity_id
|
39
|
+
# @return [String]
|
40
|
+
# Opaque entity ID.
|
41
|
+
# @!attribute [rw] score
|
42
|
+
# @return [Float]
|
43
|
+
# Overall relevancy score for the entity.
|
44
|
+
# Not normalized and not comparable across different image queries.
|
45
|
+
# @!attribute [rw] description
|
46
|
+
# @return [String]
|
47
|
+
# Canonical description of the entity, in English.
|
48
|
+
class WebEntity; end
|
49
|
+
|
50
|
+
# Metadata for online images.
|
51
|
+
# @!attribute [rw] url
|
52
|
+
# @return [String]
|
53
|
+
# The result image URL.
|
54
|
+
# @!attribute [rw] score
|
55
|
+
# @return [Float]
|
56
|
+
# Overall relevancy score for the image.
|
57
|
+
# Not normalized and not comparable across different image queries.
|
58
|
+
class WebImage; end
|
59
|
+
|
60
|
+
# Metadata for web pages.
|
61
|
+
# @!attribute [rw] url
|
62
|
+
# @return [String]
|
63
|
+
# The result web page URL.
|
64
|
+
# @!attribute [rw] score
|
65
|
+
# @return [Float]
|
66
|
+
# Overall relevancy score for the web page.
|
67
|
+
# Not normalized and not comparable across different image queries.
|
68
|
+
class WebPage; end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -32,9 +32,9 @@ module Google
|
|
32
32
|
module Cloud
|
33
33
|
module Vision
|
34
34
|
module V1
|
35
|
-
# Service that performs Google Cloud Vision API detection tasks
|
36
|
-
# landmark, logo, label, and text detection
|
37
|
-
# detected entities from the images.
|
35
|
+
# Service that performs Google Cloud Vision API detection tasks over client
|
36
|
+
# images, such as face, landmark, logo, label, and text detection. The
|
37
|
+
# ImageAnnotator service returns detected entities from the images.
|
38
38
|
#
|
39
39
|
# @!attribute [r] image_annotator_stub
|
40
40
|
# @return [Google::Cloud::Vision::V1::ImageAnnotator::Stub]
|
@@ -95,7 +95,7 @@ module Google
|
|
95
95
|
|
96
96
|
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
97
97
|
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
98
|
-
google_api_client << " gapic/ gax/#{Google::Gax::VERSION}"
|
98
|
+
google_api_client << " gapic/0.6.8 gax/#{Google::Gax::VERSION}"
|
99
99
|
google_api_client << " grpc/#{GRPC::VERSION}"
|
100
100
|
google_api_client.freeze
|
101
101
|
|
@@ -5,6 +5,8 @@ require 'google/protobuf'
|
|
5
5
|
|
6
6
|
require 'google/api/annotations_pb'
|
7
7
|
require 'google/cloud/vision/v1/geometry_pb'
|
8
|
+
require 'google/cloud/vision/v1/text_annotation_pb'
|
9
|
+
require 'google/cloud/vision/v1/web_detection_pb'
|
8
10
|
require 'google/rpc/status_pb'
|
9
11
|
require 'google/type/color_pb'
|
10
12
|
require 'google/type/latlng_pb'
|
@@ -20,11 +22,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
20
22
|
value :LOGO_DETECTION, 3
|
21
23
|
value :LABEL_DETECTION, 4
|
22
24
|
value :TEXT_DETECTION, 5
|
25
|
+
value :DOCUMENT_TEXT_DETECTION, 11
|
23
26
|
value :SAFE_SEARCH_DETECTION, 6
|
24
27
|
value :IMAGE_PROPERTIES, 7
|
28
|
+
value :CROP_HINTS, 9
|
29
|
+
value :WEB_DETECTION, 10
|
25
30
|
end
|
26
31
|
add_message "google.cloud.vision.v1.ImageSource" do
|
27
32
|
optional :gcs_image_uri, :string, 1
|
33
|
+
optional :image_uri, :string, 2
|
28
34
|
end
|
29
35
|
add_message "google.cloud.vision.v1.Image" do
|
30
36
|
optional :content, :bytes, 1
|
@@ -127,9 +133,21 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
127
133
|
add_message "google.cloud.vision.v1.ImageProperties" do
|
128
134
|
optional :dominant_colors, :message, 1, "google.cloud.vision.v1.DominantColorsAnnotation"
|
129
135
|
end
|
136
|
+
add_message "google.cloud.vision.v1.CropHint" do
|
137
|
+
optional :bounding_poly, :message, 1, "google.cloud.vision.v1.BoundingPoly"
|
138
|
+
optional :confidence, :float, 2
|
139
|
+
optional :importance_fraction, :float, 3
|
140
|
+
end
|
141
|
+
add_message "google.cloud.vision.v1.CropHintsAnnotation" do
|
142
|
+
repeated :crop_hints, :message, 1, "google.cloud.vision.v1.CropHint"
|
143
|
+
end
|
144
|
+
add_message "google.cloud.vision.v1.CropHintsParams" do
|
145
|
+
repeated :aspect_ratios, :float, 1
|
146
|
+
end
|
130
147
|
add_message "google.cloud.vision.v1.ImageContext" do
|
131
148
|
optional :lat_long_rect, :message, 1, "google.cloud.vision.v1.LatLongRect"
|
132
149
|
repeated :language_hints, :string, 2
|
150
|
+
optional :crop_hints_params, :message, 4, "google.cloud.vision.v1.CropHintsParams"
|
133
151
|
end
|
134
152
|
add_message "google.cloud.vision.v1.AnnotateImageRequest" do
|
135
153
|
optional :image, :message, 1, "google.cloud.vision.v1.Image"
|
@@ -142,8 +160,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
142
160
|
repeated :logo_annotations, :message, 3, "google.cloud.vision.v1.EntityAnnotation"
|
143
161
|
repeated :label_annotations, :message, 4, "google.cloud.vision.v1.EntityAnnotation"
|
144
162
|
repeated :text_annotations, :message, 5, "google.cloud.vision.v1.EntityAnnotation"
|
163
|
+
optional :full_text_annotation, :message, 12, "google.cloud.vision.v1.TextAnnotation"
|
145
164
|
optional :safe_search_annotation, :message, 6, "google.cloud.vision.v1.SafeSearchAnnotation"
|
146
165
|
optional :image_properties_annotation, :message, 8, "google.cloud.vision.v1.ImageProperties"
|
166
|
+
optional :crop_hints_annotation, :message, 11, "google.cloud.vision.v1.CropHintsAnnotation"
|
167
|
+
optional :web_detection, :message, 13, "google.cloud.vision.v1.WebDetection"
|
147
168
|
optional :error, :message, 9, "google.rpc.Status"
|
148
169
|
end
|
149
170
|
add_message "google.cloud.vision.v1.BatchAnnotateImagesRequest" do
|
@@ -181,6 +202,9 @@ module Google
|
|
181
202
|
ColorInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.ColorInfo").msgclass
|
182
203
|
DominantColorsAnnotation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.DominantColorsAnnotation").msgclass
|
183
204
|
ImageProperties = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.ImageProperties").msgclass
|
205
|
+
CropHint = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.CropHint").msgclass
|
206
|
+
CropHintsAnnotation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.CropHintsAnnotation").msgclass
|
207
|
+
CropHintsParams = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.CropHintsParams").msgclass
|
184
208
|
ImageContext = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.ImageContext").msgclass
|
185
209
|
AnnotateImageRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AnnotateImageRequest").msgclass
|
186
210
|
AnnotateImageResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AnnotateImageResponse").msgclass
|
@@ -24,9 +24,9 @@ module Google
|
|
24
24
|
module Vision
|
25
25
|
module V1
|
26
26
|
module ImageAnnotator
|
27
|
-
# Service that performs Google Cloud Vision API detection tasks
|
28
|
-
# landmark, logo, label, and text detection
|
29
|
-
# detected entities from the images.
|
27
|
+
# Service that performs Google Cloud Vision API detection tasks over client
|
28
|
+
# images, such as face, landmark, logo, label, and text detection. The
|
29
|
+
# ImageAnnotator service returns detected entities from the images.
|
30
30
|
class Service
|
31
31
|
|
32
32
|
include GRPC::GenericService
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/vision/v1/text_annotation.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/cloud/vision/v1/geometry_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_message "google.cloud.vision.v1.TextAnnotation" do
|
10
|
+
repeated :pages, :message, 1, "google.cloud.vision.v1.Page"
|
11
|
+
optional :text, :string, 2
|
12
|
+
end
|
13
|
+
add_message "google.cloud.vision.v1.TextAnnotation.DetectedLanguage" do
|
14
|
+
optional :language_code, :string, 1
|
15
|
+
optional :confidence, :float, 2
|
16
|
+
end
|
17
|
+
add_message "google.cloud.vision.v1.TextAnnotation.DetectedBreak" do
|
18
|
+
optional :type, :enum, 1, "google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType"
|
19
|
+
optional :is_prefix, :bool, 2
|
20
|
+
end
|
21
|
+
add_enum "google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType" do
|
22
|
+
value :UNKNOWN, 0
|
23
|
+
value :SPACE, 1
|
24
|
+
value :SURE_SPACE, 2
|
25
|
+
value :EOL_SURE_SPACE, 3
|
26
|
+
value :HYPHEN, 4
|
27
|
+
value :LINE_BREAK, 5
|
28
|
+
end
|
29
|
+
add_message "google.cloud.vision.v1.TextAnnotation.TextProperty" do
|
30
|
+
repeated :detected_languages, :message, 1, "google.cloud.vision.v1.TextAnnotation.DetectedLanguage"
|
31
|
+
optional :detected_break, :message, 2, "google.cloud.vision.v1.TextAnnotation.DetectedBreak"
|
32
|
+
end
|
33
|
+
add_message "google.cloud.vision.v1.Page" do
|
34
|
+
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
35
|
+
optional :width, :int32, 2
|
36
|
+
optional :height, :int32, 3
|
37
|
+
repeated :blocks, :message, 4, "google.cloud.vision.v1.Block"
|
38
|
+
end
|
39
|
+
add_message "google.cloud.vision.v1.Block" do
|
40
|
+
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
41
|
+
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
42
|
+
repeated :paragraphs, :message, 3, "google.cloud.vision.v1.Paragraph"
|
43
|
+
optional :block_type, :enum, 4, "google.cloud.vision.v1.Block.BlockType"
|
44
|
+
end
|
45
|
+
add_enum "google.cloud.vision.v1.Block.BlockType" do
|
46
|
+
value :UNKNOWN, 0
|
47
|
+
value :TEXT, 1
|
48
|
+
value :TABLE, 2
|
49
|
+
value :PICTURE, 3
|
50
|
+
value :RULER, 4
|
51
|
+
value :BARCODE, 5
|
52
|
+
end
|
53
|
+
add_message "google.cloud.vision.v1.Paragraph" do
|
54
|
+
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
55
|
+
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
56
|
+
repeated :words, :message, 3, "google.cloud.vision.v1.Word"
|
57
|
+
end
|
58
|
+
add_message "google.cloud.vision.v1.Word" do
|
59
|
+
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
60
|
+
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
61
|
+
repeated :symbols, :message, 3, "google.cloud.vision.v1.Symbol"
|
62
|
+
end
|
63
|
+
add_message "google.cloud.vision.v1.Symbol" do
|
64
|
+
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
65
|
+
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
66
|
+
optional :text, :string, 3
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module Google
|
71
|
+
module Cloud
|
72
|
+
module Vision
|
73
|
+
module V1
|
74
|
+
TextAnnotation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation").msgclass
|
75
|
+
TextAnnotation::DetectedLanguage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedLanguage").msgclass
|
76
|
+
TextAnnotation::DetectedBreak = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedBreak").msgclass
|
77
|
+
TextAnnotation::DetectedBreak::BreakType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType").enummodule
|
78
|
+
TextAnnotation::TextProperty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.TextProperty").msgclass
|
79
|
+
Page = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Page").msgclass
|
80
|
+
Block = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Block").msgclass
|
81
|
+
Block::BlockType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Block.BlockType").enummodule
|
82
|
+
Paragraph = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Paragraph").msgclass
|
83
|
+
Word = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Word").msgclass
|
84
|
+
Symbol = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Symbol").msgclass
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|