Package com.google.cloud.vision.v1p1beta1 (3.9.0)

The interfaces provided are listed below, along with usage samples.

ImageAnnotatorClient

Service Description: Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

Sample for ImageAnnotatorClient:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
   List<AnnotateImageRequest> requests = new ArrayList<>();
   BatchAnnotateImagesResponse response = imageAnnotatorClient.batchAnnotateImages(requests);
 }
 

Classes

AnnotateImageRequest

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

Protobuf type google.cloud.vision.v1p1beta1.AnnotateImageRequest

AnnotateImageRequest.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.AnnotateImageRequest

AnnotateImageResponse

Response to an image annotation request.

Protobuf type google.cloud.vision.v1p1beta1.AnnotateImageResponse

AnnotateImageResponse.Builder

Response to an image annotation request.

Protobuf type google.cloud.vision.v1p1beta1.AnnotateImageResponse

BatchAnnotateImagesRequest

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

Protobuf type google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest

BatchAnnotateImagesRequest.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest

BatchAnnotateImagesResponse

Response to a batch image annotation request.

Protobuf type google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse

BatchAnnotateImagesResponse.Builder

Response to a batch image annotation request.

Protobuf type google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse

Block

Logical element on the page.

Protobuf type google.cloud.vision.v1p1beta1.Block

Block.Builder

Logical element on the page.

Protobuf type google.cloud.vision.v1p1beta1.Block

BoundingPoly

A bounding polygon for the detected image annotation.

Protobuf type google.cloud.vision.v1p1beta1.BoundingPoly

BoundingPoly.Builder

A bounding polygon for the detected image annotation.

Protobuf type google.cloud.vision.v1p1beta1.BoundingPoly

ColorInfo

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

Protobuf type google.cloud.vision.v1p1beta1.ColorInfo

ColorInfo.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.ColorInfo

CropHint

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

Protobuf type google.cloud.vision.v1p1beta1.CropHint

CropHint.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.CropHint

CropHintsAnnotation

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

Protobuf type google.cloud.vision.v1p1beta1.CropHintsAnnotation

CropHintsAnnotation.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.CropHintsAnnotation

CropHintsParams

Parameters for crop hints annotation request.

Protobuf type google.cloud.vision.v1p1beta1.CropHintsParams

CropHintsParams.Builder

Parameters for crop hints annotation request.

Protobuf type google.cloud.vision.v1p1beta1.CropHintsParams

DominantColorsAnnotation

Set of dominant colors and their corresponding scores.

Protobuf type google.cloud.vision.v1p1beta1.DominantColorsAnnotation

DominantColorsAnnotation.Builder

Set of dominant colors and their corresponding scores.

Protobuf type google.cloud.vision.v1p1beta1.DominantColorsAnnotation

EntityAnnotation

Set of detected entity features.

Protobuf type google.cloud.vision.v1p1beta1.EntityAnnotation

EntityAnnotation.Builder

Set of detected entity features.

Protobuf type google.cloud.vision.v1p1beta1.EntityAnnotation

FaceAnnotation

A face annotation object contains the results of face detection.

Protobuf type google.cloud.vision.v1p1beta1.FaceAnnotation

FaceAnnotation.Builder

A face annotation object contains the results of face detection.

Protobuf type google.cloud.vision.v1p1beta1.FaceAnnotation

FaceAnnotation.Landmark

A face-specific landmark (for example, a face feature).

Protobuf type google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark

FaceAnnotation.Landmark.Builder

A face-specific landmark (for example, a face feature).

Protobuf type google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark

Feature

Users describe the type of Google Cloud Vision API tasks to perform over images by using Features. Each Feature indicates a type of image detection task to perform. Features encode the Cloud Vision API vertical to operate on and the number of top-scoring results to return.

Protobuf type google.cloud.vision.v1p1beta1.Feature

Feature.Builder

Users describe the type of Google Cloud Vision API tasks to perform over images by using Features. Each Feature indicates a type of image detection task to perform. Features encode the Cloud Vision API vertical to operate on and the number of top-scoring results to return.

Protobuf type google.cloud.vision.v1p1beta1.Feature

GeometryProto

Image

Client image to perform Google Cloud Vision API tasks over.

Protobuf type google.cloud.vision.v1p1beta1.Image

Image.Builder

Client image to perform Google Cloud Vision API tasks over.

Protobuf type google.cloud.vision.v1p1beta1.Image

ImageAnnotatorClient

Service Description: Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) {
   List<AnnotateImageRequest> requests = new ArrayList<>();
   BatchAnnotateImagesResponse response = imageAnnotatorClient.batchAnnotateImages(requests);
 }
 

