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 v1p1beta1 API

class google.cloud.vision_v1p1beta1.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_v1p1beta1.types.Image

features

Requested features.

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.Feature]

image_context

Additional context that may accompany the image.

Type

google.cloud.vision_v1p1beta1.types.ImageContext

class google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation]

landmark_annotations

If present, landmark detection has completed successfully.

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]

logo_annotations

If present, logo detection has completed successfully.

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]

label_annotations

If present, label detection has completed successfully.

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]

text_annotations

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

Type

MutableSequence[google.cloud.vision_v1p1beta1.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_v1p1beta1.types.TextAnnotation

safe_search_annotation

If present, safe-search annotation has completed successfully.

Type

google.cloud.vision_v1p1beta1.types.SafeSearchAnnotation

image_properties_annotation

If present, image properties were extracted successfully.

Type

google.cloud.vision_v1p1beta1.types.ImageProperties

crop_hints_annotation

If present, crop hints have completed successfully.

Type

google.cloud.vision_v1p1beta1.types.CropHintsAnnotation

web_detection

If present, web detection has completed successfully.

Type

google.cloud.vision_v1p1beta1.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

class google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]

class google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.AnnotateImageResponse]

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.types.BoundingPoly

paragraphs

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

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.Paragraph]

block_type

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

Type

google.cloud.vision_v1p1beta1.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.

Values:
UNKNOWN (0):

Unknown block type.

TEXT (1):

Regular text block.

TABLE (2):

Table block.

PICTURE (3):

Image block.

RULER (4):

Horizontal/vertical line box.

BARCODE (5):

Barcode block.

class google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.Vertex]

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.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_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.CropHint]

class google.cloud.vision_v1p1beta1.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

MutableSequence[float]

class google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.ColorInfo]

class google.cloud.vision_v1p1beta1.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

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_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.LocationInfo]

properties

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

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.Property]

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.types.BoundingPoly

landmarks

Detected face landmarks.

Type

MutableSequence[google.cloud.vision_v1p1beta1.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_v1p1beta1.types.Likelihood

sorrow_likelihood

Sorrow likelihood.

Type

google.cloud.vision_v1p1beta1.types.Likelihood

anger_likelihood

Anger likelihood.

Type

google.cloud.vision_v1p1beta1.types.Likelihood

surprise_likelihood

Surprise likelihood.

Type

google.cloud.vision_v1p1beta1.types.Likelihood

under_exposed_likelihood

Under-exposed likelihood.

Type

google.cloud.vision_v1p1beta1.types.Likelihood

blurred_likelihood

Blurred likelihood.

Type

google.cloud.vision_v1p1beta1.types.Likelihood

headwear_likelihood

Headwear likelihood.

Type

google.cloud.vision_v1p1beta1.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_v1p1beta1.types.FaceAnnotation.Landmark.Type

position

Face landmark position.

Type

google.cloud.vision_v1p1beta1.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.

Values:
UNKNOWN_LANDMARK (0):

Unknown face landmark detected. Should not be filled.

LEFT_EYE (1):

Left eye.

RIGHT_EYE (2):

Right eye.

LEFT_OF_LEFT_EYEBROW (3):

Left of left eyebrow.

RIGHT_OF_LEFT_EYEBROW (4):

Right of left eyebrow.

LEFT_OF_RIGHT_EYEBROW (5):

Left of right eyebrow.

RIGHT_OF_RIGHT_EYEBROW (6):

Right of right eyebrow.

MIDPOINT_BETWEEN_EYES (7):

Midpoint between eyes.

NOSE_TIP (8):

Nose tip.

UPPER_LIP (9):

Upper lip.

LOWER_LIP (10):

Lower lip.

MOUTH_LEFT (11):

Mouth left.

MOUTH_RIGHT (12):

Mouth right.

MOUTH_CENTER (13):

Mouth center.

NOSE_BOTTOM_RIGHT (14):

Nose, bottom right.

NOSE_BOTTOM_LEFT (15):

Nose, bottom left.

NOSE_BOTTOM_CENTER (16):

Nose, bottom center.

LEFT_EYE_TOP_BOUNDARY (17):

Left eye, top boundary.

LEFT_EYE_RIGHT_CORNER (18):

Left eye, right corner.

LEFT_EYE_BOTTOM_BOUNDARY (19):

Left eye, bottom boundary.

LEFT_EYE_LEFT_CORNER (20):

Left eye, left corner.

RIGHT_EYE_TOP_BOUNDARY (21):

Right eye, top boundary.

RIGHT_EYE_RIGHT_CORNER (22):

Right eye, right corner.

RIGHT_EYE_BOTTOM_BOUNDARY (23):

Right eye, bottom boundary.

RIGHT_EYE_LEFT_CORNER (24):

Right eye, left corner.

LEFT_EYEBROW_UPPER_MIDPOINT (25):

Left eyebrow, upper midpoint.

RIGHT_EYEBROW_UPPER_MIDPOINT (26):

Right eyebrow, upper midpoint.

LEFT_EAR_TRAGION (27):

Left ear tragion.

RIGHT_EAR_TRAGION (28):

Right ear tragion.

LEFT_EYE_PUPIL (29):

Left eye pupil.

RIGHT_EYE_PUPIL (30):

Right eye pupil.

FOREHEAD_GLABELLA (31):

Forehead glabella.

CHIN_GNATHION (32):

Chin gnathion.

CHIN_LEFT_GONION (33):

Chin left gonion.

CHIN_RIGHT_GONION (34):

Chin right gonion.

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

Bases: proto.message.Message

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

type_

The feature type.

Type

google.cloud.vision_v1p1beta1.types.Feature.Type

max_results

Maximum number of results of this type.

Type

int

model

Model to use for the feature. Supported values: “builtin/stable” (the default if unset) and “builtin/latest”. DOCUMENT_TEXT_DETECTION and TEXT_DETECTION also support “builtin/weekly” for the bleeding edge release updated weekly.

Type

str

class Type(value)[source]

Bases: proto.enums.Enum

Type of image feature.

Values:
TYPE_UNSPECIFIED (0):

Unspecified feature type.

FACE_DETECTION (1):

Run face detection.

LANDMARK_DETECTION (2):

Run landmark detection.

LOGO_DETECTION (3):

Run logo detection.

LABEL_DETECTION (4):

Run label detection.

TEXT_DETECTION (5):

Run OCR.

DOCUMENT_TEXT_DETECTION (11):

Run dense text document OCR. Takes precedence when both DOCUMENT_TEXT_DETECTION and TEXT_DETECTION are present.

SAFE_SEARCH_DETECTION (6):

Run computer vision models to compute image safe-search properties.

IMAGE_PROPERTIES (7):

Compute a set of image properties, such as the image’s dominant colors.

CROP_HINTS (9):

Run crop hints.

WEB_DETECTION (10):

Run web detection.

class google.cloud.vision_v1p1beta1.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. 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_v1p1beta1.types.ImageSource

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

Bases: proto.message.Message

Image context and/or feature-specific parameters.

lat_long_rect

lat/long rectangle that specifies the location of the image.

Type

google.cloud.vision_v1p1beta1.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

MutableSequence[str]

crop_hints_params

Parameters for crop hints annotation request.

Type

google.cloud.vision_v1p1beta1.types.CropHintsParams

web_detection_params

Parameters for web detection.

Type

google.cloud.vision_v1p1beta1.types.WebDetectionParams

text_detection_params

Parameters for text detection and document text detection.

Type

google.cloud.vision_v1p1beta1.types.TextDetectionParams

class google.cloud.vision_v1p1beta1.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_v1p1beta1.types.DominantColorsAnnotation

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

Bases: proto.message.Message

External image source (Google Cloud Storage image location).

gcs_image_uri

NOTE: For new code image_uri below is preferred. Google Cloud Storage image URI, which must be in the following form: gs://bucket_name/object_name (for details, see Google Cloud Storage Request URIs). NOTE: Cloud Storage object versioning is not supported.

Type

str

image_uri

Image URI which supports:

  1. Google Cloud Storage image URI, which must be in the following form: gs://bucket_name/object_name (for details, see Google Cloud Storage Request URIs). NOTE: Cloud Storage object versioning is not supported.

  2. Publicly accessible image HTTP/HTTPS URL. This is preferred over the legacy gcs_image_uri above. When both gcs_image_uri and image_uri are specified, image_uri takes precedence.

Type

str

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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.

Values:
UNKNOWN (0):

Unknown likelihood.

VERY_UNLIKELY (1):

It is very unlikely that the image belongs to the specified vertical.

UNLIKELY (2):

It is unlikely that the image belongs to the specified vertical.

POSSIBLE (3):

It is possible that the image belongs to the specified vertical.

LIKELY (4):

It is likely that the image belongs to the specified vertical.

VERY_LIKELY (5):

It is very likely that the image belongs to the specified vertical.

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.types.TextAnnotation.TextProperty

width

Page width in pixels.

Type

int

height

Page height in pixels.

Type

int

blocks

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

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.Block]

