As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Vision v1p2beta1 API

class google.cloud.vision_v1p2beta1.types.AnnotateFileResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

input_config

Information about the file for which this response is generated.

Type

google.cloud.vision_v1p2beta1.types.InputConfig

responses

Individual responses to images found within the file.

Type

Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]

class google.cloud.vision_v1p2beta1.types.AnnotateImageRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

image

The image to be processed.

Type

google.cloud.vision_v1p2beta1.types.Image

features

Requested features.

Type

Sequence[google.cloud.vision_v1p2beta1.types.Feature]

image_context

Additional context that may accompany the image.

Type

google.cloud.vision_v1p2beta1.types.ImageContext

class google.cloud.vision_v1p2beta1.types.AnnotateImageResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to an image annotation request.

face_annotations

If present, face detection has completed successfully.

Type

Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation]

landmark_annotations

If present, landmark detection has completed successfully.

Type

Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]

logo_annotations

If present, logo detection has completed successfully.

Type

Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]

label_annotations

If present, label detection has completed successfully.

Type

Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]

text_annotations

If present, text (OCR) detection has completed successfully.

Type

Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]

full_text_annotation

If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation

safe_search_annotation

If present, safe-search annotation has completed successfully.

Type

google.cloud.vision_v1p2beta1.types.SafeSearchAnnotation

image_properties_annotation

If present, image properties were extracted successfully.

Type

google.cloud.vision_v1p2beta1.types.ImageProperties

crop_hints_annotation

If present, crop hints have completed successfully.

Type

google.cloud.vision_v1p2beta1.types.CropHintsAnnotation

web_detection

If present, web detection has completed successfully.

Type

google.cloud.vision_v1p2beta1.types.WebDetection

error

If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when error is set.

Type

google.rpc.status_pb2.Status

context

If present, contextual information is needed to understand where this image comes from.

Type

google.cloud.vision_v1p2beta1.types.ImageAnnotationContext

class google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

An offline file annotation request.

input_config

Required. Information about the input file.

Type

google.cloud.vision_v1p2beta1.types.InputConfig

features

Required. Requested features.

Type

Sequence[google.cloud.vision_v1p2beta1.types.Feature]

image_context

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

Type

google.cloud.vision_v1p2beta1.types.ImageContext

output_config

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

Type

google.cloud.vision_v1p2beta1.types.OutputConfig

class google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response for a single offline file annotation request.

output_config

The output location and metadata from AsyncAnnotateFileRequest.

Type

google.cloud.vision_v1p2beta1.types.OutputConfig

class google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

requests

Required. Individual async file annotation requests for this batch.

Type

Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]

class google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to an async batch file annotation request.

responses

The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest.

Type

Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileResponse]

class google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

requests

Required. Individual image annotation requests for this batch.

Type

Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]

class google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to a batch image annotation request.

responses

Individual responses to image annotation requests within the batch.

Type

Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]

class google.cloud.vision_v1p2beta1.types.Block(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Logical element on the page.

property

Additional information detected for the block.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty

bounding_box

The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the ‘natural’ orientation. For example:

  • when the text is horizontal it might look like:

    0----1
    |    |
    3----2
    
  • when it’s rotated 180 degrees around the top-left corner it becomes:

    2----3
    |    |
    1----0
    

    and the vertice order will still be (0, 1, 2, 3).

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

paragraphs

List of paragraphs in this block (if this blocks is of type text).

Type

Sequence[google.cloud.vision_v1p2beta1.types.Paragraph]

block_type

Detected block type (text, image etc) for this block.

Type

google.cloud.vision_v1p2beta1.types.Block.BlockType

confidence

Confidence of the OCR results on the block. Range [0, 1].

Type

float

class BlockType(value)[source]

Bases: proto.enums.Enum

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

BARCODE = 5
PICTURE = 3
RULER = 4
TABLE = 2
TEXT = 1
UNKNOWN = 0
class google.cloud.vision_v1p2beta1.types.BoundingPoly(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A bounding polygon for the detected image annotation.

vertices

The bounding polygon vertices.

Type

Sequence[google.cloud.vision_v1p2beta1.types.Vertex]

normalized_vertices

The bounding polygon normalized vertices.

Type

Sequence[google.cloud.vision_v1p2beta1.types.NormalizedVertex]

class google.cloud.vision_v1p2beta1.types.ColorInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

color

RGB components of the color.

Type

google.type.color_pb2.Color

score

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

Type

float

pixel_fraction

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

Type

float

class google.cloud.vision_v1p2beta1.types.CropHint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

bounding_poly

The bounding polygon for the crop region. The coordinates of the bounding box are in the original image’s scale, as returned in ImageParams.

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

confidence

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

Type

float

importance_fraction

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

Type

float

class google.cloud.vision_v1p2beta1.types.CropHintsAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

crop_hints

Crop hint results.

Type

Sequence[google.cloud.vision_v1p2beta1.types.CropHint]

class google.cloud.vision_v1p2beta1.types.CropHintsParams(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Parameters for crop hints annotation request.

aspect_ratios

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

Type

Sequence[float]

class google.cloud.vision_v1p2beta1.types.DominantColorsAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Set of dominant colors and their corresponding scores.

colors

RGB color values with their score and pixel fraction.

Type

Sequence[google.cloud.vision_v1p2beta1.types.ColorInfo]

class google.cloud.vision_v1p2beta1.types.EntityAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Set of detected entity features.

mid

Opaque entity ID. Some IDs may be available in Google Knowledge Graph Search API.

Type

str

locale

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

Type

str

description

Entity textual description, expressed in its locale language.

Type

str

score

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

Type

float

confidence

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

Type

float

topicality

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

Type

float

bounding_poly

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

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

locations

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

Type

Sequence[google.cloud.vision_v1p2beta1.types.LocationInfo]

properties

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

Type

Sequence[google.cloud.vision_v1p2beta1.types.Property]

class google.cloud.vision_v1p2beta1.types.FaceAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A face annotation object contains the results of face detection.

bounding_poly

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

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

fd_bounding_poly

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

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

landmarks

Detected face landmarks.

Type

Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark]

roll_angle

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

Type

float

pan_angle

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

Type

float

tilt_angle

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

Type

float

detection_confidence

Detection confidence. Range [0, 1].

Type

float

landmarking_confidence

Face landmarking confidence. Range [0, 1].

Type

float

joy_likelihood

Joy likelihood.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

sorrow_likelihood

Sorrow likelihood.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

anger_likelihood

Anger likelihood.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

surprise_likelihood

Surprise likelihood.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

under_exposed_likelihood

Under-exposed likelihood.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

blurred_likelihood

Blurred likelihood.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

headwear_likelihood

Headwear likelihood.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

class Landmark(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

type_

Face landmark type.

Type

google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark.Type

position

Face landmark position.

Type

google.cloud.vision_v1p2beta1.types.Position

class Type(value)[source]

Bases: proto.enums.Enum

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.

CHIN_GNATHION = 32
CHIN_LEFT_GONION = 33
CHIN_RIGHT_GONION = 34
FOREHEAD_GLABELLA = 31
LEFT_EAR_TRAGION = 27
LEFT_EYE = 1
LEFT_EYEBROW_UPPER_MIDPOINT = 25
LEFT_EYE_BOTTOM_BOUNDARY = 19
LEFT_EYE_LEFT_CORNER = 20
LEFT_EYE_PUPIL = 29
LEFT_EYE_RIGHT_CORNER = 18
LEFT_EYE_TOP_BOUNDARY = 17
LEFT_OF_LEFT_EYEBROW = 3
LEFT_OF_RIGHT_EYEBROW = 5
LOWER_LIP = 10
MIDPOINT_BETWEEN_EYES = 7
MOUTH_CENTER = 13
MOUTH_LEFT = 11
MOUTH_RIGHT = 12
NOSE_BOTTOM_CENTER = 16
NOSE_BOTTOM_LEFT = 15
NOSE_BOTTOM_RIGHT = 14
NOSE_TIP = 8
RIGHT_EAR_TRAGION = 28
RIGHT_EYE = 2
RIGHT_EYEBROW_UPPER_MIDPOINT = 26
RIGHT_EYE_BOTTOM_BOUNDARY = 23
RIGHT_EYE_LEFT_CORNER = 24
RIGHT_EYE_PUPIL = 30
RIGHT_EYE_RIGHT_CORNER = 22
RIGHT_EYE_TOP_BOUNDARY = 21
RIGHT_OF_LEFT_EYEBROW = 4
RIGHT_OF_RIGHT_EYEBROW = 6
UNKNOWN_LANDMARK = 0
UPPER_LIP = 9
class google.cloud.vision_v1p2beta1.types.Feature(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

type_

The feature type.

Type

google.cloud.vision_v1p2beta1.types.Feature.Type

max_results

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

Type

int

model

Model to use for the feature. Supported values: “builtin/stable” (the default if unset) and “builtin/latest”.

Type

str

class Type(value)[source]

Bases: proto.enums.Enum

Type of Google Cloud Vision API feature to be extracted.

CROP_HINTS = 9
DOCUMENT_TEXT_DETECTION = 11
FACE_DETECTION = 1
IMAGE_PROPERTIES = 7
LABEL_DETECTION = 4
LANDMARK_DETECTION = 2
LOGO_DETECTION = 3
SAFE_SEARCH_DETECTION = 6
TEXT_DETECTION = 5
TYPE_UNSPECIFIED = 0
WEB_DETECTION = 10
class google.cloud.vision_v1p2beta1.types.GcsDestination(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

uri

Google Cloud Storage URI where the results will be stored. Results will be in JSON format and preceded by its corresponding input URI. This field can either represent a single file, or a prefix for multiple outputs. Prefixes must end in a /.

Examples:

  • File: gs://bucket-name/filename.json

  • Prefix: gs://bucket-name/prefix/here/

  • File: gs://bucket-name/prefix/here

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

Type

str

class google.cloud.vision_v1p2beta1.types.GcsSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

uri

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

Type

str

class google.cloud.vision_v1p2beta1.types.Image(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Client image to perform Google Cloud Vision API tasks over.

content

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

Type

bytes

source

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

Type

google.cloud.vision_v1p2beta1.types.ImageSource

class google.cloud.vision_v1p2beta1.types.ImageAnnotationContext(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

uri

The URI of the file used to produce the image.

Type

str

page_number

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

Type

int

class google.cloud.vision_v1p2beta1.types.ImageContext(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Image context and/or feature-specific parameters.

lat_long_rect

Not used.

Type

google.cloud.vision_v1p2beta1.types.LatLongRect

language_hints

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

Type

Sequence[str]

crop_hints_params

Parameters for crop hints annotation request.

Type

google.cloud.vision_v1p2beta1.types.CropHintsParams

web_detection_params

Parameters for web detection.

Type

google.cloud.vision_v1p2beta1.types.WebDetectionParams

text_detection_params

Parameters for text detection and document text detection.

Type

google.cloud.vision_v1p2beta1.types.TextDetectionParams

class google.cloud.vision_v1p2beta1.types.ImageProperties(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Stores image properties, such as dominant colors.

dominant_colors

If present, dominant colors completed successfully.

Type

google.cloud.vision_v1p2beta1.types.DominantColorsAnnotation

class google.cloud.vision_v1p2beta1.types.ImageSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

gcs_image_uri

Use ``image_uri`` instead.

The Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported. See Google Cloud Storage Request URIs for more info.

Type

str

image_uri

The URI of the source image. Can be either:

  1. A Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported. See Google Cloud Storage Request URIs for more info.

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

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

Type

str

class google.cloud.vision_v1p2beta1.types.InputConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The desired input location and metadata.

gcs_source

The Google Cloud Storage location to read the input from.

Type

google.cloud.vision_v1p2beta1.types.GcsSource

mime_type

The type of the file. Currently only “application/pdf” and “image/tiff” are supported. Wildcards are not supported.

Type

str

class google.cloud.vision_v1p2beta1.types.LatLongRect(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Rectangle determined by min and max LatLng pairs.

min_lat_lng

Min lat/long pair.

Type

google.type.latlng_pb2.LatLng

max_lat_lng

Max lat/long pair.

Type

google.type.latlng_pb2.LatLng

class google.cloud.vision_v1p2beta1.types.Likelihood(value)[source]

Bases: proto.enums.Enum

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

LIKELY = 4
POSSIBLE = 3
UNKNOWN = 0
UNLIKELY = 2
VERY_LIKELY = 5
VERY_UNLIKELY = 1
class google.cloud.vision_v1p2beta1.types.LocationInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected entity location information.

lat_lng

lat/long location coordinates.

Type

google.type.latlng_pb2.LatLng

class google.cloud.vision_v1p2beta1.types.NormalizedVertex(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

x

X coordinate.

Type

float

y

Y coordinate.

Type

float

class google.cloud.vision_v1p2beta1.types.OperationMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains metadata for the BatchAnnotateImages operation.

state

Current state of the batch operation.

Type

google.cloud.vision_v1p2beta1.types.OperationMetadata.State

create_time

The time when the batch request was received.

Type

google.protobuf.timestamp_pb2.Timestamp

update_time

The time when the operation result was last updated.

Type

google.protobuf.timestamp_pb2.Timestamp

class State(value)[source]

Bases: proto.enums.Enum

Batch operation states.

CANCELLED = 4
CREATED = 1
DONE = 3
RUNNING = 2
STATE_UNSPECIFIED = 0
class google.cloud.vision_v1p2beta1.types.OutputConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The desired output location and metadata.

gcs_destination

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

Type

google.cloud.vision_v1p2beta1.types.GcsDestination

batch_size

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

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

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

Type

int

class google.cloud.vision_v1p2beta1.types.Page(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected page from OCR.

property

Additional information detected on the page.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty

width

Page width. For PDFs the unit is points. For images (including TIFFs) the unit is pixels.

Type

int

height

Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels.

Type

int

blocks

List of blocks of text, images etc on this page.

Type

Sequence[google.cloud.vision_v1p2beta1.types.Block]

confidence

Confidence of the OCR results on the page. Range [0, 1].

Type

float

class google.cloud.vision_v1p2beta1.types.Paragraph(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

property

Additional information detected for the paragraph.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty

bounding_box

The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the ‘natural’ orientation. For example:

  • when the text is horizontal it might look like: 0—-1 | | 3—-2

  • when it’s rotated 180 degrees around the top-left corner it becomes: 2—-3 | | 1—-0 and the vertice order will still be (0, 1, 2, 3).

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

words

List of words in this paragraph.

Type

Sequence[google.cloud.vision_v1p2beta1.types.Word]

confidence

Confidence of the OCR results for the paragraph. Range [0, 1].

Type

float

class google.cloud.vision_v1p2beta1.types.Position(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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.

x

X coordinate.

Type

float

y

Y coordinate.

Type

float

z

Z coordinate (or depth).

Type

float

class google.cloud.vision_v1p2beta1.types.Property(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

name

Name of the property.

Type

str

value

Value of the property.

Type

str

uint64_value

Value of numeric properties.

Type

int

class google.cloud.vision_v1p2beta1.types.SafeSearchAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

adult

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

Type

google.cloud.vision_v1p2beta1.types.Likelihood

spoof

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

Type

google.cloud.vision_v1p2beta1.types.Likelihood

medical

Likelihood that this is a medical image.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

violence

Likelihood that this image contains violent content.

Type

google.cloud.vision_v1p2beta1.types.Likelihood

racy

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

Type

google.cloud.vision_v1p2beta1.types.Likelihood

class google.cloud.vision_v1p2beta1.types.Symbol(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A single symbol representation.

property

Additional information detected for the symbol.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty

bounding_box

The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the ‘natural’ orientation. For example:

  • when the text is horizontal it might look like: 0—-1 | | 3—-2

  • when it’s rotated 180 degrees around the top-left corner it becomes: 2—-3 | | 1—-0 and the vertice order will still be (0, 1, 2, 3).

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

text

The actual UTF-8 representation of the symbol.

Type

str

confidence

Confidence of the OCR results for the symbol. Range [0, 1].

Type

float

class google.cloud.vision_v1p2beta1.types.TextAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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][google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty] message definition below for more detail.

pages

List of pages detected by OCR.

Type

Sequence[google.cloud.vision_v1p2beta1.types.Page]

text

UTF-8 text detected on the pages.

Type

str

class DetectedBreak(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected start or end of a structural component.

type_

Detected break type.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak.BreakType

is_prefix

True if break prepends the element.

Type

bool

class BreakType(value)[source]

Bases: proto.enums.Enum

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

EOL_SURE_SPACE = 3
HYPHEN = 4
LINE_BREAK = 5
SPACE = 1
SURE_SPACE = 2
UNKNOWN = 0
class DetectedLanguage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected language for a structural component.

language_code

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

Type

str

confidence

Confidence of detected language. Range [0, 1].

Type

float

class TextProperty(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Additional information detected on the structural component.

detected_languages

A list of detected languages together with confidence.

Type

Sequence[google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedLanguage]

detected_break

Detected start or end of a text segment.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak

class google.cloud.vision_v1p2beta1.types.TextDetectionParams(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

enable_text_detection_confidence_score

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

Type

bool

class google.cloud.vision_v1p2beta1.types.Vertex(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

x

X coordinate.

Type

int

y

Y coordinate.

Type

int

class google.cloud.vision_v1p2beta1.types.WebDetection(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Relevant information for the image from the Internet.

web_entities

Deduced entities from similar images on the Internet.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebEntity]

full_matching_images

Fully matching images from the Internet. Can include resized copies of the query image.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]

partial_matching_images

Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]

pages_with_matching_images

Web pages containing the matching images from the Internet.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebPage]

visually_similar_images

The visually similar image results.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]

best_guess_labels

Best guess text labels for the request image.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebLabel]

class WebEntity(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Entity deduced from similar images on the Internet.

entity_id

Opaque entity ID.

Type

str

score

Overall relevancy score for the entity. Not normalized and not comparable across different image queries.

Type

float

description

Canonical description of the entity, in English.

Type

str

class WebImage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for online images.

url

The result image URL.

Type

str

score

(Deprecated) Overall relevancy score for the image.

Type

float

class WebLabel(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Label to provide extra metadata for the web detection.

label

Label for extra metadata.

Type

str

language_code

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

Type

str

class WebPage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for web pages.

url

The result web page URL.

Type

str

score

(Deprecated) Overall relevancy score for the web page.

Type

float

page_title

Title for the web page, may contain HTML markups.

Type

str

full_matching_images

Fully matching images on the page. Can include resized copies of the query image.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]

partial_matching_images

Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops.

Type

Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]

class google.cloud.vision_v1p2beta1.types.WebDetectionParams(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Parameters for web detection request.

include_geo_results

Whether to include results derived from the geo information in the image.

Type

bool

class google.cloud.vision_v1p2beta1.types.Word(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A word representation.

property

Additional information detected for the word.

Type

google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty

bounding_box

The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the ‘natural’ orientation. For example:

  • when the text is horizontal it might look like: 0—-1 | | 3—-2

  • when it’s rotated 180 degrees around the top-left corner it becomes: 2—-3 | | 1—-0 and the vertice order will still be (0, 1, 2, 3).

Type

google.cloud.vision_v1p2beta1.types.BoundingPoly

symbols

List of symbols in the word. The order of the symbols follows the natural reading order.

Type

Sequence[google.cloud.vision_v1p2beta1.types.Symbol]

confidence

Confidence of the OCR results for the word. Range [0, 1].

Type

float