Rekognition / Client / start_text_detection

start_text_detection#

Rekognition.Client.start_text_detection(**kwargs)#

Starts asynchronous detection of text in a stored video.

Amazon Rekognition Video can detect text in a video stored in an Amazon S3 bucket. Use Video to specify the bucket name and the filename of the video. StartTextDetection returns a job identifier ( JobId) which you use to get the results of the operation. When text detection is finished, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic that you specify in NotificationChannel.

To get the results of the text detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. if so, call GetTextDetection and pass the job identifier ( JobId) from the initial call to StartTextDetection.

See also: AWS API Documentation

Request Syntax

response = client.start_text_detection(
    Video={
        'S3Object': {
            'Bucket': 'string',
            'Name': 'string',
            'Version': 'string'
        }
    },
    ClientRequestToken='string',
    NotificationChannel={
        'SNSTopicArn': 'string',
        'RoleArn': 'string'
    },
    JobTag='string',
    Filters={
        'WordFilter': {
            'MinConfidence': ...,
            'MinBoundingBoxHeight': ...,
            'MinBoundingBoxWidth': ...
        },
        'RegionsOfInterest': [
            {
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'Polygon': [
                    {
                        'X': ...,
                        'Y': ...
                    },
                ]
            },
        ]
    }
)
Parameters:
  • Video (dict) –

    [REQUIRED]

    Video file stored in an Amazon S3 bucket. Amazon Rekognition video start operations such as StartLabelDetection use Video to specify a video for analysis. The supported file formats are .mp4, .mov and .avi.

    • S3Object (dict) –

      The Amazon S3 bucket name and file name for the video.

      • Bucket (string) –

        Name of the S3 bucket.

      • Name (string) –

        S3 object key name.

      • Version (string) –

        If the bucket is versioning enabled, you can specify the object version.

  • ClientRequestToken (string) – Idempotent token used to identify the start request. If you use the same token with multiple StartTextDetection requests, the same JobId is returned. Use ClientRequestToken to prevent the same job from being accidentaly started more than once.

  • NotificationChannel (dict) –

    The Amazon Simple Notification Service topic to which Amazon Rekognition publishes the completion status of a video analysis operation. For more information, see Calling Amazon Rekognition Video operations. Note that the Amazon SNS topic must have a topic name that begins with AmazonRekognition if you are using the AmazonRekognitionServiceRole permissions policy to access the topic. For more information, see Giving access to multiple Amazon SNS topics.

    • SNSTopicArn (string) – [REQUIRED]

      The Amazon SNS topic to which Amazon Rekognition posts the completion status.

    • RoleArn (string) – [REQUIRED]

      The ARN of an IAM role that gives Amazon Rekognition publishing permissions to the Amazon SNS topic.

  • JobTag (string) – An identifier returned in the completion status published by your Amazon Simple Notification Service topic. For example, you can use JobTag to group related jobs and identify them in the completion notification.

  • Filters (dict) –

    Optional parameters that let you set criteria the text must meet to be included in your response.

    • WordFilter (dict) –

      Filters focusing on qualities of the text, such as confidence or size.

      • MinConfidence (float) –

        Sets the confidence of word detection. Words with detection confidence below this will be excluded from the result. Values should be between 0 and 100. The default MinConfidence is 80.

      • MinBoundingBoxHeight (float) –

        Sets the minimum height of the word bounding box. Words with bounding box heights lesser than this value will be excluded from the result. Value is relative to the video frame height.

      • MinBoundingBoxWidth (float) –

        Sets the minimum width of the word bounding box. Words with bounding boxes widths lesser than this value will be excluded from the result. Value is relative to the video frame width.

    • RegionsOfInterest (list) –

      Filter focusing on a certain area of the frame. Uses a BoundingBox object to set the region of the screen.

      • (dict) –

        Specifies a location within the frame that Rekognition checks for objects of interest such as text, labels, or faces. It uses a BoundingBox or Polygon to set a region of the screen.

        A word, face, or label is included in the region if it is more than half in that region. If there is more than one region, the word, face, or label is compared with all regions of the screen. Any object of interest that is more than half in a region is kept in the results.

        • BoundingBox (dict) –

          The box representing a region of interest on screen.

          • Width (float) –

            Width of the bounding box as a ratio of the overall image width.

          • Height (float) –

            Height of the bounding box as a ratio of the overall image height.

          • Left (float) –

            Left coordinate of the bounding box as a ratio of overall image width.

          • Top (float) –

            Top coordinate of the bounding box as a ratio of overall image height.

        • Polygon (list) –

          Specifies a shape made up of up to 10 Point objects to define a region of interest.

          • (dict) –

            The X and Y coordinates of a point on an image or video frame. The X and Y values are ratios of the overall image size or video resolution. For example, if an input image is 700x200 and the values are X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the image.

            An array of Point objects makes up a Polygon. A Polygon is returned by DetectText and by DetectCustomLabels Polygon represents a fine-grained polygon around a detected item. For more information, see Geometry in the Amazon Rekognition Developer Guide.

            • X (float) –

              The value of the X coordinate for a point on a Polygon.

            • Y (float) –

              The value of the Y coordinate for a point on a Polygon.

Return type:

dict

Returns:

Response Syntax

{
    'JobId': 'string'
}

Response Structure

  • (dict) –

    • JobId (string) –

      Identifier for the text detection job. Use JobId to identify the job in a subsequent call to GetTextDetection.

Exceptions