google-cloud-vision 0.32.2 → 0.32.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/AUTHENTICATION.md +199 -0
- data/lib/google/cloud/vision.rb +8 -6
- data/lib/google/cloud/vision/v1.rb +8 -6
- data/lib/google/cloud/vision/v1/credentials.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +3 -2
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +13 -8
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +4 -3
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +2 -44
- data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +3 -2
- data/lib/google/cloud/vision/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +19 -27
- data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +16 -14
- data/lib/google/cloud/vision/v1/doc/google/protobuf/wrappers.rb +1 -65
- data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +18 -15
- data/lib/google/cloud/vision/v1/doc/google/type/color.rb +8 -3
- data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +1 -35
- data/lib/google/cloud/vision/v1/helpers.rb +44 -44
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +1 -1
- data/lib/google/cloud/vision/v1/product_search_client.rb +102 -50
- data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +9 -7
- data/lib/google/cloud/vision/v1p3beta1.rb +8 -4
- data/lib/google/cloud/vision/v1p3beta1/credentials.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +4 -2
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +12 -7
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +4 -3
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +2 -44
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +3 -2
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +19 -27
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +16 -14
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +1 -65
- data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +18 -15
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +8 -3
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +1 -35
- data/lib/google/cloud/vision/v1p3beta1/helpers.rb +44 -44
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +98 -40
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +9 -5
- metadata +6 -6
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2019 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.
|
@@ -97,7 +97,8 @@ module Google
|
|
97
97
|
# @!attribute [rw] type_url
|
98
98
|
# @return [String]
|
99
99
|
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message.
|
100
|
+
# protocol buffer message. This string must contain at least
|
101
|
+
# one "/" character. The last segment of the URL's path must represent
|
101
102
|
# the fully qualified name of the type (as in
|
102
103
|
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
103
104
|
# (e.g., leading "." is not accepted).
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2019 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.
|
@@ -83,57 +83,49 @@ module Google
|
|
83
83
|
# describe the updated values, the API ignores the values of all
|
84
84
|
# fields not covered by the mask.
|
85
85
|
#
|
86
|
-
# If a repeated field is specified for an update operation,
|
87
|
-
#
|
88
|
-
#
|
89
|
-
# string.
|
86
|
+
# If a repeated field is specified for an update operation, new values will
|
87
|
+
# be appended to the existing repeated field in the target resource. Note that
|
88
|
+
# a repeated field is only allowed in the last position of a `paths` string.
|
90
89
|
#
|
91
90
|
# If a sub-message is specified in the last position of the field mask for an
|
92
|
-
# update operation, then the existing sub-message
|
93
|
-
#
|
91
|
+
# update operation, then new value will be merged into the existing sub-message
|
92
|
+
# in the target resource.
|
93
|
+
#
|
94
|
+
# For example, given the target message:
|
94
95
|
#
|
95
96
|
# f {
|
96
97
|
# b {
|
97
|
-
# d
|
98
|
-
# x
|
98
|
+
# d: 1
|
99
|
+
# x: 2
|
99
100
|
# }
|
100
|
-
# c
|
101
|
+
# c: [1]
|
101
102
|
# }
|
102
103
|
#
|
103
104
|
# And an update message:
|
104
105
|
#
|
105
106
|
# f {
|
106
107
|
# b {
|
107
|
-
# d
|
108
|
+
# d: 10
|
108
109
|
# }
|
110
|
+
# c: [2]
|
109
111
|
# }
|
110
112
|
#
|
111
113
|
# then if the field mask is:
|
112
114
|
#
|
113
|
-
# paths: "f.b"
|
115
|
+
# paths: ["f.b", "f.c"]
|
114
116
|
#
|
115
117
|
# then the result will be:
|
116
118
|
#
|
117
119
|
# f {
|
118
120
|
# b {
|
119
|
-
# d
|
121
|
+
# d: 10
|
122
|
+
# x: 2
|
120
123
|
# }
|
121
|
-
# c
|
124
|
+
# c: [1, 2]
|
122
125
|
# }
|
123
126
|
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# paths: "f.b.d"
|
127
|
-
#
|
128
|
-
# then the result would be:
|
129
|
-
#
|
130
|
-
# f {
|
131
|
-
# b {
|
132
|
-
# d : 10
|
133
|
-
# x : 2
|
134
|
-
# }
|
135
|
-
# c : 1
|
136
|
-
# }
|
127
|
+
# An implementation may provide options to override this default behavior for
|
128
|
+
# repeated and message fields.
|
137
129
|
#
|
138
130
|
# In order to reset a field's value to the default, the field must
|
139
131
|
# be in the mask and set to the default value in the provided resource.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2019 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.
|
@@ -15,17 +15,19 @@
|
|
15
15
|
|
16
16
|
module Google
|
17
17
|
module Protobuf
|
18
|
-
# A Timestamp represents a point in time independent of any time zone
|
19
|
-
#
|
20
|
-
# nanosecond resolution
|
21
|
-
#
|
22
|
-
# backwards to year one.
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
18
|
+
# A Timestamp represents a point in time independent of any time zone or local
|
19
|
+
# calendar, encoded as a count of seconds and fractions of seconds at
|
20
|
+
# nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
21
|
+
# January 1, 1970, in the proleptic Gregorian calendar which extends the
|
22
|
+
# Gregorian calendar backwards to year one.
|
23
|
+
#
|
24
|
+
# All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
25
|
+
# second table is needed for interpretation, using a [24-hour linear
|
26
|
+
# smear](https://developers.google.com/time/smear).
|
27
|
+
#
|
28
|
+
# The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
29
|
+
# restricting to that range, we ensure that we can convert to and from [RFC
|
30
|
+
# 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
29
31
|
#
|
30
32
|
# = Examples
|
31
33
|
#
|
@@ -86,12 +88,12 @@ module Google
|
|
86
88
|
# 01:30 UTC on January 15, 2017.
|
87
89
|
#
|
88
90
|
# In JavaScript, one can convert a Date object to this format using the
|
89
|
-
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
91
|
+
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
90
92
|
# method. In Python, a standard `datetime.datetime` object can be converted
|
91
93
|
# to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
92
94
|
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
93
95
|
# can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
94
|
-
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime
|
96
|
+
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
95
97
|
# ) to obtain a formatter capable of generating timestamps in this format.
|
96
98
|
# @!attribute [rw] seconds
|
97
99
|
# @return [Integer]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2019 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.
|
@@ -15,14 +15,6 @@
|
|
15
15
|
|
16
16
|
module Google
|
17
17
|
module Protobuf
|
18
|
-
# Wrapper message for `double`.
|
19
|
-
#
|
20
|
-
# The JSON representation for `DoubleValue` is JSON number.
|
21
|
-
# @!attribute [rw] value
|
22
|
-
# @return [Float]
|
23
|
-
# The double value.
|
24
|
-
class DoubleValue; end
|
25
|
-
|
26
18
|
# Wrapper message for `float`.
|
27
19
|
#
|
28
20
|
# The JSON representation for `FloatValue` is JSON number.
|
@@ -30,61 +22,5 @@ module Google
|
|
30
22
|
# @return [Float]
|
31
23
|
# The float value.
|
32
24
|
class FloatValue; end
|
33
|
-
|
34
|
-
# Wrapper message for `int64`.
|
35
|
-
#
|
36
|
-
# The JSON representation for `Int64Value` is JSON string.
|
37
|
-
# @!attribute [rw] value
|
38
|
-
# @return [Integer]
|
39
|
-
# The int64 value.
|
40
|
-
class Int64Value; end
|
41
|
-
|
42
|
-
# Wrapper message for `uint64`.
|
43
|
-
#
|
44
|
-
# The JSON representation for `UInt64Value` is JSON string.
|
45
|
-
# @!attribute [rw] value
|
46
|
-
# @return [Integer]
|
47
|
-
# The uint64 value.
|
48
|
-
class UInt64Value; end
|
49
|
-
|
50
|
-
# Wrapper message for `int32`.
|
51
|
-
#
|
52
|
-
# The JSON representation for `Int32Value` is JSON number.
|
53
|
-
# @!attribute [rw] value
|
54
|
-
# @return [Integer]
|
55
|
-
# The int32 value.
|
56
|
-
class Int32Value; end
|
57
|
-
|
58
|
-
# Wrapper message for `uint32`.
|
59
|
-
#
|
60
|
-
# The JSON representation for `UInt32Value` is JSON number.
|
61
|
-
# @!attribute [rw] value
|
62
|
-
# @return [Integer]
|
63
|
-
# The uint32 value.
|
64
|
-
class UInt32Value; end
|
65
|
-
|
66
|
-
# Wrapper message for `bool`.
|
67
|
-
#
|
68
|
-
# The JSON representation for `BoolValue` is JSON `true` and `false`.
|
69
|
-
# @!attribute [rw] value
|
70
|
-
# @return [true, false]
|
71
|
-
# The bool value.
|
72
|
-
class BoolValue; end
|
73
|
-
|
74
|
-
# Wrapper message for `string`.
|
75
|
-
#
|
76
|
-
# The JSON representation for `StringValue` is JSON string.
|
77
|
-
# @!attribute [rw] value
|
78
|
-
# @return [String]
|
79
|
-
# The string value.
|
80
|
-
class StringValue; end
|
81
|
-
|
82
|
-
# Wrapper message for `bytes`.
|
83
|
-
#
|
84
|
-
# The JSON representation for `BytesValue` is JSON string.
|
85
|
-
# @!attribute [rw] value
|
86
|
-
# @return [String]
|
87
|
-
# The bytes value.
|
88
|
-
class BytesValue; end
|
89
25
|
end
|
90
26
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2019 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.
|
@@ -15,24 +15,25 @@
|
|
15
15
|
|
16
16
|
module Google
|
17
17
|
module Rpc
|
18
|
-
# The `Status` type defines a logical error model that is suitable for
|
19
|
-
# programming environments, including REST APIs and RPC APIs. It is
|
20
|
-
# [gRPC](https://github.com/grpc). The error model is designed to be:
|
18
|
+
# The `Status` type defines a logical error model that is suitable for
|
19
|
+
# different programming environments, including REST APIs and RPC APIs. It is
|
20
|
+
# used by [gRPC](https://github.com/grpc). The error model is designed to be:
|
21
21
|
#
|
22
22
|
# * Simple to use and understand for most users
|
23
23
|
# * Flexible enough to meet unexpected needs
|
24
24
|
#
|
25
25
|
# = Overview
|
26
26
|
#
|
27
|
-
# The `Status` message contains three pieces of data: error code, error
|
28
|
-
# and error details. The error code should be an enum value of
|
29
|
-
# {Google::Rpc::Code}, but it may accept additional error codes
|
30
|
-
# error message should be a developer-facing English message
|
31
|
-
# developers *understand* and *resolve* the error. If a localized
|
32
|
-
# error message is needed, put the localized message in the error
|
33
|
-
# localize it in the client. The optional error details may contain
|
34
|
-
# information about the error. There is a predefined set of error
|
35
|
-
# in the package `google.rpc` that can be used for common error
|
27
|
+
# The `Status` message contains three pieces of data: error code, error
|
28
|
+
# message, and error details. The error code should be an enum value of
|
29
|
+
# {Google::Rpc::Code}, but it may accept additional error codes
|
30
|
+
# if needed. The error message should be a developer-facing English message
|
31
|
+
# that helps developers *understand* and *resolve* the error. If a localized
|
32
|
+
# user-facing error message is needed, put the localized message in the error
|
33
|
+
# details or localize it in the client. The optional error details may contain
|
34
|
+
# arbitrary information about the error. There is a predefined set of error
|
35
|
+
# detail types in the package `google.rpc` that can be used for common error
|
36
|
+
# conditions.
|
36
37
|
#
|
37
38
|
# = Language mapping
|
38
39
|
#
|
@@ -69,12 +70,14 @@ module Google
|
|
69
70
|
# be used directly after any stripping needed for security/privacy reasons.
|
70
71
|
# @!attribute [rw] code
|
71
72
|
# @return [Integer]
|
72
|
-
# The status code, which should be an enum value of
|
73
|
+
# The status code, which should be an enum value of
|
74
|
+
# {Google::Rpc::Code}.
|
73
75
|
# @!attribute [rw] message
|
74
76
|
# @return [String]
|
75
77
|
# A developer-facing error message, which should be in English. Any
|
76
78
|
# user-facing error message should be localized and sent in the
|
77
|
-
# {Google::Rpc::Status#details} field, or localized
|
79
|
+
# {Google::Rpc::Status#details} field, or localized
|
80
|
+
# by the client.
|
78
81
|
# @!attribute [rw] details
|
79
82
|
# @return [Array<Google::Protobuf::Any>]
|
80
83
|
# A list of messages that carry the error details. There is a common set of
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2019 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.
|
@@ -21,7 +21,12 @@ module Google
|
|
21
21
|
# can be trivially provided to the constructor of "java.awt.Color" in Java; it
|
22
22
|
# can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
|
23
23
|
# method in iOS; and, with just a little work, it can be easily formatted into
|
24
|
-
# a CSS "rgba()" string in JavaScript, as well.
|
24
|
+
# a CSS "rgba()" string in JavaScript, as well.
|
25
|
+
#
|
26
|
+
# Note: this proto does not carry information about the absolute color space
|
27
|
+
# that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
|
28
|
+
# DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color
|
29
|
+
# space.
|
25
30
|
#
|
26
31
|
# Example (Java):
|
27
32
|
#
|
@@ -83,7 +88,7 @@ module Google
|
|
83
88
|
# if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
|
84
89
|
# return nil;
|
85
90
|
# }
|
86
|
-
# Color* result = [Color alloc] init];
|
91
|
+
# Color* result = [[Color alloc] init];
|
87
92
|
# [result setRed:red];
|
88
93
|
# [result setGreen:green];
|
89
94
|
# [result setBlue:blue];
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2019 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.
|
@@ -20,40 +20,6 @@ module Google
|
|
20
20
|
# specified otherwise, this must conform to the
|
21
21
|
# <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
|
22
22
|
# standard</a>. Values must be within normalized ranges.
|
23
|
-
#
|
24
|
-
# Example of normalization code in Python:
|
25
|
-
#
|
26
|
-
# def NormalizeLongitude(longitude):
|
27
|
-
# """Wraps decimal degrees longitude to [-180.0, 180.0]."""
|
28
|
-
# q, r = divmod(longitude, 360.0)
|
29
|
-
# if r > 180.0 or (r == 180.0 and q <= -1.0):
|
30
|
-
# return r - 360.0
|
31
|
-
# return r
|
32
|
-
#
|
33
|
-
# def NormalizeLatLng(latitude, longitude):
|
34
|
-
# """Wraps decimal degrees latitude and longitude to
|
35
|
-
# [-90.0, 90.0] and [-180.0, 180.0], respectively."""
|
36
|
-
# r = latitude % 360.0
|
37
|
-
# if r <= 90.0:
|
38
|
-
# return r, NormalizeLongitude(longitude)
|
39
|
-
# elif r >= 270.0:
|
40
|
-
# return r - 360, NormalizeLongitude(longitude)
|
41
|
-
# else:
|
42
|
-
# return 180 - r, NormalizeLongitude(longitude + 180.0)
|
43
|
-
#
|
44
|
-
# assert 180.0 == NormalizeLongitude(180.0)
|
45
|
-
# assert -180.0 == NormalizeLongitude(-180.0)
|
46
|
-
# assert -179.0 == NormalizeLongitude(181.0)
|
47
|
-
# assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0)
|
48
|
-
# assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0)
|
49
|
-
# assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0)
|
50
|
-
# assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0)
|
51
|
-
# assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0)
|
52
|
-
# assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0)
|
53
|
-
# assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0)
|
54
|
-
# assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0)
|
55
|
-
# assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0)
|
56
|
-
# assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0)
|
57
23
|
# @!attribute [rw] latitude
|
58
24
|
# @return [Float]
|
59
25
|
# The latitude in degrees. It must be in the range [-90.0, +90.0].
|
@@ -50,12 +50,12 @@ module Google
|
|
50
50
|
#
|
51
51
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
52
52
|
#
|
53
|
-
# response = image_annotator_client.
|
53
|
+
# response = image_annotator_client.crop_hints_detection image: "path\to\image.png"
|
54
54
|
# response.responses.each do |res|
|
55
55
|
# puts res
|
56
56
|
# end
|
57
57
|
|
58
|
-
def
|
58
|
+
def crop_hints_detection \
|
59
59
|
images: [],
|
60
60
|
image: nil,
|
61
61
|
max_results: 10,
|
@@ -67,7 +67,7 @@ module Google
|
|
67
67
|
image_context: nil,
|
68
68
|
&blk
|
69
69
|
|
70
|
-
feature = { type: :
|
70
|
+
feature = { type: :CROP_HINTS }
|
71
71
|
feature[:max_results] = max_results
|
72
72
|
images << image if image
|
73
73
|
|
@@ -139,12 +139,12 @@ module Google
|
|
139
139
|
#
|
140
140
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
141
141
|
#
|
142
|
-
# response = image_annotator_client.
|
142
|
+
# response = image_annotator_client.document_text_detection image: "path\to\image.png"
|
143
143
|
# response.responses.each do |res|
|
144
144
|
# puts res
|
145
145
|
# end
|
146
146
|
|
147
|
-
def
|
147
|
+
def document_text_detection \
|
148
148
|
images: [],
|
149
149
|
image: nil,
|
150
150
|
max_results: 10,
|
@@ -156,7 +156,7 @@ module Google
|
|
156
156
|
image_context: nil,
|
157
157
|
&blk
|
158
158
|
|
159
|
-
feature = { type: :
|
159
|
+
feature = { type: :DOCUMENT_TEXT_DETECTION }
|
160
160
|
feature[:max_results] = max_results
|
161
161
|
images << image if image
|
162
162
|
|
@@ -228,12 +228,12 @@ module Google
|
|
228
228
|
#
|
229
229
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
230
230
|
#
|
231
|
-
# response = image_annotator_client.
|
231
|
+
# response = image_annotator_client.face_detection image: "path\to\image.png"
|
232
232
|
# response.responses.each do |res|
|
233
233
|
# puts res
|
234
234
|
# end
|
235
235
|
|
236
|
-
def
|
236
|
+
def face_detection \
|
237
237
|
images: [],
|
238
238
|
image: nil,
|
239
239
|
max_results: 10,
|
@@ -245,7 +245,7 @@ module Google
|
|
245
245
|
image_context: nil,
|
246
246
|
&blk
|
247
247
|
|
248
|
-
feature = { type: :
|
248
|
+
feature = { type: :FACE_DETECTION }
|
249
249
|
feature[:max_results] = max_results
|
250
250
|
images << image if image
|
251
251
|
|
@@ -317,12 +317,12 @@ module Google
|
|
317
317
|
#
|
318
318
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
319
319
|
#
|
320
|
-
# response = image_annotator_client.
|
320
|
+
# response = image_annotator_client.image_properties_detection image: "path\to\image.png"
|
321
321
|
# response.responses.each do |res|
|
322
322
|
# puts res
|
323
323
|
# end
|
324
324
|
|
325
|
-
def
|
325
|
+
def image_properties_detection \
|
326
326
|
images: [],
|
327
327
|
image: nil,
|
328
328
|
max_results: 10,
|
@@ -334,7 +334,7 @@ module Google
|
|
334
334
|
image_context: nil,
|
335
335
|
&blk
|
336
336
|
|
337
|
-
feature = { type: :
|
337
|
+
feature = { type: :IMAGE_PROPERTIES }
|
338
338
|
feature[:max_results] = max_results
|
339
339
|
images << image if image
|
340
340
|
|
@@ -406,12 +406,12 @@ module Google
|
|
406
406
|
#
|
407
407
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
408
408
|
#
|
409
|
-
# response = image_annotator_client.
|
409
|
+
# response = image_annotator_client.label_detection image: "path\to\image.png"
|
410
410
|
# response.responses.each do |res|
|
411
411
|
# puts res
|
412
412
|
# end
|
413
413
|
|
414
|
-
def
|
414
|
+
def label_detection \
|
415
415
|
images: [],
|
416
416
|
image: nil,
|
417
417
|
max_results: 10,
|
@@ -423,7 +423,7 @@ module Google
|
|
423
423
|
image_context: nil,
|
424
424
|
&blk
|
425
425
|
|
426
|
-
feature = { type: :
|
426
|
+
feature = { type: :LABEL_DETECTION }
|
427
427
|
feature[:max_results] = max_results
|
428
428
|
images << image if image
|
429
429
|
|
@@ -495,12 +495,12 @@ module Google
|
|
495
495
|
#
|
496
496
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
497
497
|
#
|
498
|
-
# response = image_annotator_client.
|
498
|
+
# response = image_annotator_client.landmark_detection image: "path\to\image.png"
|
499
499
|
# response.responses.each do |res|
|
500
500
|
# puts res
|
501
501
|
# end
|
502
502
|
|
503
|
-
def
|
503
|
+
def landmark_detection \
|
504
504
|
images: [],
|
505
505
|
image: nil,
|
506
506
|
max_results: 10,
|
@@ -512,7 +512,7 @@ module Google
|
|
512
512
|
image_context: nil,
|
513
513
|
&blk
|
514
514
|
|
515
|
-
feature = { type: :
|
515
|
+
feature = { type: :LANDMARK_DETECTION }
|
516
516
|
feature[:max_results] = max_results
|
517
517
|
images << image if image
|
518
518
|
|
@@ -584,12 +584,12 @@ module Google
|
|
584
584
|
#
|
585
585
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
586
586
|
#
|
587
|
-
# response = image_annotator_client.
|
587
|
+
# response = image_annotator_client.logo_detection image: "path\to\image.png"
|
588
588
|
# response.responses.each do |res|
|
589
589
|
# puts res
|
590
590
|
# end
|
591
591
|
|
592
|
-
def
|
592
|
+
def logo_detection \
|
593
593
|
images: [],
|
594
594
|
image: nil,
|
595
595
|
max_results: 10,
|
@@ -601,7 +601,7 @@ module Google
|
|
601
601
|
image_context: nil,
|
602
602
|
&blk
|
603
603
|
|
604
|
-
feature = { type: :
|
604
|
+
feature = { type: :LOGO_DETECTION }
|
605
605
|
feature[:max_results] = max_results
|
606
606
|
images << image if image
|
607
607
|
|
@@ -673,12 +673,12 @@ module Google
|
|
673
673
|
#
|
674
674
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
675
675
|
#
|
676
|
-
# response = image_annotator_client.
|
676
|
+
# response = image_annotator_client.object_localization_detection image: "path\to\image.png"
|
677
677
|
# response.responses.each do |res|
|
678
678
|
# puts res
|
679
679
|
# end
|
680
680
|
|
681
|
-
def
|
681
|
+
def object_localization_detection \
|
682
682
|
images: [],
|
683
683
|
image: nil,
|
684
684
|
max_results: 10,
|
@@ -690,7 +690,7 @@ module Google
|
|
690
690
|
image_context: nil,
|
691
691
|
&blk
|
692
692
|
|
693
|
-
feature = { type: :
|
693
|
+
feature = { type: :OBJECT_LOCALIZATION }
|
694
694
|
feature[:max_results] = max_results
|
695
695
|
images << image if image
|
696
696
|
|
@@ -762,12 +762,12 @@ module Google
|
|
762
762
|
#
|
763
763
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
764
764
|
#
|
765
|
-
# response = image_annotator_client.
|
765
|
+
# response = image_annotator_client.product_search_detection image: "path\to\image.png"
|
766
766
|
# response.responses.each do |res|
|
767
767
|
# puts res
|
768
768
|
# end
|
769
769
|
|
770
|
-
def
|
770
|
+
def product_search_detection \
|
771
771
|
images: [],
|
772
772
|
image: nil,
|
773
773
|
max_results: 10,
|
@@ -779,7 +779,7 @@ module Google
|
|
779
779
|
image_context: nil,
|
780
780
|
&blk
|
781
781
|
|
782
|
-
feature = { type: :
|
782
|
+
feature = { type: :PRODUCT_SEARCH }
|
783
783
|
feature[:max_results] = max_results
|
784
784
|
images << image if image
|
785
785
|
|
@@ -851,12 +851,12 @@ module Google
|
|
851
851
|
#
|
852
852
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
853
853
|
#
|
854
|
-
# response = image_annotator_client.
|
854
|
+
# response = image_annotator_client.safe_search_detection image: "path\to\image.png"
|
855
855
|
# response.responses.each do |res|
|
856
856
|
# puts res
|
857
857
|
# end
|
858
858
|
|
859
|
-
def
|
859
|
+
def safe_search_detection \
|
860
860
|
images: [],
|
861
861
|
image: nil,
|
862
862
|
max_results: 10,
|
@@ -868,7 +868,7 @@ module Google
|
|
868
868
|
image_context: nil,
|
869
869
|
&blk
|
870
870
|
|
871
|
-
feature = { type: :
|
871
|
+
feature = { type: :SAFE_SEARCH_DETECTION }
|
872
872
|
feature[:max_results] = max_results
|
873
873
|
images << image if image
|
874
874
|
|
@@ -940,12 +940,12 @@ module Google
|
|
940
940
|
#
|
941
941
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
942
942
|
#
|
943
|
-
# response = image_annotator_client.
|
943
|
+
# response = image_annotator_client.text_detection image: "path\to\image.png"
|
944
944
|
# response.responses.each do |res|
|
945
945
|
# puts res
|
946
946
|
# end
|
947
947
|
|
948
|
-
def
|
948
|
+
def text_detection \
|
949
949
|
images: [],
|
950
950
|
image: nil,
|
951
951
|
max_results: 10,
|
@@ -957,7 +957,7 @@ module Google
|
|
957
957
|
image_context: nil,
|
958
958
|
&blk
|
959
959
|
|
960
|
-
feature = { type: :
|
960
|
+
feature = { type: :TEXT_DETECTION }
|
961
961
|
feature[:max_results] = max_results
|
962
962
|
images << image if image
|
963
963
|
|
@@ -1029,12 +1029,12 @@ module Google
|
|
1029
1029
|
#
|
1030
1030
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
1031
1031
|
#
|
1032
|
-
# response = image_annotator_client.
|
1032
|
+
# response = image_annotator_client.web_detection image: "path\to\image.png"
|
1033
1033
|
# response.responses.each do |res|
|
1034
1034
|
# puts res
|
1035
1035
|
# end
|
1036
1036
|
|
1037
|
-
def
|
1037
|
+
def web_detection \
|
1038
1038
|
images: [],
|
1039
1039
|
image: nil,
|
1040
1040
|
max_results: 10,
|
@@ -1046,7 +1046,7 @@ module Google
|
|
1046
1046
|
image_context: nil,
|
1047
1047
|
&blk
|
1048
1048
|
|
1049
|
-
feature = { type: :
|
1049
|
+
feature = { type: :WEB_DETECTION }
|
1050
1050
|
feature[:max_results] = max_results
|
1051
1051
|
images << image if image
|
1052
1052
|
|
@@ -1120,22 +1120,22 @@ module Google
|
|
1120
1120
|
self.class.location_path project, location
|
1121
1121
|
end
|
1122
1122
|
|
1123
|
-
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.
|
1123
|
+
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.product_path.
|
1124
1124
|
# @param project [String]
|
1125
1125
|
# @param location [String]
|
1126
|
-
# @param
|
1126
|
+
# @param product [String]
|
1127
1127
|
# @return [String]
|
1128
|
-
def
|
1129
|
-
self.class.
|
1128
|
+
def product_path project, location, product
|
1129
|
+
self.class.product_path project, location, product
|
1130
1130
|
end
|
1131
1131
|
|
1132
|
-
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.
|
1132
|
+
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.product_set_path.
|
1133
1133
|
# @param project [String]
|
1134
1134
|
# @param location [String]
|
1135
|
-
# @param
|
1135
|
+
# @param product_set [String]
|
1136
1136
|
# @return [String]
|
1137
|
-
def
|
1138
|
-
self.class.
|
1137
|
+
def product_set_path project, location, product_set
|
1138
|
+
self.class.product_set_path project, location, product_set
|
1139
1139
|
end
|
1140
1140
|
|
1141
1141
|
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.reference_image_path.
|