google-cloud-vision 0.21.1 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +8 -0
- data/LICENSE +201 -0
- data/README.md +59 -0
- data/lib/google/cloud/vision.rb +2 -2
- data/lib/google/cloud/vision/annotate.rb +4 -4
- data/lib/google/cloud/vision/annotation/entity.rb +9 -9
- data/lib/google/cloud/vision/annotation/face.rb +23 -21
- data/lib/google/cloud/vision/annotation/properties.rb +2 -2
- data/lib/google/cloud/vision/annotation/safe_search.rb +1 -1
- data/lib/google/cloud/vision/annotation/text.rb +4 -2
- data/lib/google/cloud/vision/annotation/vertex.rb +2 -2
- data/lib/google/cloud/vision/image.rb +11 -10
- data/lib/google/cloud/vision/project.rb +5 -5
- data/lib/google/cloud/vision/service.rb +2 -2
- data/lib/google/cloud/vision/v1.rb +1 -1
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +51 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +481 -0
- data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +104 -0
- data/lib/google/cloud/vision/v1/doc/google/protobuf/wrappers.rb +89 -0
- data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/vision/v1/doc/google/type/color.rb +155 -0
- data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +64 -0
- data/lib/google/cloud/vision/v1/{image_annotator_api.rb → image_annotator_client.rb} +6 -5
- data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -2
- data/lib/google/cloud/vision/version.rb +1 -1
- metadata +22 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9f3a6939189b494f77402ca73d084482f3c8237
|
4
|
+
data.tar.gz: fc123f74cc9f908bbbc4f0a6ff2094fe3364edf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e2e0be96d36520a426d00d020b2a7049caec31bde3c85a0cd66418b64e1eb730104a41a949f57858a73c59c6badfc157f194b703574e1542577d6a65a641341
|
7
|
+
data.tar.gz: 26600890ad89b22bfcd92e94472b810517d5ae0fdb769e0594ca57fdfe827e76d441f88ec52e6a1506ab86bba01f12e091221c7db8d7a86304966923dcf16cc3
|
data/.yardopts
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# google-cloud-vision
|
2
|
+
|
3
|
+
[Google Cloud Vision](https://cloud.google.com/vision/) ([docs](https://cloud.google.com/vision/docs)) allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.
|
4
|
+
|
5
|
+
- [google-cloud-vision API documentation](http://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-vision/master/google/cloud/vision)
|
6
|
+
- [google-cloud-vision on RubyGems](https://rubygems.org/gems/google-cloud-vision)
|
7
|
+
- [Google Cloud Vision documentation](https://cloud.google.com/vision/docs)
|
8
|
+
|
9
|
+
## Quick Start
|
10
|
+
|
11
|
+
```sh
|
12
|
+
$ gem install google-cloud-vision
|
13
|
+
```
|
14
|
+
|
15
|
+
## Authentication
|
16
|
+
|
17
|
+
This library uses Service Account credentials to connect to Google Cloud services. When running on Compute Engine the credentials will be discovered automatically. When running on other environments the Service Account credentials can be specified by providing the path to the JSON file, or the JSON itself, in environment variables.
|
18
|
+
|
19
|
+
Instructions and configuration options are covered in the [Authentication Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-vision/guides/authentication).
|
20
|
+
|
21
|
+
## Example
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require "google/cloud/vision"
|
25
|
+
|
26
|
+
vision = Google::Cloud::Vision.new
|
27
|
+
|
28
|
+
image = vision.image "path/to/landmark.jpg"
|
29
|
+
|
30
|
+
landmark = image.landmark
|
31
|
+
landmark.description #=> "Mount Rushmore"
|
32
|
+
```
|
33
|
+
|
34
|
+
## Supported Ruby Versions
|
35
|
+
|
36
|
+
This library is supported on Ruby 2.0+.
|
37
|
+
|
38
|
+
## Versioning
|
39
|
+
|
40
|
+
This library follows [Semantic Versioning](http://semver.org/).
|
41
|
+
|
42
|
+
It is currently in major version zero (0.y.z), which means that anything may change at any time and the public API should not be considered stable.
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
Contributions to this library are always welcome and highly encouraged.
|
47
|
+
|
48
|
+
See the [Contributing Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/contributing) for more information on how to get started.
|
49
|
+
|
50
|
+
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct](../CODE_OF_CONDUCT.md) for more information.
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
This library is licensed under Apache 2.0. Full license text is available in [LICENSE](LICENSE).
|
55
|
+
|
56
|
+
## Support
|
57
|
+
|
58
|
+
Please [report bugs at the project on Github](https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues).
|
59
|
+
Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby) about the client or APIs on [StackOverflow](http://stackoverflow.com).
|
data/lib/google/cloud/vision.rb
CHANGED
@@ -92,9 +92,9 @@ module Google
|
|
92
92
|
#
|
93
93
|
# face.features.to_h.count #=> 9
|
94
94
|
# face.features.eyes.left.pupil
|
95
|
-
#
|
95
|
+
# #<Landmark (x: 190.41544, y: 84.4557, z: -1.3682901)>
|
96
96
|
# face.features.chin.center
|
97
|
-
#
|
97
|
+
# #<Landmark (x: 233.21977, y: 189.47475, z: 19.487228)>
|
98
98
|
# ```
|
99
99
|
#
|
100
100
|
# To run multiple features on an image in a single request, pass the image
|
@@ -37,14 +37,14 @@ module Google
|
|
37
37
|
# face_image = vision.image "path/to/face.jpg"
|
38
38
|
# landmark_image = vision.image "path/to/landmark.jpg"
|
39
39
|
#
|
40
|
-
#
|
40
|
+
# annotations = vision.annotate do |annotate|
|
41
41
|
# annotate.annotate face_image, faces: true, labels: true
|
42
42
|
# annotate.annotate landmark_image, landmarks: true
|
43
43
|
# end
|
44
44
|
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
45
|
+
# annotations[0].faces.count #=> 1
|
46
|
+
# annotations[0].labels.count #=> 4
|
47
|
+
# annotations[1].landmarks.count #=> 1
|
48
48
|
#
|
49
49
|
class Annotate
|
50
50
|
# @private
|
@@ -29,7 +29,7 @@ module Google
|
|
29
29
|
#
|
30
30
|
# @see https://developers.google.com/knowledge-graph/ Knowledge Graph
|
31
31
|
#
|
32
|
-
# @example
|
32
|
+
# @example In landmark detection:
|
33
33
|
# require "google/cloud/vision"
|
34
34
|
#
|
35
35
|
# vision = Google::Cloud::Vision.new
|
@@ -37,11 +37,11 @@ module Google
|
|
37
37
|
# image = vision.image "path/to/landmark.jpg"
|
38
38
|
#
|
39
39
|
# landmark = image.landmark
|
40
|
-
# landmark.score #=> 0.
|
40
|
+
# landmark.score #=> 0.9191226363182068
|
41
41
|
# landmark.description #=> "Mount Rushmore"
|
42
42
|
# landmark.mid #=> "/m/019dvv"
|
43
43
|
#
|
44
|
-
# @example
|
44
|
+
# @example In logo detection:
|
45
45
|
# require "google/cloud/vision"
|
46
46
|
#
|
47
47
|
# vision = Google::Cloud::Vision.new
|
@@ -49,24 +49,24 @@ module Google
|
|
49
49
|
# image = vision.image "path/to/logo.jpg"
|
50
50
|
#
|
51
51
|
# logo = image.logo
|
52
|
-
# logo.score #=> 0.
|
52
|
+
# logo.score #=> 0.7005731463432312
|
53
53
|
# logo.description #=> "Google"
|
54
54
|
# logo.mid #=> "/m/0b34hf"
|
55
55
|
#
|
56
|
-
# @example
|
56
|
+
# @example In label detection:
|
57
57
|
# require "google/cloud/vision"
|
58
58
|
#
|
59
59
|
# vision = Google::Cloud::Vision.new
|
60
60
|
#
|
61
|
-
# image = vision.image "path/to/
|
61
|
+
# image = vision.image "path/to/landmark.jpg"
|
62
62
|
#
|
63
63
|
# labels = image.labels
|
64
64
|
# labels.count #=> 4
|
65
65
|
#
|
66
66
|
# label = labels.first
|
67
|
-
# label.score #=> 0.
|
68
|
-
# label.description #=> "
|
69
|
-
# label.mid #=> "/m/
|
67
|
+
# label.score #=> 0.9481348991394043
|
68
|
+
# label.description #=> "stone carving"
|
69
|
+
# label.mid #=> "/m/02wtjj"
|
70
70
|
#
|
71
71
|
class Entity
|
72
72
|
##
|
@@ -34,7 +34,7 @@ module Google
|
|
34
34
|
# image = vision.image "path/to/face.jpg"
|
35
35
|
#
|
36
36
|
# face = image.face
|
37
|
-
# face.confidence #=> 0.
|
37
|
+
# face.confidence #=> 0.8616237640380859
|
38
38
|
#
|
39
39
|
class Face
|
40
40
|
##
|
@@ -137,9 +137,9 @@ module Google
|
|
137
137
|
# image = vision.image "path/to/face.jpg"
|
138
138
|
# face = image.face
|
139
139
|
#
|
140
|
-
# face.angles.roll #=> -5.
|
141
|
-
# face.angles.yaw #=> -4.
|
142
|
-
# face.angles.pitch #=> -13.
|
140
|
+
# face.angles.roll #=> -5.149211883544922
|
141
|
+
# face.angles.yaw #=> -4.069568157196045
|
142
|
+
# face.angles.pitch #=> -13.083284378051758
|
143
143
|
#
|
144
144
|
class Angles
|
145
145
|
##
|
@@ -239,7 +239,9 @@ module Google
|
|
239
239
|
# face = image.face
|
240
240
|
#
|
241
241
|
# face.bounds.face.count #=> 4
|
242
|
-
# face.bounds.face.first
|
242
|
+
# vertex = face.bounds.face.first
|
243
|
+
# vertex.x #=> 28
|
244
|
+
# vertex.y #=> 40
|
243
245
|
#
|
244
246
|
class Bounds
|
245
247
|
##
|
@@ -339,9 +341,9 @@ module Google
|
|
339
341
|
#
|
340
342
|
# face.features.to_h.count #=> 9
|
341
343
|
# face.features.eyes.left.pupil
|
342
|
-
#
|
344
|
+
# #<Landmark (x: 190.41544, y: 84.4557, z: -1.3682901)>
|
343
345
|
# face.features.chin.center
|
344
|
-
#
|
346
|
+
# #<Landmark (x: 233.21977, y: 189.47475, z: 19.487228)>
|
345
347
|
#
|
346
348
|
class Features
|
347
349
|
##
|
@@ -384,7 +386,7 @@ module Google
|
|
384
386
|
# face = image.face
|
385
387
|
#
|
386
388
|
# face.features["RIGHT_EAR_TRAGION"]
|
387
|
-
#
|
389
|
+
# #<Landmark (x: 303.81198, y: 88.5782, z: 77.719193)>
|
388
390
|
#
|
389
391
|
def [] landmark_type
|
390
392
|
landmark = Array(@grpc.landmarks).detect do |l|
|
@@ -544,9 +546,9 @@ module Google
|
|
544
546
|
#
|
545
547
|
# face.features.to_h.count #=> 9
|
546
548
|
# face.features.eyes.left.pupil
|
547
|
-
#
|
549
|
+
# #<Landmark (x: 190.41544, y: 84.4557, z: -1.3682901)>
|
548
550
|
# face.features.chin.center
|
549
|
-
#
|
551
|
+
# #<Landmark (x: 233.21977, y: 189.47475, z: 19.487228)>
|
550
552
|
#
|
551
553
|
class Landmark
|
552
554
|
##
|
@@ -575,7 +577,7 @@ module Google
|
|
575
577
|
# image = vision.image "path/to/face.jpg"
|
576
578
|
# face = image.face
|
577
579
|
#
|
578
|
-
# face.features.forehead.type #=>
|
580
|
+
# face.features.forehead.type #=> :FOREHEAD_GLABELLA
|
579
581
|
#
|
580
582
|
def type
|
581
583
|
@grpc.type
|
@@ -673,7 +675,7 @@ module Google
|
|
673
675
|
# chin = face.features.chin
|
674
676
|
#
|
675
677
|
# chin.center
|
676
|
-
#
|
678
|
+
# #<Landmark (x: 233.21977, y: 189.47475, z: 19.487228)>
|
677
679
|
#
|
678
680
|
class Chin
|
679
681
|
attr_reader :left, :center, :right
|
@@ -743,7 +745,7 @@ module Google
|
|
743
745
|
#
|
744
746
|
# ears = face.features.ears
|
745
747
|
# ears.right
|
746
|
-
#
|
748
|
+
# #<Landmark (x: 303.81198, y: 88.5782, z: 77.719193)>
|
747
749
|
#
|
748
750
|
class Ears
|
749
751
|
attr_reader :left, :right
|
@@ -813,7 +815,7 @@ module Google
|
|
813
815
|
#
|
814
816
|
# right_eyebrow = eyebrows.right
|
815
817
|
# right_eyebrow.top
|
816
|
-
#
|
818
|
+
# #<Landmark (x: 256.3194, y: 58.222664, z: -17.299419)>
|
817
819
|
#
|
818
820
|
class Eyebrows
|
819
821
|
attr_reader :left, :right
|
@@ -884,7 +886,7 @@ module Google
|
|
884
886
|
#
|
885
887
|
# right_eyebrow = eyebrows.right
|
886
888
|
# right_eyebrow.top
|
887
|
-
#
|
889
|
+
# #<Landmark (x: 256.3194, y: 58.222664, z: -17.299419)>
|
888
890
|
#
|
889
891
|
class Eyebrow
|
890
892
|
attr_reader :left, :top, :right
|
@@ -956,7 +958,7 @@ module Google
|
|
956
958
|
#
|
957
959
|
# right_eye = eyes.right
|
958
960
|
# right_eye.pupil
|
959
|
-
#
|
961
|
+
# #<Landmark (x: 256.63464, y: 79.641411, z: -6.0731235)>
|
960
962
|
#
|
961
963
|
class Eyes
|
962
964
|
attr_reader :left, :right
|
@@ -1029,7 +1031,7 @@ module Google
|
|
1029
1031
|
# right_eye = face.features.eyes.right
|
1030
1032
|
#
|
1031
1033
|
# right_eye.pupil
|
1032
|
-
#
|
1034
|
+
# #<Landmark (x: 256.63464, y: 79.641411, z: -6.0731235)>
|
1033
1035
|
#
|
1034
1036
|
class Eye
|
1035
1037
|
attr_reader :left, :bottom, :center, :pupil, :top, :right
|
@@ -1102,7 +1104,7 @@ module Google
|
|
1102
1104
|
# lips = face.features.lips
|
1103
1105
|
#
|
1104
1106
|
# lips.top
|
1105
|
-
#
|
1107
|
+
# #<Landmark (x: 228.54768, y: 143.2952, z: -5.6550336)>
|
1106
1108
|
#
|
1107
1109
|
class Lips
|
1108
1110
|
attr_reader :top, :bottom
|
@@ -1175,7 +1177,7 @@ module Google
|
|
1175
1177
|
# mouth = face.features.mouth
|
1176
1178
|
#
|
1177
1179
|
# mouth.center
|
1178
|
-
#
|
1180
|
+
# #<Landmark (x: 228.53499, y: 150.29066, z: 1.1069832)>
|
1179
1181
|
#
|
1180
1182
|
class Mouth
|
1181
1183
|
attr_reader :left, :center, :right
|
@@ -1249,7 +1251,7 @@ module Google
|
|
1249
1251
|
# nose = face.features.nose
|
1250
1252
|
#
|
1251
1253
|
# nose.tip
|
1252
|
-
#
|
1254
|
+
# #<Landmark (x: 225.23511, y: 122.47372, z: -25.817825)>
|
1253
1255
|
#
|
1254
1256
|
class Nose
|
1255
1257
|
attr_reader :left, :bottom, :tip, :top, :right
|
@@ -1320,7 +1322,7 @@ module Google
|
|
1320
1322
|
#
|
1321
1323
|
# face.likelihood.to_h.count #=> 7
|
1322
1324
|
# face.likelihood.sorrow? #=> false
|
1323
|
-
# face.likelihood.sorrow #=>
|
1325
|
+
# face.likelihood.sorrow #=> :VERY_UNLIKELY
|
1324
1326
|
#
|
1325
1327
|
class Likelihood
|
1326
1328
|
POSITIVE_RATINGS = %i(POSSIBLE LIKELY VERY_LIKELY)
|