Service Client: Google::Cloud::Vision::V1::ImageAnnotator::ImageAnnotatorClient

Client stub representing the remote ImageAnnotator gRPC service. Delegates call dispatching to Google::gRPC::Client.

target

The endpoint target address. Defaults to vision.googleapis.com:443.

credentials

The authentication credentials provider. Defaults to application default credentials via Google::Auth.

NAME

Google::Cloud::Vision::V1::ImageAnnotator - Compiled Protocol Buffers messages for google/cloud/vision/v1/image_annotator.proto

SYNOPSIS

use Google::Cloud::Vision::V1::ImageAnnotator;

my $msg = Google::Cloud::Vision::V1::ImageAnnotator::Feature->new({
    type => $type,
    max_results => $max_results,
    model => $model,
});

# Read or update a field
my $val = $msg->type();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Vision::V1::ImageAnnotator::Feature->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/vision/v1/image_annotator.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Vision::V1::ImageAnnotator::Feature

The type of Google Cloud Vision API detection to perform, and the maximum number of results to return for that type. Multiple `Feature` objects can be specified in the `features` list.

Inherits from Protobuf::Message.

Accessors

  • $msg->type() / $msg->type($value)

    Type: Enum (Google::Cloud::Vision::V1::Feature::Type)

    The feature type.

  • $msg->max_results() / $msg->max_results($value)

    Type: Int32

    Maximum number of results of this type. Does not apply to `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.

  • $msg->model() / $msg->model($value)

    Type: String

    Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also support "builtin/weekly" for the bleeding edge release updated weekly.

Enum: Feature::Type

  • TYPE_UNSPECIFIED => 0

  • FACE_DETECTION => 1

  • LANDMARK_DETECTION => 2

  • LOGO_DETECTION => 3

  • LABEL_DETECTION => 4

  • TEXT_DETECTION => 5

  • DOCUMENT_TEXT_DETECTION => 11

  • SAFE_SEARCH_DETECTION => 6

  • IMAGE_PROPERTIES => 7

  • CROP_HINTS => 9

  • WEB_DETECTION => 10

  • PRODUCT_SEARCH => 12

  • OBJECT_LOCALIZATION => 19

Google::Cloud::Vision::V1::ImageAnnotator::ImageSource

External image source (Google Cloud Storage or web URL image location).

Inherits from Protobuf::Message.

Accessors

  • $msg->gcs_image_uri() / $msg->gcs_image_uri($value)

    Type: String

    Use `image_uri` instead.

    The Google Cloud Storage URI of the form `gs://bucket_name/object_name`. Object versioning is not supported. See [Google Cloud Storage Request URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.

  • $msg->image_uri() / $msg->image_uri($value)

    Type: String

    The URI of the source image. Can be either:

    1. A Google Cloud Storage URI of the form `gs://bucket_name/object_name`. Object versioning is not supported. See [Google Cloud Storage Request URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.

    2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from HTTP/HTTPS URLs, Google cannot guarantee that the request will be completed. Your request may fail if the specified host denies the request (e.g. due to request throttling or DOS prevention), or if Google throttles requests to the site for abuse prevention. You should not depend on externally-hosted images for production applications.

    When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes precedence.

Google::Cloud::Vision::V1::ImageAnnotator::Image

Client image to perform Google Cloud Vision API tasks over.

Inherits from Protobuf::Message.

Accessors

  • $msg->content() / $msg->content($value)

    Type: Bytes

    Image content, represented as a stream of bytes. Note: As with all `bytes` fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

    Currently, this field only works for BatchAnnotateImages requests. It does not work for AsyncBatchAnnotateImages requests.

  • $msg->source() / $msg->source($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::ImageSource)

    Google Cloud Storage image location, or publicly-accessible image URL. If both `content` and `source` are provided for an image, `content` takes precedence and is used to perform the image annotation request.

Google::Cloud::Vision::V1::ImageAnnotator::FaceAnnotation

A face annotation object contains the results of face detection.

Inherits from Protobuf::Message.

Accessors

  • $msg->bounding_poly() / $msg->bounding_poly($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human expectations. It is based on the landmarker results. Note that one or more x and/or y coordinates may not be generated in the `BoundingPoly` (the polygon will be unbounded) if only a partial face appears in the image to be annotated.

  • $msg->fd_bounding_poly() / $msg->fd_bounding_poly($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    The `fd_bounding_poly` bounding polygon is tighter than the `boundingPoly`, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any image analysis that detects the "amount of skin" visible in an image. It is not based on the landmarker results, only on the initial face detection, hence the <code>fd</code> (face detection) prefix.

  • $msg->landmarks() / $msg->landmarks($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::FaceAnnotation::Landmark)

    Detected face landmarks.

  • $msg->roll_angle() / $msg->roll_angle($value)

    Type: Float

    Roll angle, which indicates the amount of clockwise/anti-clockwise rotation of the face relative to the image vertical about the axis perpendicular to the face. Range [-180,180].

  • $msg->pan_angle() / $msg->pan_angle($value)

    Type: Float

    Yaw angle, which indicates the leftward/rightward angle that the face is pointing relative to the vertical plane perpendicular to the image. Range [-180,180].

  • $msg->tilt_angle() / $msg->tilt_angle($value)

    Type: Float

    Pitch angle, which indicates the upwards/downwards angle that the face is pointing relative to the image's horizontal plane. Range [-180,180].

  • $msg->detection_confidence() / $msg->detection_confidence($value)

    Type: Float

    Detection confidence. Range [0, 1].

  • $msg->landmarking_confidence() / $msg->landmarking_confidence($value)

    Type: Float

    Face landmarking confidence. Range [0, 1].

  • $msg->joy_likelihood() / $msg->joy_likelihood($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Joy likelihood.

  • $msg->sorrow_likelihood() / $msg->sorrow_likelihood($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Sorrow likelihood.

  • $msg->anger_likelihood() / $msg->anger_likelihood($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Anger likelihood.

  • $msg->surprise_likelihood() / $msg->surprise_likelihood($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Surprise likelihood.

  • $msg->under_exposed_likelihood() / $msg->under_exposed_likelihood($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Under-exposed likelihood.

  • $msg->blurred_likelihood() / $msg->blurred_likelihood($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Blurred likelihood.

  • $msg->headwear_likelihood() / $msg->headwear_likelihood($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Headwear likelihood.

Google::Cloud::Vision::V1::ImageAnnotator::LocationInfo

Detected entity location information.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::Property

A `Property` consists of a user-supplied name/value pair.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    Name of the property.

  • $msg->value() / $msg->value($value)

    Type: String

    Value of the property.

  • $msg->uint64_value() / $msg->uint64_value($value)

    Type: UInt64

    Value of numeric properties.

Google::Cloud::Vision::V1::ImageAnnotator::EntityAnnotation

Set of detected entity features.

Inherits from Protobuf::Message.

Accessors

  • $msg->mid() / $msg->mid($value)

    Type: String

    Opaque entity ID. Some IDs may be available in [Google Knowledge Graph Search API](https://developers.google.com/knowledge-graph/).

  • $msg->locale() / $msg->locale($value)

    Type: String

    The language code for the locale in which the entity textual `description` is expressed.

  • $msg->description() / $msg->description($value)

    Type: String

    Entity textual description, expressed in its `locale` language.

  • $msg->score() / $msg->score($value)

    Type: Float

    Overall score of the result. Range [0, 1].

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

    Deprecated. Use `score` instead. The accuracy of the entity detection in an image. For example, for an image in which the "Eiffel Tower" entity is detected, this field represents the confidence that there is a tower in the query image. Range [0, 1].

  • $msg->topicality() / $msg->topicality($value)

    Type: Float

    The relevancy of the ICA (Image Content Annotation) label to the image. For example, the relevancy of "tower" is likely higher to an image containing the detected "Eiffel Tower" than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1].

  • $msg->bounding_poly() / $msg->bounding_poly($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    Image region to which this entity belongs. Not produced for `LABEL_DETECTION` features.

  • $msg->locations() / $msg->locations($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::LocationInfo)

    The location information for the detected entity. Multiple `LocationInfo` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks.

  • $msg->properties() / $msg->properties($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::Property)

    Some entities may have optional user-supplied `Property` (name/value) fields, such a score or string that qualifies the entity.

Google::Cloud::Vision::V1::ImageAnnotator::LocalizedObjectAnnotation

Set of detected objects with bounding boxes.

Inherits from Protobuf::Message.

Accessors

  • $msg->mid() / $msg->mid($value)

    Type: String

    Object ID that should align with EntityAnnotation mid.

  • $msg->language_code() / $msg->language_code($value)

    Type: String

    The BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.

  • $msg->name() / $msg->name($value)

    Type: String

    Object name, expressed in its `language_code` language.

  • $msg->score() / $msg->score($value)

    Type: Float

    Score of the result. Range [0, 1].

  • $msg->bounding_poly() / $msg->bounding_poly($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    Image region to which this object belongs. This must be populated.

Google::Cloud::Vision::V1::ImageAnnotator::SafeSearchAnnotation

Set of features pertaining to the image, computed by computer vision methods over safe-search verticals (for example, adult, spoof, medical, violence).

Inherits from Protobuf::Message.

Accessors

  • $msg->adult() / $msg->adult($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities.

  • $msg->spoof() / $msg->spoof($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive.

  • $msg->medical() / $msg->medical($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Likelihood that this is a medical image.

  • $msg->violence() / $msg->violence($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Likelihood that this image contains violent content. Violent content may include death, serious harm, or injury to individuals or groups of individuals.

  • $msg->racy() / $msg->racy($value)

    Type: Enum (Google::Cloud::Vision::V1::Likelihood)

    Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, strategically covered nudity, lewd or provocative poses, or close-ups of sensitive body areas.

Google::Cloud::Vision::V1::ImageAnnotator::LatLongRect

Rectangle determined by min and max `LatLng` pairs.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::ColorInfo

Color information consists of RGB channels, score, and the fraction of the image that the color occupies in the image.

Inherits from Protobuf::Message.

Accessors

  • $msg->color() / $msg->color($value)

    Type: Message (Google::Type::Color::Color)

    RGB components of the color.

  • $msg->score() / $msg->score($value)

    Type: Float

    Image-specific score for this color. Value in range [0, 1].

  • $msg->pixel_fraction() / $msg->pixel_fraction($value)

    Type: Float

    The fraction of pixels the color occupies in the image. Value in range [0, 1].

Google::Cloud::Vision::V1::ImageAnnotator::DominantColorsAnnotation

Set of dominant colors and their corresponding scores.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::ImageProperties

Stores image properties, such as dominant colors.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::CropHint

Single crop hint that is used to generate a new crop when serving an image.

Inherits from Protobuf::Message.

Accessors

  • $msg->bounding_poly() / $msg->bounding_poly($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale.

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

    Confidence of this being a salient region. Range [0, 1].

  • $msg->importance_fraction() / $msg->importance_fraction($value)

    Type: Float

    Fraction of importance of this salient region with respect to the original image.

Google::Cloud::Vision::V1::ImageAnnotator::CropHintsAnnotation

Set of crop hints that are used to generate new crops when serving images.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::CropHintsParams

Parameters for crop hints annotation request.

Inherits from Protobuf::Message.

Accessors

  • $msg->aspect_ratios() / $msg->aspect_ratios($value)

    Type: Float

    Aspect ratios in floats, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored.

Google::Cloud::Vision::V1::ImageAnnotator::WebDetectionParams

Parameters for web detection request.

Inherits from Protobuf::Message.

Accessors

  • $msg->include_geo_results() / $msg->include_geo_results($value)

    Type: Bool

    This field has no effect on results.

Google::Cloud::Vision::V1::ImageAnnotator::TextDetectionParams

Parameters for text detections. This is used to control TEXT_DETECTION and DOCUMENT_TEXT_DETECTION features.

Inherits from Protobuf::Message.

Accessors

  • $msg->enable_text_detection_confidence_score() / $msg->enable_text_detection_confidence_score($value)

    Type: Bool

    By default, Cloud Vision API only includes confidence score for DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence score for TEXT_DETECTION as well.

  • $msg->advanced_ocr_options() / $msg->advanced_ocr_options($value)

    Type: String

    A list of advanced OCR options to further fine-tune OCR behavior. Current valid values are:

    - `legacy_layout`: a heuristics layout detection algorithm, which serves as an alternative to the current ML-based layout detection algorithm. Customers can choose the best suitable layout algorithm based on their situation.

Google::Cloud::Vision::V1::ImageAnnotator::ImageContext

Image context and/or feature-specific parameters.

Inherits from Protobuf::Message.

Accessors

  • $msg->lat_long_rect() / $msg->lat_long_rect($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::LatLongRect)

    Not used.

  • $msg->language_hints() / $msg->language_hints($value)

    Type: String

    List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting `language_hints` is not needed. In rare cases, when the language of the text in the image is known, setting a hint will help get better results (although it will be a significant hindrance if the hint is wrong). Text detection returns an error if one or more of the specified languages is not one of the [supported languages](https://cloud.google.com/vision/docs/languages).

  • $msg->crop_hints_params() / $msg->crop_hints_params($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::CropHintsParams)

    Parameters for crop hints annotation request.

  • $msg->product_search_params() / $msg->product_search_params($value)

    Type: Message (Google::Cloud::Vision::V1::ProductSearch::ProductSearchParams)

    Parameters for product search.

  • $msg->web_detection_params() / $msg->web_detection_params($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::WebDetectionParams)

    Parameters for web detection.

  • $msg->text_detection_params() / $msg->text_detection_params($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::TextDetectionParams)

    Parameters for text detection and document text detection.

Google::Cloud::Vision::V1::ImageAnnotator::AnnotateImageRequest

Request for performing Google Cloud Vision API tasks over a user-provided image, with user-requested features, and with context information.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::ImageAnnotationContext

If an image was produced from a file (e.g. a PDF), this message gives information about the source of that image.

Inherits from Protobuf::Message.

Accessors

  • $msg->uri() / $msg->uri($value)

    Type: String

    The URI of the file used to produce the image.

  • $msg->page_number() / $msg->page_number($value)

    Type: Int32

    If the file was a PDF or TIFF, this field gives the page number within the file used to produce the image.

Google::Cloud::Vision::V1::ImageAnnotator::AnnotateImageResponse

Response to an image annotation request.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::BatchAnnotateImagesRequest

Multiple image annotation requests are batched into a single service call.

Inherits from Protobuf::Message.

Accessors

  • $msg->requests() / $msg->requests($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::AnnotateImageRequest)

    Required. Individual image annotation requests for this batch.

  • $msg->parent() / $msg->parent($value)

    Type: String

    Optional. Target project and location to make a call.

    Format: `projects/{project-id}/locations/{location-id}`.

    If no parent is specified, a region will be chosen automatically.

    Supported location-ids: `us`: USA country only, `asia`: East asia areas, like Japan, Taiwan, `eu`: The European Union.

    Example: `projects/project-A/locations/eu`.

  • $msg->labels() / $msg->labels($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::BatchAnnotateImagesRequest::LabelsEntry)

    Optional. The labels with user-defined metadata for the request.

    Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

Google::Cloud::Vision::V1::ImageAnnotator::BatchAnnotateImagesResponse

Response to a batch image annotation request.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::AnnotateFileRequest

A request to annotate one single file, e.g. a PDF, TIFF or GIF file.

Inherits from Protobuf::Message.

Accessors

  • $msg->input_config() / $msg->input_config($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::InputConfig)

    Required. Information about the input file.

  • $msg->features() / $msg->features($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::Feature)

    Required. Requested features.

  • $msg->image_context() / $msg->image_context($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::ImageContext)

    Additional context that may accompany the image(s) in the file.

  • $msg->pages() / $msg->pages($value)

    Type: Int32

    Pages of the file to perform image annotation.

    Pages starts from 1, we assume the first page of the file is page 1. At most 5 pages are supported per request. Pages can be negative.

    Page 1 means the first page. Page 2 means the second page. Page -1 means the last page. Page -2 means the second to the last page.

    If the file is GIF instead of PDF or TIFF, page refers to GIF frames.

    If this field is empty, by default the service performs image annotation for the first 5 pages of the file.

Google::Cloud::Vision::V1::ImageAnnotator::AnnotateFileResponse

Response to a single file annotation request. A file may contain one or more images, which individually have their own responses.

Inherits from Protobuf::Message.

Accessors

  • $msg->input_config() / $msg->input_config($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::InputConfig)

    Information about the file for which this response is generated.

  • $msg->responses() / $msg->responses($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::AnnotateImageResponse)

    Individual responses to images found within the file. This field will be empty if the `error` field is set.

  • $msg->total_pages() / $msg->total_pages($value)

    Type: Int32

    This field gives the total number of pages in the file.

  • $msg->error() / $msg->error($value)

    Type: Message (Google::Rpc::Status::Status)

    If set, represents the error message for the failed request. The `responses` field will not be set in this case.

Google::Cloud::Vision::V1::ImageAnnotator::BatchAnnotateFilesRequest

A list of requests to annotate files using the BatchAnnotateFiles API.

Inherits from Protobuf::Message.

Accessors

  • $msg->requests() / $msg->requests($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::AnnotateFileRequest)

    Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest.

  • $msg->parent() / $msg->parent($value)

    Type: String

    Optional. Target project and location to make a call.

    Format: `projects/{project-id}/locations/{location-id}`.

    If no parent is specified, a region will be chosen automatically.

    Supported location-ids: `us`: USA country only, `asia`: East asia areas, like Japan, Taiwan, `eu`: The European Union.

    Example: `projects/project-A/locations/eu`.

  • $msg->labels() / $msg->labels($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::BatchAnnotateFilesRequest::LabelsEntry)

    Optional. The labels with user-defined metadata for the request.

    Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

Google::Cloud::Vision::V1::ImageAnnotator::BatchAnnotateFilesResponse

A list of file annotation responses.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::AsyncAnnotateFileRequest

An offline file annotation request.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::AsyncAnnotateFileResponse

The response for a single offline file annotation request.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::AsyncBatchAnnotateImagesRequest

Request for async image annotation for a list of images.

Inherits from Protobuf::Message.

Accessors

  • $msg->requests() / $msg->requests($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::AnnotateImageRequest)

    Required. Individual image annotation requests for this batch.

  • $msg->output_config() / $msg->output_config($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::OutputConfig)

    Required. The desired output location and metadata (e.g. format).

  • $msg->parent() / $msg->parent($value)

    Type: String

    Optional. Target project and location to make a call.

    Format: `projects/{project-id}/locations/{location-id}`.

    If no parent is specified, a region will be chosen automatically.

    Supported location-ids: `us`: USA country only, `asia`: East asia areas, like Japan, Taiwan, `eu`: The European Union.

    Example: `projects/project-A/locations/eu`.

  • $msg->labels() / $msg->labels($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::AsyncBatchAnnotateImagesRequest::LabelsEntry)

    Optional. The labels with user-defined metadata for the request.

    Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

Google::Cloud::Vision::V1::ImageAnnotator::AsyncBatchAnnotateImagesResponse

Response to an async batch image annotation request.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::AsyncBatchAnnotateFilesRequest

Multiple async file annotation requests are batched into a single service call.

Inherits from Protobuf::Message.

Accessors

  • $msg->requests() / $msg->requests($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::AsyncAnnotateFileRequest)

    Required. Individual async file annotation requests for this batch.

  • $msg->parent() / $msg->parent($value)

    Type: String

    Optional. Target project and location to make a call.

    Format: `projects/{project-id}/locations/{location-id}`.

    If no parent is specified, a region will be chosen automatically.

    Supported location-ids: `us`: USA country only, `asia`: East asia areas, like Japan, Taiwan, `eu`: The European Union.

    Example: `projects/project-A/locations/eu`.

  • $msg->labels() / $msg->labels($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::AsyncBatchAnnotateFilesRequest::LabelsEntry)

    Optional. The labels with user-defined metadata for the request.

    Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

Google::Cloud::Vision::V1::ImageAnnotator::AsyncBatchAnnotateFilesResponse

Response to an async batch file annotation request.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::ImageAnnotator::InputConfig

The desired input location and metadata.

Inherits from Protobuf::Message.

Accessors

  • $msg->gcs_source() / $msg->gcs_source($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::GcsSource)

    The Google Cloud Storage location to read the input from.

  • $msg->content() / $msg->content($value)

    Type: Bytes

    File content, represented as a stream of bytes. Note: As with all `bytes` fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

    Currently, this field only works for BatchAnnotateFiles requests. It does not work for AsyncBatchAnnotateFiles requests.

  • $msg->mime_type() / $msg->mime_type($value)

    Type: String

    The type of the file. Currently only "application/pdf", "image/tiff" and "image/gif" are supported. Wildcards are not supported.

Google::Cloud::Vision::V1::ImageAnnotator::OutputConfig

The desired output location and metadata.

Inherits from Protobuf::Message.

Accessors

  • $msg->gcs_destination() / $msg->gcs_destination($value)

    Type: Message (Google::Cloud::Vision::V1::ImageAnnotator::GcsDestination)

    The Google Cloud Storage location to write the output(s) to.

  • $msg->batch_size() / $msg->batch_size($value)

    Type: Int32

    The max number of response protos to put into each output JSON file on Google Cloud Storage. The valid range is [1, 100]. If not specified, the default value is 20.

    For example, for one pdf file with 100 pages, 100 response protos will be generated. If `batch_size` = 20, then 5 json files each containing 20 response protos will be written under the prefix `gcs_destination`.`uri`.

    Currently, batch_size only applies to GcsDestination, with potential future support for other output configurations.

Google::Cloud::Vision::V1::ImageAnnotator::GcsSource

The Google Cloud Storage location where the input will be read from.

Inherits from Protobuf::Message.

Accessors

  • $msg->uri() / $msg->uri($value)

    Type: String

    Google Cloud Storage URI for the input file. This must only be a Google Cloud Storage object. Wildcards are not currently supported.

Google::Cloud::Vision::V1::ImageAnnotator::GcsDestination

The Google Cloud Storage location where the output will be written to.

Inherits from Protobuf::Message.

Accessors

  • $msg->uri() / $msg->uri($value)

    Type: String

    Google Cloud Storage URI prefix where the results will be stored. Results will be in JSON format and preceded by its corresponding input URI prefix. This field can either represent a gcs file prefix or gcs directory. In either case, the uri should be unique because in order to get all of the output files, you will need to do a wildcard gcs search on the uri prefix you provide.

    Examples:

    * File Prefix: gs://bucket-name/here/filenameprefix The output files will be created in gs://bucket-name/here/ and the names of the output files will begin with "filenameprefix".

    * Directory Prefix: gs://bucket-name/some/location/ The output files will be created in gs://bucket-name/some/location/ and the names of the output files could be anything because there was no filename prefix specified.

    If multiple outputs, each response is still AnnotateFileResponse, each of which contains some subset of the full list of AnnotateImageResponse. Multiple outputs can happen if, for example, the output JSON is too large and overflows into multiple sharded files.

Google::Cloud::Vision::V1::ImageAnnotator::OperationMetadata

Contains metadata for the BatchAnnotateImages operation.

Inherits from Protobuf::Message.

Accessors

Enum: OperationMetadata::State

  • STATE_UNSPECIFIED => 0

  • CREATED => 1

  • RUNNING => 2

  • DONE => 3

  • CANCELLED => 4

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Vision::V1::ImageAnnotator::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.