Google Cloud Vision v1 API - Class ImageAnnotatorClient (3.6.0)

public abstract class ImageAnnotatorClient

Reference documentation and code samples for the Google Cloud Vision v1 API class ImageAnnotatorClient.

ImageAnnotator client wrapper, for convenient use.

Inheritance

object > ImageAnnotatorClient

Derived Types

Namespace

Google.Cloud.Vision.V1

Assembly

Google.Cloud.Vision.V1.dll

Remarks

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.

Properties

AsyncBatchAnnotateFilesOperationsClient

public virtual OperationsClient AsyncBatchAnnotateFilesOperationsClient { get; }

The long-running operations client for AsyncBatchAnnotateFiles.

Property Value
TypeDescription
OperationsClient

AsyncBatchAnnotateImagesOperationsClient

public virtual OperationsClient AsyncBatchAnnotateImagesOperationsClient { get; }

The long-running operations client for AsyncBatchAnnotateImages.

Property Value
TypeDescription
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the ImageAnnotator service, which is a host of "vision.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ImageAnnotator scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

GrpcClient

public virtual ImageAnnotator.ImageAnnotatorClient GrpcClient { get; }

The underlying gRPC ImageAnnotator client

Property Value
TypeDescription
ImageAnnotatorImageAnnotatorClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Annotate(AnnotateImageRequest, CallSettings)

public virtual AnnotateImageResponse Annotate(AnnotateImageRequest request, CallSettings settings = null)

Annotates a single image.

Parameters
NameDescription
requestAnnotateImageRequest

The annotation request to process. Must not be null.

settingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
AnnotateImageResponse

The annotation response.

Remarks

This simply delegates to BatchAnnotateImages(IEnumerable<AnnotateImageRequest>, CallSettings) by creating a batch with a single request, and returns the single response.

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
AnnotateImageRequest request = new AnnotateImageRequest
{
    Image = image,
    Features =
    {
        new Feature { Type = Feature.Types.Type.FaceDetection },
        // By default, no limits are put on the number of results per annotation.
        // Use the MaxResults property to specify a limit.
        new Feature { Type = Feature.Types.Type.LandmarkDetection, MaxResults = 5 },
    }
};
AnnotateImageResponse response = client.Annotate(request);
Console.WriteLine("Faces:");
foreach (FaceAnnotation face in response.FaceAnnotations)
{
    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"  Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
}
Console.WriteLine("Landmarks:");
foreach (EntityAnnotation landmark in response.LandmarkAnnotations)
{
    Console.WriteLine($"Score: {(int)(landmark.Score * 100)}%; Description: {landmark.Description}");
}
if (response.Error != null)
{
    Console.WriteLine($"Error detected: {response.Error}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

AnnotateAsync(AnnotateImageRequest, CallSettings)

public virtual Task<AnnotateImageResponse> AnnotateAsync(AnnotateImageRequest request, CallSettings settings = null)

Annotates a single image asynchronously.

Parameters
NameDescription
requestAnnotateImageRequest

The annotation request to process. Must not be null.

settingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskAnnotateImageResponse

A task representing the asynchronous operation. The task result will be the annotation response.

Remarks

This simply delegates to BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CallSettings) by creating a batch with a single request, and returns the single response.

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See Annotate for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

AnnotateAsync(AnnotateImageRequest, CancellationToken)

public virtual Task<AnnotateImageResponse> AnnotateAsync(AnnotateImageRequest request, CancellationToken cancellationToken)

Annotates a single image asynchronously.

Parameters
NameDescription
requestAnnotateImageRequest

The annotation request to process. Must not be null.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAnnotateImageResponse

A task representing the asynchronous operation. The task result will be the annotation response.

Remarks

This simply delegates to BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CallSettings) by creating a batch with a single request, and returns the single response.

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See Annotate for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest, CallSettings)

public virtual Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestAsyncBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationAsyncBatchAnnotateFilesResponseOperationMetadata

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest
{
    Requests =
    {
        new AsyncAnnotateFileRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateFiles(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateFiles(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFiles(IEnumerable<AsyncAnnotateFileRequest>, CallSettings)

public virtual Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> AsyncBatchAnnotateFiles(IEnumerable<AsyncAnnotateFileRequest> requests, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestsIEnumerableAsyncAnnotateFileRequest

Required. Individual async file annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationAsyncBatchAnnotateFilesResponseOperationMetadata

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
IEnumerable<AsyncAnnotateFileRequest> requests = new AsyncAnnotateFileRequest[]
{
    new AsyncAnnotateFileRequest(),
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateFiles(requests);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateFiles(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestAsyncBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateFilesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest
{
    Requests =
    {
        new AsyncAnnotateFileRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest request, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestAsyncBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateFilesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest
{
    Requests =
    {
        new AsyncAnnotateFileRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest>, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest> requests, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestsIEnumerableAsyncAnnotateFileRequest

Required. Individual async file annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateFilesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AsyncAnnotateFileRequest> requests = new AsyncAnnotateFileRequest[]
{
    new AsyncAnnotateFileRequest(),
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(requests);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest>, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest> requests, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestsIEnumerableAsyncAnnotateFileRequest

Required. Individual async file annotation requests for this batch.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateFilesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AsyncAnnotateFileRequest> requests = new AsyncAnnotateFileRequest[]
{
    new AsyncAnnotateFileRequest(),
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(requests);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest, CallSettings)

public virtual Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestAsyncBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationAsyncBatchAnnotateImagesResponseOperationMetadata

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
AsyncBatchAnnotateImagesRequest request = new AsyncBatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    OutputConfig = new OutputConfig(),
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateImages(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateImages(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImages(IEnumerable<AnnotateImageRequest>, OutputConfig, CallSettings)

public virtual Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> AsyncBatchAnnotateImages(IEnumerable<AnnotateImageRequest> requests, OutputConfig outputConfig, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestsIEnumerableAnnotateImageRequest

Required. Individual image annotation requests for this batch.

outputConfigOutputConfig

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationAsyncBatchAnnotateImagesResponseOperationMetadata

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
OutputConfig outputConfig = new OutputConfig();
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateImages(requests, outputConfig);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateImages(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestAsyncBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateImagesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateImagesRequest request = new AsyncBatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    OutputConfig = new OutputConfig(),
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest request, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestAsyncBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateImagesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateImagesRequest request = new AsyncBatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    OutputConfig = new OutputConfig(),
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, OutputConfig, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, OutputConfig outputConfig, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestsIEnumerableAnnotateImageRequest

Required. Individual image annotation requests for this batch.

outputConfigOutputConfig

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateImagesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
OutputConfig outputConfig = new OutputConfig();
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(requests, outputConfig);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, OutputConfig, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, OutputConfig outputConfig, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestsIEnumerableAnnotateImageRequest

Required. Individual image annotation requests for this batch.

outputConfigOutputConfig

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateImagesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
OutputConfig outputConfig = new OutputConfig();
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(requests, outputConfig);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

BatchAnnotateFiles(BatchAnnotateFilesRequest, CallSettings)

public virtual BatchAnnotateFilesResponse BatchAnnotateFiles(BatchAnnotateFilesRequest request, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateFilesResponse

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
BatchAnnotateFilesRequest request = new BatchAnnotateFilesRequest
{
    Requests =
    {
        new AnnotateFileRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
BatchAnnotateFilesResponse response = imageAnnotatorClient.BatchAnnotateFiles(request);

BatchAnnotateFiles(IEnumerable<AnnotateFileRequest>, CallSettings)

public virtual BatchAnnotateFilesResponse BatchAnnotateFiles(IEnumerable<AnnotateFileRequest> requests, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestsIEnumerableAnnotateFileRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateFilesResponse

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
IEnumerable<AnnotateFileRequest> requests = new AnnotateFileRequest[]
{
    new AnnotateFileRequest(),
};
// Make the request
BatchAnnotateFilesResponse response = imageAnnotatorClient.BatchAnnotateFiles(requests);

BatchAnnotateFilesAsync(BatchAnnotateFilesRequest, CallSettings)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(BatchAnnotateFilesRequest request, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBatchAnnotateFilesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateFilesRequest request = new BatchAnnotateFilesRequest
{
    Requests =
    {
        new AnnotateFileRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(request);

BatchAnnotateFilesAsync(BatchAnnotateFilesRequest, CancellationToken)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(BatchAnnotateFilesRequest request, CancellationToken cancellationToken)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskBatchAnnotateFilesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateFilesRequest request = new BatchAnnotateFilesRequest
{
    Requests =
    {
        new AnnotateFileRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(request);

BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest>, CallSettings)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest> requests, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestsIEnumerableAnnotateFileRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBatchAnnotateFilesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateFileRequest> requests = new AnnotateFileRequest[]
{
    new AnnotateFileRequest(),
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(requests);

BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest>, CancellationToken)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest> requests, CancellationToken cancellationToken)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestsIEnumerableAnnotateFileRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskBatchAnnotateFilesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateFileRequest> requests = new AnnotateFileRequest[]
{
    new AnnotateFileRequest(),
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(requests);

BatchAnnotateImages(BatchAnnotateImagesRequest, CallSettings)

public virtual BatchAnnotateImagesResponse BatchAnnotateImages(BatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateImagesResponse

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
BatchAnnotateImagesRequest request = new BatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
BatchAnnotateImagesResponse response = imageAnnotatorClient.BatchAnnotateImages(request);

BatchAnnotateImages(IEnumerable<AnnotateImageRequest>, CallSettings)

public virtual BatchAnnotateImagesResponse BatchAnnotateImages(IEnumerable<AnnotateImageRequest> requests, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestsIEnumerableAnnotateImageRequest

Required. Individual image annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateImagesResponse

The RPC response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
// Perform face recognition on one image, and logo recognition on another.
AnnotateImageRequest request1 = new AnnotateImageRequest
{
    Image = image1,
    Features = { new Feature { Type = Feature.Types.Type.FaceDetection } }
};
AnnotateImageRequest request2 = new AnnotateImageRequest
{
    Image = image2,
    Features = { new Feature { Type = Feature.Types.Type.LogoDetection } }
};

BatchAnnotateImagesResponse response = client.BatchAnnotateImages(new[] { request1, request2 });
Console.WriteLine("Faces in image 1:");
foreach (FaceAnnotation face in response.Responses[0].FaceAnnotations)
{
    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"  Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
}
Console.WriteLine("Logos in image 2:");
foreach (EntityAnnotation logo in response.Responses[1].LogoAnnotations)
{
    Console.WriteLine($"Description: {logo.Description}");
}
foreach (Status error in response.Responses.Select(r => r.Error))
{
    Console.WriteLine($"Error detected: error");
}

BatchAnnotateImagesAsync(BatchAnnotateImagesRequest, CallSettings)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(BatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBatchAnnotateImagesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateImagesRequest request = new BatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(request);

BatchAnnotateImagesAsync(BatchAnnotateImagesRequest, CancellationToken)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(BatchAnnotateImagesRequest request, CancellationToken cancellationToken)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskBatchAnnotateImagesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateImagesRequest request = new BatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    Parent = "",
    Labels = { { "", "" }, },
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(request);

BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CallSettings)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestsIEnumerableAnnotateImageRequest

Required. Individual image annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBatchAnnotateImagesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(requests);

BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CancellationToken)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, CancellationToken cancellationToken)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestsIEnumerableAnnotateImageRequest

Required. Individual image annotation requests for this batch.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskBatchAnnotateImagesResponse

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(requests);

Create()

public static ImageAnnotatorClient Create()

Synchronously creates a ImageAnnotatorClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ImageAnnotatorClientBuilder.

Returns
TypeDescription
ImageAnnotatorClient

The created ImageAnnotatorClient.

CreateAsync(CancellationToken)

public static Task<ImageAnnotatorClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a ImageAnnotatorClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ImageAnnotatorClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskImageAnnotatorClient

The task representing the created ImageAnnotatorClient.

DetectCropHints(Image, ImageContext, CallSettings)

public virtual CropHintsAnnotation DetectCropHints(Image image, ImageContext context = null, CallSettings callSettings = null)

Suggests crop hints for a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
CropHintsAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
CropHintsAnnotation cropHints = client.DetectCropHints(image);
foreach (CropHint hint in cropHints.CropHints)
{
    Console.WriteLine("Crop hint:");
    string poly = string.Join(" - ", hint.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"  Poly: {poly}");
    Console.WriteLine($"  Confidence: {hint.Confidence}");
    Console.WriteLine($"  Importance fraction: {hint.ImportanceFraction}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectCropHintsAsync(Image, ImageContext, CallSettings)

public virtual Task<CropHintsAnnotation> DetectCropHintsAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Suggests crop hints for a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskCropHintsAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectCropHints for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectDocumentText(Image, ImageContext, CallSettings)

public virtual TextAnnotation DetectDocumentText(Image image, ImageContext context = null, CallSettings callSettings = null)

Detects document text in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TextAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
TextAnnotation text = client.DetectDocumentText(image);
Console.WriteLine($"Text: {text.Text}");
foreach (var page in text.Pages)
{
    foreach (var block in page.Blocks)
    {
        string box = string.Join(" - ", block.BoundingBox.Vertices.Select(v => $"({v.X}, {v.Y})"));
        Console.WriteLine($"Block {block.BlockType} at {box}");
        foreach (var paragraph in block.Paragraphs)
        {
            box = string.Join(" - ", paragraph.BoundingBox.Vertices.Select(v => $"({v.X}, {v.Y})"));
            Console.WriteLine($"  Paragraph at {box}");
            foreach (var word in paragraph.Words)
            {
                Console.WriteLine($"    Word: {string.Join("", word.Symbols.Select(s => s.Text))}");
            }
        }
    }
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectDocumentTextAsync(Image, ImageContext, CallSettings)

public virtual Task<TextAnnotation> DetectDocumentTextAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Detects document text in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskTextAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectDocumentText for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectFaces(Image, ImageContext, int, CallSettings)

public virtual IReadOnlyList<FaceAnnotation> DetectFaces(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects the faces in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyListFaceAnnotation

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<FaceAnnotation> result = client.DetectFaces(image);
foreach (FaceAnnotation face in result)
{
    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectFacesAsync(Image, ImageContext, int, CallSettings)

public virtual Task<IReadOnlyList<FaceAnnotation>> DetectFacesAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects the faces in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskIReadOnlyListFaceAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectFaces for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectImageProperties(Image, ImageContext, CallSettings)

public virtual ImageProperties DetectImageProperties(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs image property processing on a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
ImageProperties

The detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
ImageProperties properties = client.DetectImageProperties(image);
ColorInfo dominantColor = properties.DominantColors.Colors.OrderByDescending(c => c.PixelFraction).First();
Console.WriteLine($"Dominant color in image: {dominantColor}");
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectImagePropertiesAsync(Image, ImageContext, CallSettings)

public virtual Task<ImageProperties> DetectImagePropertiesAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs image property processing on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskImageProperties

A task representing the asynchronous operation. The task result will be the detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectImageProperties for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLabels(Image, ImageContext, int, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectLabels(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects labels for a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyListEntityAnnotation

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> labels = client.DetectLabels(image);
foreach (EntityAnnotation label in labels)
{
    Console.WriteLine($"Score: {(int)(label.Score * 100)}%; Description: {label.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLabelsAsync(Image, ImageContext, int, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectLabelsAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects labels for a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskIReadOnlyListEntityAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLabels for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLandmarks(Image, ImageContext, int, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectLandmarks(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects landmarks in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyListEntityAnnotation

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> result = client.DetectLandmarks(image);
foreach (EntityAnnotation landmark in result)
{
    Console.WriteLine($"Score: {(int)(landmark.Score * 100)}%; Description: {landmark.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLandmarksAsync(Image, ImageContext, int, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectLandmarksAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects the landmarks in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskIReadOnlyListEntityAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLandmarks for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLocalizedObjects(Image, ImageContext, int, CallSettings)

public virtual IReadOnlyList<LocalizedObjectAnnotation> DetectLocalizedObjects(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects localized objects in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyListLocalizedObjectAnnotation

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<LocalizedObjectAnnotation> annotations = client.DetectLocalizedObjects(image);
foreach (LocalizedObjectAnnotation annotation in annotations)
{
    string poly = string.Join(" - ", annotation.BoundingPoly.NormalizedVertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine(
        $"Name: {annotation.Name}; ID: {annotation.Mid}; Score: {annotation.Score}; Bounding poly: {poly}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLocalizedObjectsAsync(Image, ImageContext, int, CallSettings)

public virtual Task<IReadOnlyList<LocalizedObjectAnnotation>> DetectLocalizedObjectsAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects localized objects in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskIReadOnlyListLocalizedObjectAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLocalizedObjects for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLogos(Image, ImageContext, int, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectLogos(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects logos in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyListEntityAnnotation

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> logos = client.DetectLogos(image);
foreach (EntityAnnotation logo in logos)
{
    Console.WriteLine($"Description: {logo.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLogosAsync(Image, ImageContext, int, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectLogosAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects logos in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskIReadOnlyListEntityAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLogos for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSafeSearch(Image, ImageContext, CallSettings)

public virtual SafeSearchAnnotation DetectSafeSearch(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs "safe search" processing on a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
SafeSearchAnnotation

The safe search categorization for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
SafeSearchAnnotation annotation = client.DetectSafeSearch(image);
// Each category is classified as Very Unlikely, Unlikely, Possible, Likely or Very Likely.
Console.WriteLine($"Adult? {annotation.Adult}");
Console.WriteLine($"Spoof? {annotation.Spoof}");
Console.WriteLine($"Violence? {annotation.Violence}");
Console.WriteLine($"Medical? {annotation.Medical}");
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSafeSearchAsync(Image, ImageContext, CallSettings)

public virtual Task<SafeSearchAnnotation> DetectSafeSearchAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs "safe search" processing on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskSafeSearchAnnotation

A task representing the asynchronous operation. The task result will be the safe search categorization for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectSafeSearch for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSimilarProducts(Image, ProductSearchParams, CallSettings)

public virtual ProductSearchResults DetectSimilarProducts(Image image, ProductSearchParams productSearchParams, CallSettings callSettings = null)

Performs product detection on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

productSearchParamsProductSearchParams

Product search parameters. Must not be null.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
ProductSearchResults

The detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ProductSetName productSetName = new ProductSetName(projectId, locationId, productSetId);
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
ProductSearchParams searchParams = new ProductSearchParams
{
    ProductCategories = { "apparel" },
    ProductSetAsProductSetName = productSetName,
};
ProductSearchResults results = client.DetectSimilarProducts(image, searchParams);
foreach (var result in results.Results)
{
    Console.WriteLine($"{result.Product.DisplayName}: {result.Score}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSimilarProductsAsync(Image, ProductSearchParams, CallSettings)

public virtual Task<ProductSearchResults> DetectSimilarProductsAsync(Image image, ProductSearchParams productSearchParams, CallSettings callSettings = null)

Performs product detection on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

productSearchParamsProductSearchParams

Product search parameters. Must not be null.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskProductSearchResults

A task representing the asynchronous operation. The task result will be the detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectSimilarProducts for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectText(Image, ImageContext, int, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectText(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects text in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyListEntityAnnotation

A set of annotations.

Remarks

This method is suitable for an image with individual words; for more structured text, use DetectDocumentText(Image, ImageContext, CallSettings).

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> textAnnotations = client.DetectText(image);
foreach (EntityAnnotation text in textAnnotations)
{
    Console.WriteLine($"Description: {text.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectTextAsync(Image, ImageContext, int, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectTextAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects text in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsint

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskIReadOnlyListEntityAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

This method is suitable for an image with individual words; for more structured text, use DetectDocumentTextAsync(Image, ImageContext, CallSettings).

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectText for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectWebInformation(Image, ImageContext, CallSettings)

public virtual WebDetection DetectWebInformation(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs web detection for a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
WebDetection

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
WebDetection webDetection = client.DetectWebInformation(image);
foreach (WebDetection.Types.WebImage webImage in webDetection.FullMatchingImages)
{
    Console.WriteLine($"Full image: {webImage.Url} ({webImage.Score})");
}
foreach (WebDetection.Types.WebImage webImage in webDetection.PartialMatchingImages)
{
    Console.WriteLine($"Partial image: {webImage.Url} ({webImage.Score})");
}
foreach (WebDetection.Types.WebPage webPage in webDetection.PagesWithMatchingImages)
{
    Console.WriteLine($"Page with matching image: {webPage.Url} ({webPage.Score})");
}
foreach (WebDetection.Types.WebEntity entity in webDetection.WebEntities)
{
    Console.WriteLine($"Web entity: {entity.EntityId} / {entity.Description} ({entity.Score})");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectWebInformationAsync(Image, ImageContext, CallSettings)

public virtual Task<WebDetection> DetectWebInformationAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs web detection for a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TaskWebDetection

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectWebInformation for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

PollOnceAsyncBatchAnnotateFiles(string, CallSettings)

public virtual Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> PollOnceAsyncBatchAnnotateFiles(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateFiles.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationAsyncBatchAnnotateFilesResponseOperationMetadata

The result of polling the operation.

PollOnceAsyncBatchAnnotateFilesAsync(string, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> PollOnceAsyncBatchAnnotateFilesAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateFiles.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateFilesResponseOperationMetadata

A task representing the result of polling the operation.

PollOnceAsyncBatchAnnotateImages(string, CallSettings)

public virtual Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> PollOnceAsyncBatchAnnotateImages(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateImages.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationAsyncBatchAnnotateImagesResponseOperationMetadata

The result of polling the operation.

PollOnceAsyncBatchAnnotateImagesAsync(string, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> PollOnceAsyncBatchAnnotateImagesAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateImages.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationAsyncBatchAnnotateImagesResponseOperationMetadata

A task representing the result of polling the operation.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.