Module: Google::Cloud::Vision
- Defined in:
- lib/google/cloud/vision.rb,
lib/google/cloud/vision/v1.rb,
lib/google/cloud/vision/image.rb,
lib/google/cloud/vision/project.rb,
lib/google/cloud/vision/service.rb,
lib/google/cloud/vision/version.rb,
lib/google/cloud/vision/annotate.rb,
lib/google/cloud/vision/location.rb,
lib/google/cloud/vision/annotation.rb,
lib/google/cloud/vision/credentials.rb,
lib/google/cloud/vision/annotation/web.rb,
lib/google/cloud/vision/v1/credentials.rb,
lib/google/cloud/vision/annotation/face.rb,
lib/google/cloud/vision/annotation/text.rb,
lib/google/cloud/vision/annotation/entity.rb,
lib/google/cloud/vision/annotation/vertex.rb,
lib/google/cloud/vision/annotation/crop_hint.rb,
lib/google/cloud/vision/annotation/properties.rb,
lib/google/cloud/vision/annotation/safe_search.rb,
lib/google/cloud/vision/v1/image_annotator_client.rb,
lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb,
lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb,
lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb,
lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb
Overview
Google Cloud Vision
Google Cloud Vision 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.
For more information about Cloud Vision, read the Google Cloud Vision API Documentation.
See Vision Overview.
Defined Under Namespace
Modules: V1 Classes: Annotate, Annotation, Credentials, Image, Location, Project
Constant Summary collapse
- VERSION =
"0.30.1".freeze
Class Method Summary collapse
-
.configure {|Google::Cloud.configure.vision| ... } ⇒ Google::Cloud::Config
Configure the Google Cloud Vision library.
-
.default_max_crop_hints ⇒ Object
The default max results to return for crop hints detection requests.
-
.default_max_crop_hints=(value) ⇒ Object
The default max results to return for crop hints detection requests.
-
.default_max_faces ⇒ Object
The default max results to return for face detection requests.
-
.default_max_faces=(value) ⇒ Object
The default max results to return for facial detection requests.
-
.default_max_labels ⇒ Object
The default max results to return for label detection requests.
-
.default_max_labels=(value) ⇒ Object
The default max results to return for label detection requests.
-
.default_max_landmarks ⇒ Object
The default max results to return for landmark detection requests.
-
.default_max_landmarks=(value) ⇒ Object
The default max results to return for landmark detection requests.
-
.default_max_logos ⇒ Object
The default max results to return for logo detection requests.
-
.default_max_logos=(value) ⇒ Object
The default max results to return for logo detection requests.
-
.default_max_web ⇒ Object
The default max results to return for web detection requests.
-
.default_max_web=(value) ⇒ Object
The default max results to return for web detection requests.
-
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Vision::Project
Creates a new object for connecting to the Vision service.
Class Method Details
.configure {|Google::Cloud.configure.vision| ... } ⇒ Google::Cloud::Config
Configure the Google Cloud Vision library.
The following Vision configuration parameters are supported:
project_id
- (String) Identifier for a Vision project. (The parameterproject
is considered deprecated, but may also be used.)credentials
- (String, Hash, Google::Auth::Credentials) The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See Credentials) (The parameterkeyfile
is considered deprecated, but may also be used.)scope
- (String, Array) The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. timeout
- (Integer) Default timeout to use in requests.client_config
- (Hash) A hash of values to override the default behavior of the API client.default_max_faces
- (Integer) The default max results to return for facial detection requests. See default_max_faces=.default_max_landmarks
- (Integer) The default max results to return for landmark detection requests. See default_max_landmarks=.default_max_logos
- (Integer) The default max results to return for logo detection requests. See default_max_logos=.default_max_labels
- (Integer) The default max results to return for label detection requests. See default_max_labels=.default_max_crop_hints
- (Integer) The default max results to return for crop hints detection requests. See default_max_crop_hints=.default_max_web
- (Integer) The default max results to return for web detection requests. See default_max_faces=.
539 540 541 542 543 |
# File 'lib/google/cloud/vision.rb', line 539 def self.configure yield Google::Cloud.configure.vision if block_given? Google::Cloud.configure.vision end |
.default_max_crop_hints ⇒ Object
The default max results to return for crop hints detection requests.
373 374 375 |
# File 'lib/google/cloud/vision.rb', line 373 def default_max_crop_hints configure.default_max_crop_hints end |
.default_max_crop_hints=(value) ⇒ Object
The default max results to return for crop hints detection requests. This is used on Google::Cloud::Vision::Project#annotate as well as Google::Cloud::Vision::Image#crop_hints.
The default value is 100.
This is also available on the configuration as
Google::Cloud::Vision.configure.default_max_crop_hints
366 367 368 |
# File 'lib/google/cloud/vision.rb', line 366 def default_max_crop_hints= value configure.default_max_crop_hints = value end |
.default_max_faces ⇒ Object
The default max results to return for face detection requests.
101 102 103 |
# File 'lib/google/cloud/vision.rb', line 101 def default_max_faces configure.default_max_faces end |
.default_max_faces=(value) ⇒ Object
The default max results to return for facial detection requests. This is used on Google::Cloud::Vision::Project#annotate as well as Google::Cloud::Vision::Image#faces.
The default value is 100
.
This is also available on the configuration as
Google::Cloud::Vision.configure.default_max_faces
94 95 96 |
# File 'lib/google/cloud/vision.rb', line 94 def default_max_faces= value configure.default_max_faces = value end |
.default_max_labels ⇒ Object
The default max results to return for label detection requests.
304 305 306 |
# File 'lib/google/cloud/vision.rb', line 304 def default_max_labels configure.default_max_labels end |
.default_max_labels=(value) ⇒ Object
The default max results to return for label detection requests. This is used on Google::Cloud::Vision::Project#annotate as well as Google::Cloud::Vision::Image#labels.
The default value is 100.
This is also available on the configuration as
Google::Cloud::Vision.configure.default_max_labels
297 298 299 |
# File 'lib/google/cloud/vision.rb', line 297 def default_max_labels= value configure.default_max_labels = value end |
.default_max_landmarks ⇒ Object
The default max results to return for landmark detection requests.
170 171 172 |
# File 'lib/google/cloud/vision.rb', line 170 def default_max_landmarks configure.default_max_landmarks end |
.default_max_landmarks=(value) ⇒ Object
The default max results to return for landmark detection requests. This is used on Google::Cloud::Vision::Project#annotate as well as Google::Cloud::Vision::Image#landmarks.
The default value is 100.
This is also available on the configuration as
Google::Cloud::Vision.configure.default_max_landmarks
163 164 165 |
# File 'lib/google/cloud/vision.rb', line 163 def default_max_landmarks= value configure.default_max_landmarks = value end |
.default_max_logos ⇒ Object
The default max results to return for logo detection requests.
237 238 239 |
# File 'lib/google/cloud/vision.rb', line 237 def default_max_logos configure.default_max_logos end |
.default_max_logos=(value) ⇒ Object
The default max results to return for logo detection requests. This is used on Google::Cloud::Vision::Project#annotate as well as Google::Cloud::Vision::Image#logos.
The default value is 100.
This is also available on the configuration as
Google::Cloud::Vision.configure.default_max_logos
230 231 232 |
# File 'lib/google/cloud/vision.rb', line 230 def default_max_logos= value configure.default_max_logos = value end |
.default_max_web ⇒ Object
The default max results to return for web detection requests.
442 443 444 |
# File 'lib/google/cloud/vision.rb', line 442 def default_max_web configure.default_max_web end |
.default_max_web=(value) ⇒ Object
The default max results to return for web detection requests. This is used on Google::Cloud::Vision::Project#annotate as well as Google::Cloud::Vision::Image#web.
The default value is 100.
This is also available on the configuration as
Google::Cloud::Vision.configure.default_max_web
435 436 437 |
# File 'lib/google/cloud/vision.rb', line 435 def default_max_web= value configure.default_max_web = value end |
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Vision::Project
Creates a new object for connecting to the Vision service. Each call creates a new connection.
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/google/cloud/vision.rb', line 484 def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil project_id ||= (project || default_project_id) project_id = project_id.to_s # Always cast to a string raise ArgumentError, "project_id is missing" if project_id.empty? scope ||= configure.scope timeout ||= configure.timeout client_config ||= configure.client_config credentials ||= (keyfile || default_credentials(scope: scope)) unless credentials.is_a? Google::Auth::Credentials credentials = Vision::Credentials.new credentials, scope: scope end Vision::Project.new( Vision::Service.new( project_id, credentials, timeout: timeout, client_config: client_config ) ) end |