Class: Gcloud::Vision::Annotate
- Inherits:
-
Object
- Object
- Gcloud::Vision::Annotate
- Defined in:
- lib/gcloud/vision/annotate.rb
Overview
# Annotate
Accumulates configuration for an image annotation request. Users describe the type of Google Cloud Vision API tasks to perform over images by configuring features such as ‘faces`, `landmarks`, `text`, etc. This configuration captures the Cloud Vision API vertical to operate on and the number of top-scoring results to return.
See Project#annotate.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#annotate(*images, faces: false, landmarks: false, logos: false, labels: false, text: false, safe_search: false, properties: false) ⇒ Annotation+
Performs detection of Cloud Vision [features](cloud.google.com/vision/reference/rest/v1/images/annotate#Feature) on the given images.
-
#initialize(project) ⇒ Annotate
constructor
A new instance of Annotate.
Constructor Details
#initialize(project) ⇒ Annotate
Returns a new instance of Annotate.
55 56 57 58 |
# File 'lib/gcloud/vision/annotate.rb', line 55 def initialize project @project = project @requests = [] end |
Instance Attribute Details
#requests ⇒ Object
51 52 53 |
# File 'lib/gcloud/vision/annotate.rb', line 51 def requests @requests end |
Instance Method Details
#annotate(*images, faces: false, landmarks: false, logos: false, labels: false, text: false, safe_search: false, properties: false) ⇒ Annotation+
Performs detection of Cloud Vision [features](cloud.google.com/vision/reference/rest/v1/images/annotate#Feature) on the given images. If no options for features are provided, all image detection features will be performed, with a default of ‘100` results for faces, landmarks, logos, and labels. If any feature option is provided, only the specified feature detections will be performed. Please review [Pricing](cloud.google.com/vision/docs/pricing) before use, as a separate charge is incurred for each feature performed on an image.
Cloud Vision sets upper limits on file size as well as on the total combined size of all images in a request. Reducing your file size can significantly improve throughput; however, be careful not to reduce image quality in the process. See [Best Practices - Image Sizing](cloud.google.com/vision/docs/image-best-practices#image_sizing) for current file size limits.
See Project#annotate for requests that do not involve multiple feature configurations.
136 137 138 139 140 141 |
# File 'lib/gcloud/vision/annotate.rb', line 136 def annotate *images, faces: false, landmarks: false, logos: false, labels: false, text: false, safe_search: false, properties: false add_requests(images, faces, landmarks, logos, labels, text, safe_search, properties) end |