confidence

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

Type

float

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.types.BoundingPoly

words

List of words in this paragraph.

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.Word]

confidence

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

Type

float

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.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_v1p1beta1.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_v1p1beta1.types.Likelihood

medical

Likelihood that this is a medical image.

Type

google.cloud.vision_v1p1beta1.types.Likelihood

violence

Likelihood that this image contains violent content.

Type

google.cloud.vision_v1p1beta1.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_v1p1beta1.types.Likelihood

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.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_v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty] message definition below for more detail.

pages

List of pages detected by OCR.

Type

MutableSequence[google.cloud.vision_v1p1beta1.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_v1p1beta1.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.

Values:
UNKNOWN (0):

Unknown break label type.

SPACE (1):

Regular space.

SURE_SPACE (2):

Sure space (very wide).

EOL_SURE_SPACE (3):

Line-wrapping break.

HYPHEN (4):

End-line hyphen that is not present in text; does not co-occur with SPACE, LEADER_SPACE, or LINE_BREAK.

LINE_BREAK (5):

Line break that ends a paragraph.

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

MutableSequence[google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedLanguage]

detected_break

Detected start or end of a text segment.

Type

google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedBreak

class google.cloud.vision_v1p1beta1.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

advanced_ocr_options

A list of advanced OCR options to fine-tune OCR behavior.

Type

MutableSequence[str]

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebEntity]

full_matching_images

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

Type

MutableSequence[google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]

pages_with_matching_images

Web pages containing the matching images from the Internet.

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebPage]

visually_similar_images

The visually similar image results.

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]

best_guess_labels

Best guess text labels for the request image.

Type

MutableSequence[google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.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

MutableSequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]

class google.cloud.vision_v1p1beta1.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_v1p1beta1.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_v1p1beta1.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_v1p1beta1.types.BoundingPoly

symbols

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

Type

MutableSequence[google.cloud.vision_v1p1beta1.types.Symbol]

confidence

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

Type

float