NAME

Google::Cloud::Vision::V1::TextAnnotation - Compiled Protocol Buffers messages for google/cloud/vision/v1/text_annotation.proto

SYNOPSIS

use Google::Cloud::Vision::V1::TextAnnotation;

my $msg = Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation->new({
    pages => $pages,
    text => $text,
});

# Read or update a field
my $val = $msg->pages();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/vision/v1/text_annotation.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation

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

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Vision::V1::TextAnnotation::Page

Detected page from OCR.

Inherits from Protobuf::Message.

Accessors

  • $msg->property() / $msg->property($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation::TextProperty)

    Additional information detected on the page.

  • $msg->width() / $msg->width($value)

    Type: Int32

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

  • $msg->height() / $msg->height($value)

    Type: Int32

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

  • $msg->blocks() / $msg->blocks($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::Block)

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

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

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

Google::Cloud::Vision::V1::TextAnnotation::Block

Logical element on the page.

Inherits from Protobuf::Message.

Accessors

  • $msg->property() / $msg->property($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation::TextProperty)

    Additional information detected for the block.

  • $msg->bounding_box() / $msg->bounding_box($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    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 vertex order will still be (0, 1, 2, 3).
  • $msg->paragraphs() / $msg->paragraphs($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::Paragraph)

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

  • $msg->block_type() / $msg->block_type($value)

    Type: Enum (Google::Cloud::Vision::V1::Block::BlockType)

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

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

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

Enum: Block::BlockType

  • UNKNOWN => 0

  • TEXT => 1

  • TABLE => 2

  • PICTURE => 3

  • RULER => 4

  • BARCODE => 5

Google::Cloud::Vision::V1::TextAnnotation::Paragraph

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

Inherits from Protobuf::Message.

Accessors

  • $msg->property() / $msg->property($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation::TextProperty)

    Additional information detected for the paragraph.

  • $msg->bounding_box() / $msg->bounding_box($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    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 vertex order will still be (0, 1, 2, 3).

  • $msg->words() / $msg->words($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::Word)

    List of all words in this paragraph.

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

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

Google::Cloud::Vision::V1::TextAnnotation::Word

A word representation.

Inherits from Protobuf::Message.

Accessors

  • $msg->property() / $msg->property($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation::TextProperty)

    Additional information detected for the word.

  • $msg->bounding_box() / $msg->bounding_box($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    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 vertex order will still be (0, 1, 2, 3).

  • $msg->symbols() / $msg->symbols($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::Symbol)

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

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

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

Google::Cloud::Vision::V1::TextAnnotation::Symbol

A single symbol representation.

Inherits from Protobuf::Message.

Accessors

  • $msg->property() / $msg->property($value)

    Type: Message (Google::Cloud::Vision::V1::TextAnnotation::TextAnnotation::TextProperty)

    Additional information detected for the symbol.

  • $msg->bounding_box() / $msg->bounding_box($value)

    Type: Message (Google::Cloud::Vision::V1::Geometry::BoundingPoly)

    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 vertex order will still be (0, 1, 2, 3).

  • $msg->text() / $msg->text($value)

    Type: String

    The actual UTF-8 representation of the symbol.

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

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

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Vision::V1::TextAnnotation::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.