Method: files.annotate

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.

HTTP request

POST https://vision.googleapis.com/v1/files:annotate

The URL uses gRPC Transcoding syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "requests": [
    {
      object (AnnotateFileRequest)
    }
  ]
}
Fields
requests[]

object (AnnotateFileRequest)

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

Response body

If successful, the response body contains data with the following structure:

A list of file annotation responses.

JSON representation
{
  "responses": [
    {
      object (AnnotateFileResponse)
    }
  ]
}
Fields
responses[]

object (AnnotateFileResponse)

The list of file annotation responses, each response corresponding to each AnnotateFileRequest in BatchAnnotateFilesRequest.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

AnnotateFileRequest

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

JSON representation
{
  "inputConfig": {
    object (InputConfig)
  },
  "features": [
    {
      object (Feature)
    }
  ],
  "imageContext": {
    object (ImageContext)
  },
  "pages": [
    number
  ]
}
Fields
inputConfig

object (InputConfig)

Required. Information about the input file.

features[]

object (Feature)

Required. Requested features.

imageContext

object (ImageContext)

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

pages[]

number

Pages of the file to perform image annotation.

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

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

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

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

AnnotateFileResponse

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

JSON representation
{
  "inputConfig": {
    object (InputConfig)
  },
  "responses": [
    {
      object (AnnotateImageResponse)
    }
  ],
  "totalPages": number
}
Fields
inputConfig

object (InputConfig)

Information about the file for which this response is generated.

responses[]

object (AnnotateImageResponse)

Individual responses to images found within the file.

totalPages

number

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

Segítségére volt ez az oldal? Tudassa velünk a véleményét:

Visszajelzés küldése a következővel kapcsolatban:

Cloud Vision API Product Search
Segítségre van szüksége? Keresse fel súgóoldalunkat.