Note: close() needs to be called on the ImageAnnotatorClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ImageAnnotatorSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ImageAnnotatorSettings imageAnnotatorSettings =
     ImageAnnotatorSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create(imageAnnotatorSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ImageAnnotatorSettings imageAnnotatorSettings =
     ImageAnnotatorSettings.newBuilder().setEndpoint(myEndpoint).build();
 ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create(imageAnnotatorSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ImageAnnotatorSettings imageAnnotatorSettings =
     ImageAnnotatorSettings.newHttpJsonBuilder().build();
 ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create(imageAnnotatorSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

ImageAnnotatorGrpc

Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

ImageAnnotatorGrpc.ImageAnnotatorBlockingStub

Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

ImageAnnotatorGrpc.ImageAnnotatorFutureStub

Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

ImageAnnotatorGrpc.ImageAnnotatorImplBase

Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

ImageAnnotatorGrpc.ImageAnnotatorStub

Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

ImageAnnotatorProto

ImageAnnotatorSettings

Settings class to configure an instance of ImageAnnotatorClient.

The default instance has everything set to sensible defaults:

  • The default service address (vision.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of batchAnnotateImages to 30 seconds:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ImageAnnotatorSettings.Builder imageAnnotatorSettingsBuilder =
     ImageAnnotatorSettings.newBuilder();
 imageAnnotatorSettingsBuilder
     .batchAnnotateImagesSettings()
     .setRetrySettings(
         imageAnnotatorSettingsBuilder
             .batchAnnotateImagesSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 ImageAnnotatorSettings imageAnnotatorSettings = imageAnnotatorSettingsBuilder.build();
 

ImageAnnotatorSettings.Builder

Builder for ImageAnnotatorSettings.

ImageContext

Image context and/or feature-specific parameters.

Protobuf type google.cloud.vision.v1p1beta1.ImageContext

ImageContext.Builder

Image context and/or feature-specific parameters.

Protobuf type google.cloud.vision.v1p1beta1.ImageContext

ImageProperties

Stores image properties, such as dominant colors.

Protobuf type google.cloud.vision.v1p1beta1.ImageProperties

ImageProperties.Builder

Stores image properties, such as dominant colors.

Protobuf type google.cloud.vision.v1p1beta1.ImageProperties

ImageSource

External image source (Google Cloud Storage image location).

Protobuf type google.cloud.vision.v1p1beta1.ImageSource

ImageSource.Builder

External image source (Google Cloud Storage image location).

Protobuf type google.cloud.vision.v1p1beta1.ImageSource

LatLongRect

Rectangle determined by min and max LatLng pairs.

Protobuf type google.cloud.vision.v1p1beta1.LatLongRect

LatLongRect.Builder

Rectangle determined by min and max LatLng pairs.

Protobuf type google.cloud.vision.v1p1beta1.LatLongRect

LocationInfo

Detected entity location information.

Protobuf type google.cloud.vision.v1p1beta1.LocationInfo

LocationInfo.Builder

Detected entity location information.

Protobuf type google.cloud.vision.v1p1beta1.LocationInfo

Page

Detected page from OCR.

Protobuf type google.cloud.vision.v1p1beta1.Page

Page.Builder

Detected page from OCR.

Protobuf type google.cloud.vision.v1p1beta1.Page

Paragraph

Structural unit of text representing a number of words in certain order.

Protobuf type google.cloud.vision.v1p1beta1.Paragraph

Paragraph.Builder

Structural unit of text representing a number of words in certain order.

Protobuf type google.cloud.vision.v1p1beta1.Paragraph

Position

A 3D position in the image, used primarily for Face detection landmarks. A valid Position must have both x and y coordinates. The position coordinates are in the same scale as the original image.

Protobuf type google.cloud.vision.v1p1beta1.Position

Position.Builder

A 3D position in the image, used primarily for Face detection landmarks. A valid Position must have both x and y coordinates. The position coordinates are in the same scale as the original image.

Protobuf type google.cloud.vision.v1p1beta1.Position

Property

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

Protobuf type google.cloud.vision.v1p1beta1.Property

Property.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.Property

SafeSearchAnnotation

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

Protobuf type google.cloud.vision.v1p1beta1.SafeSearchAnnotation

SafeSearchAnnotation.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.SafeSearchAnnotation

Symbol

A single symbol representation.

Protobuf type google.cloud.vision.v1p1beta1.Symbol

Symbol.Builder

A single symbol representation.

Protobuf type google.cloud.vision.v1p1beta1.Symbol

TextAnnotation

TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. Please refer to the TextAnnotation.TextProperty message definition below for more detail.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation

TextAnnotation.Builder

TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. Please refer to the TextAnnotation.TextProperty message definition below for more detail.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation

TextAnnotation.DetectedBreak

Detected start or end of a structural component.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak

TextAnnotation.DetectedBreak.Builder

Detected start or end of a structural component.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak

TextAnnotation.DetectedLanguage

Detected language for a structural component.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage

TextAnnotation.DetectedLanguage.Builder

Detected language for a structural component.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage

TextAnnotation.TextProperty

Additional information detected on the structural component.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty

TextAnnotation.TextProperty.Builder

Additional information detected on the structural component.

Protobuf type google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty

TextAnnotationProto

TextDetectionParams

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

Protobuf type google.cloud.vision.v1p1beta1.TextDetectionParams

TextDetectionParams.Builder

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

Protobuf type google.cloud.vision.v1p1beta1.TextDetectionParams

Vertex

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

Protobuf type google.cloud.vision.v1p1beta1.Vertex

Vertex.Builder

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

Protobuf type google.cloud.vision.v1p1beta1.Vertex

WebDetection

Relevant information for the image from the Internet.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection

WebDetection.Builder

Relevant information for the image from the Internet.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection

WebDetection.WebEntity

Entity deduced from similar images on the Internet.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebEntity

WebDetection.WebEntity.Builder

Entity deduced from similar images on the Internet.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebEntity

WebDetection.WebImage

Metadata for online images.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebImage

WebDetection.WebImage.Builder

Metadata for online images.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebImage

WebDetection.WebLabel

Label to provide extra metadata for the web detection.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebLabel

WebDetection.WebLabel.Builder

Label to provide extra metadata for the web detection.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebLabel

WebDetection.WebPage

Metadata for web pages.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebPage

WebDetection.WebPage.Builder

Metadata for web pages.

Protobuf type google.cloud.vision.v1p1beta1.WebDetection.WebPage

WebDetectionParams

Parameters for web detection request.

Protobuf type google.cloud.vision.v1p1beta1.WebDetectionParams

WebDetectionParams.Builder

Parameters for web detection request.

Protobuf type google.cloud.vision.v1p1beta1.WebDetectionParams

WebDetectionProto

Word

A word representation.

Protobuf type google.cloud.vision.v1p1beta1.Word

Word.Builder

A word representation.

Protobuf type google.cloud.vision.v1p1beta1.Word

Interfaces

AnnotateImageRequestOrBuilder

AnnotateImageResponseOrBuilder

BatchAnnotateImagesRequestOrBuilder

BatchAnnotateImagesResponseOrBuilder

BlockOrBuilder

BoundingPolyOrBuilder

ColorInfoOrBuilder

CropHintOrBuilder

CropHintsAnnotationOrBuilder

CropHintsParamsOrBuilder

DominantColorsAnnotationOrBuilder

EntityAnnotationOrBuilder

FaceAnnotation.LandmarkOrBuilder

FaceAnnotationOrBuilder

FeatureOrBuilder

ImageContextOrBuilder

ImageOrBuilder

ImagePropertiesOrBuilder

ImageSourceOrBuilder

LatLongRectOrBuilder

LocationInfoOrBuilder

PageOrBuilder

ParagraphOrBuilder

PositionOrBuilder

PropertyOrBuilder

SafeSearchAnnotationOrBuilder

SymbolOrBuilder

TextAnnotation.DetectedBreakOrBuilder

TextAnnotation.DetectedLanguageOrBuilder

TextAnnotation.TextPropertyOrBuilder

TextAnnotationOrBuilder

TextDetectionParamsOrBuilder

VertexOrBuilder

WebDetection.WebEntityOrBuilder

WebDetection.WebImageOrBuilder

WebDetection.WebLabelOrBuilder

WebDetection.WebPageOrBuilder

WebDetectionOrBuilder

WebDetectionParamsOrBuilder

WordOrBuilder

Enums

Block.BlockType

Type of a block (text, image etc) as identified by OCR.

Protobuf enum google.cloud.vision.v1p1beta1.Block.BlockType

FaceAnnotation.Landmark.Type

Face landmark (feature) type. Left and right are defined from the vantage of the viewer of the image without considering mirror projections typical of photos. So, LEFT_EYE, typically, is the person's right eye.

Protobuf enum google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type

Feature.Type

Type of image feature.

Protobuf enum google.cloud.vision.v1p1beta1.Feature.Type

Likelihood

A bucketized representation of likelihood, which is intended to give clients highly stable results across model upgrades.

Protobuf enum google.cloud.vision.v1p1beta1.Likelihood

TextAnnotation.DetectedBreak.BreakType

Enum to denote the type of break found. New line, space etc.

Protobuf enum google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType