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:
Int32Maximum number of results of this type. Does not apply to `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
$msg->model()/$msg->model($value)Type:
StringModel 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=>0FACE_DETECTION=>1LANDMARK_DETECTION=>2LOGO_DETECTION=>3LABEL_DETECTION=>4TEXT_DETECTION=>5DOCUMENT_TEXT_DETECTION=>11SAFE_SEARCH_DETECTION=>6IMAGE_PROPERTIES=>7CROP_HINTS=>9WEB_DETECTION=>10PRODUCT_SEARCH=>12OBJECT_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:
StringUse `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:
StringThe 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:
BytesImage 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:
FloatRoll 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:
FloatYaw 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:
FloatPitch 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:
FloatDetection confidence. Range [0, 1].
$msg->landmarking_confidence()/$msg->landmarking_confidence($value)Type:
FloatFace 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
$msg->lat_lng()/$msg->lat_lng($value)Type:
Message(Google::Type::Latlng::LatLng)lat/long location coordinates.
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:
StringName of the property.
$msg->value()/$msg->value($value)Type:
StringValue of the property.
$msg->uint64_value()/$msg->uint64_value($value)Type:
UInt64Value 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:
StringOpaque 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:
StringThe language code for the locale in which the entity textual `description` is expressed.
$msg->description()/$msg->description($value)Type:
StringEntity textual description, expressed in its `locale` language.
$msg->score()/$msg->score($value)Type:
FloatOverall score of the result. Range [0, 1].
$msg->confidence()/$msg->confidence($value)Type:
FloatDeprecated. 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:
FloatThe 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:
StringObject ID that should align with EntityAnnotation mid.
$msg->language_code()/$msg->language_code($value)Type:
StringThe 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:
StringObject name, expressed in its `language_code` language.
$msg->score()/$msg->score($value)Type:
FloatScore 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
$msg->min_lat_lng()/$msg->min_lat_lng($value)Type:
Message(Google::Type::Latlng::LatLng)Min lat/long pair.
$msg->max_lat_lng()/$msg->max_lat_lng($value)Type:
Message(Google::Type::Latlng::LatLng)Max lat/long pair.
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:
FloatImage-specific score for this color. Value in range [0, 1].
$msg->pixel_fraction()/$msg->pixel_fraction($value)Type:
FloatThe 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
$msg->colors()/$msg->colors($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::ColorInfo)RGB color values with their score and pixel fraction.
Google::Cloud::Vision::V1::ImageAnnotator::ImageProperties
Stores image properties, such as dominant colors.
Inherits from Protobuf::Message.
Accessors
$msg->dominant_colors()/$msg->dominant_colors($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::DominantColorsAnnotation)If present, dominant colors completed successfully.
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:
FloatConfidence of this being a salient region. Range [0, 1].
$msg->importance_fraction()/$msg->importance_fraction($value)Type:
FloatFraction 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
$msg->crop_hints()/$msg->crop_hints($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::CropHint)Crop hint results.
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:
FloatAspect 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:
BoolThis 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:
BoolBy 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:
StringA 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:
StringList 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
$msg->image()/$msg->image($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::Image)The image to be processed.
$msg->features()/$msg->features($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::Feature)Requested features.
$msg->image_context()/$msg->image_context($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::ImageContext)Additional context that may accompany the image.
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:
StringThe URI of the file used to produce the image.
$msg->page_number()/$msg->page_number($value)Type:
Int32If 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
$msg->face_annotations()/$msg->face_annotations($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::FaceAnnotation)If present, face detection has completed successfully.
$msg->landmark_annotations()/$msg->landmark_annotations($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::EntityAnnotation)If present, landmark detection has completed successfully.
$msg->logo_annotations()/$msg->logo_annotations($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::EntityAnnotation)If present, logo detection has completed successfully.
$msg->label_annotations()/$msg->label_annotations($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::EntityAnnotation)If present, label detection has completed successfully.
$msg->localized_object_annotations()/$msg->localized_object_annotations($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::LocalizedObjectAnnotation)If present, localized object detection has completed successfully. This will be sorted descending by confidence score.
$msg->text_annotations()/$msg->text_annotations($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::EntityAnnotation)If present, text (OCR) detection has completed successfully.
$msg->full_text_annotation()/$msg->full_text_annotation($value)Type:
Message(Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation)If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text.
$msg->safe_search_annotation()/$msg->safe_search_annotation($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::SafeSearchAnnotation)If present, safe-search annotation has completed successfully.
$msg->image_properties_annotation()/$msg->image_properties_annotation($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::ImageProperties)If present, image properties were extracted successfully.
$msg->crop_hints_annotation()/$msg->crop_hints_annotation($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::CropHintsAnnotation)If present, crop hints have completed successfully.
$msg->web_detection()/$msg->web_detection($value)Type:
Message(Google::Cloud::Vision::V1::WebDetection::WebDetection)If present, web detection has completed successfully.
$msg->product_search_results()/$msg->product_search_results($value)Type:
Message(Google::Cloud::Vision::V1::ProductSearch::ProductSearchResults)If present, product search has completed successfully.
$msg->error()/$msg->error($value)Type:
Message(Google::Rpc::Status::Status)If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when `error` is set.
$msg->context()/$msg->context($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::ImageAnnotationContext)If present, contextual information is needed to understand where this image comes from.
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:
StringOptional. 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
$msg->responses()/$msg->responses($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::AnnotateImageResponse)Individual responses to image annotation requests within the batch.
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:
Int32Pages 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:
Int32This 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:
StringOptional. 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
$msg->responses()/$msg->responses($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::AnnotateFileResponse)The list of file annotation responses, each response corresponding to each AnnotateFileRequest in BatchAnnotateFilesRequest.
Google::Cloud::Vision::V1::ImageAnnotator::AsyncAnnotateFileRequest
An offline file annotation request.
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->output_config()/$msg->output_config($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::OutputConfig)Required. The desired output location and metadata (e.g. format).
Google::Cloud::Vision::V1::ImageAnnotator::AsyncAnnotateFileResponse
The response for a single offline file annotation request.
Inherits from Protobuf::Message.
Accessors
$msg->output_config()/$msg->output_config($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::OutputConfig)The output location and metadata from AsyncAnnotateFileRequest.
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:
StringOptional. 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
$msg->output_config()/$msg->output_config($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::OutputConfig)The output location and metadata from AsyncBatchAnnotateImagesRequest.
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:
StringOptional. 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
$msg->responses()/$msg->responses($value)Type:
Message(Google::Cloud::Vision::V1::ImageAnnotator::AsyncAnnotateFileResponse)The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest.
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:
BytesFile 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:
StringThe 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:
Int32The 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:
StringGoogle 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:
StringGoogle 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
$msg->state()/$msg->state($value)Type:
Enum(Google::Cloud::Vision::V1::OperationMetadata::State)Current state of the batch operation.
$msg->create_time()/$msg->create_time($value)Type:
Message(Google::Protobuf::Timestamp::Timestamp)The time when the batch request was received.
$msg->update_time()/$msg->update_time($value)Type:
Message(Google::Protobuf::Timestamp::Timestamp)The time when the operation result was last updated.
Enum: OperationMetadata::State
STATE_UNSPECIFIED=>0CREATED=>1RUNNING=>2DONE=>3CANCELLED=>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.