

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 偵測文字
<a name="text-detection"></a>

Amazon Rekognition 可以偵測映像和影片中的文字。然後，它可以將偵測到的文字轉換為機器可讀取的文字。您可以使用映像中的機器可讀取文字偵測來實作解決方案，例如：
+ 視覺搜尋。例如，擷取和顯示包含相同文字的映像。
+ 內容見解。例如，針對發生在擷取的影片影格中所辨識到的文字主題提供見解。您的應用程式可以搜尋辨識出的文字以找出相關內容，例如，新聞、運動比數、運動員號碼和字幕。
+ 導覽。例如，開發支援語音功能的手機應用程式，協助視障使用者辨識餐廳名稱、商店或街道指標。
+ 公共安全與交通協助。例如，從交通監視器映像中偵測車牌號碼。
+ 篩選。例如，從映像中篩選出個人身分識別資訊 (PII)。

對於影片中的文字偵測，您可以實作解決方案，例如：
+ 搜尋影片中包含特定文字關鍵字的片段，例如新聞節目畫面中的來賓姓名。
+ 透過偵測意外文字、褻瀆或垃圾郵件，管制內容以符合組織標準。
+ 尋找視訊時間軸上的所有文字浮水印以執行進一步處理，例如用其他語言替換文字以達成內容國際化。
+ 尋找文字位置，以便可以相應地對齊其他圖形。

若要偵測 JPEG 或 PNG 格式映像中的文字，請使用 [DetectText](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectText.html) 操作。若要以非同步方式偵測影片中的文字，請使用 [StartTextDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartTextDetection.html) 和 [GetTextDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetTextDetection.html) 作業。映像和影片文字偵測作業都支援大多數字型，包括高度風格化的字型。偵測文字之後，Amazon Rekognition 會建立偵測到的字詞和文字行的代表法，顯示兩者間的關聯，並顯示文字在映像或影片影格中的位置。

`DetectText` 和 `GetTextDetection` 操作會偵測文字和線條。*單詞*是一個或多個不用空格分隔的腳本字符。`DetectText` 最多可以偵測映像中的 100 個單詞。`GetTextDetection` 每幀影片還可以偵測多達 100 個單詞。

單詞是一或多個腳本字符，不以空格分隔。Amazon Rekognition 專為偵測英文、阿拉伯文、俄文、德文、法文、義大利文、葡萄牙文和西班牙文單詞。

*文字行*是一串等距的字詞。文字行不一定是完整的句子 (句點不表示行的結尾)。例如，Amazon Rekognition 偵測結果為一行文字。當單詞後面沒有對齊或文字之間存在較大的間隙 (相對於字詞的長度) 時，文字行結束。Amazon Rekognition 根據單字間的間隔，可能會偵測以相同方向對齊的多行文字。如果句子跨越多行，此操作會傳回多行文字。

請參考下列映像：

![\[咖啡杯有微笑的臉孔和文字「是星期一，但保持微笑」，有週框方塊和擷取的文字。\]](http://docs.aws.amazon.com/zh_tw/rekognition/latest/dg/images/text.png)


藍色方塊代表 `DetectText` 操作所傳回的偵測到的文字和文字位置的相關資訊。在此範例中，Amazon Rekognition 會將「IT's」、「MONDAY」、「but」、「keep」和「Smiling」偵測為單字。Amazon Rekognition 將「IT's」、「MONDAY」、「but」、「keep」和「Smiling」偵測為文字行。文字必須在水平軸 \$1/- 90 度方向的範圍內才可被偵測到。

如需範例，請參閱 [在映像中偵測文字](text-detecting-text-procedure.md)。

**Topics**
+ [在映像中偵測文字](text-detecting-text-procedure.md)
+ [偵測已儲存影片中的文字](text-detecting-video-procedure.md)

# 在映像中偵測文字
<a name="text-detecting-text-procedure"></a>

您提供的輸入映像可以是映像位元組陣列 (Base64 編碼映像位元組)，或者 Amazon S3 物件。在此步驟中，需上傳 jpeg 或 png 映像到 S3 儲存貯體，並指定檔案名稱。

**若要偵測映像中的文字 (API)**

1. 如果您尚未完成，請先完成事前準備：

   1. 建立或更新具有 `AmazonRekognitionFullAccess` 和 `AmazonS3ReadOnlyAccess` 許可的使用者。如需詳細資訊，請參閱[步驟 1：設定 AWS 帳戶並建立使用者](setting-up.md#setting-up-iam)。

   1. 安裝和設定 AWS Command Line Interface 和 AWS SDKs。如需詳細資訊，請參閱[步驟 2：設定 AWS CLI 和 AWS SDKs](setup-awscli-sdk.md)。

1. 上傳包含文字的映像到您的 S3 儲存貯體。

   如需指示說明，請參閱《Amazon Simple Storage Service 使用者指南》**中的[上傳物件至 Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UploadingObjectsintoAmazonS3.html)。

1. 使用下列範例來呼叫 `DetectText` 操作。

------
#### [ Java ]

   以下範例程式碼會顯示在映像中偵測到的行和文字。

   將 `amzn-s3-demo-bucket` 與 `photo` 的數值取代為您在步驟 2 中所使用的 S3 儲存貯體名稱與映像名稱。

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   package aws.example.rekognition.image;
   import com.amazonaws.services.rekognition.AmazonRekognition;
   import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder;
   import com.amazonaws.services.rekognition.model.AmazonRekognitionException;
   import com.amazonaws.services.rekognition.model.Image;
   import com.amazonaws.services.rekognition.model.S3Object;
   import com.amazonaws.services.rekognition.model.DetectTextRequest;
   import com.amazonaws.services.rekognition.model.DetectTextResult;
   import com.amazonaws.services.rekognition.model.TextDetection;
   import java.util.List;
   
   
   
   public class DetectText {
   
      public static void main(String[] args) throws Exception {
         
     
         String photo = "inputtext.jpg";
         String bucket = "bucket";
   
         AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
   
        
         
         DetectTextRequest request = new DetectTextRequest()
                 .withImage(new Image()
                 .withS3Object(new S3Object()
                 .withName(photo)
                 .withBucket(bucket)));
       
   
         try {
            DetectTextResult result = rekognitionClient.detectText(request);
            List<TextDetection> textDetections = result.getTextDetections();
   
            System.out.println("Detected lines and words for " + photo);
            for (TextDetection text: textDetections) {
         
                    System.out.println("Detected: " + text.getDetectedText());
                    System.out.println("Confidence: " + text.getConfidence().toString());
                    System.out.println("Id : " + text.getId());
                    System.out.println("Parent Id: " + text.getParentId());
                    System.out.println("Type: " + text.getType());
                    System.out.println();
            }
         } catch(AmazonRekognitionException e) {
            e.printStackTrace();
         }
      }
   }
   ```

------
#### [ Java V2 ]

   此程式碼取自 AWS 文件開發套件範例 GitHub 儲存庫。請參閱[此處](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/rekognition/src/main/java/com/example/rekognition/DetectText.java)的完整範例。

   ```
   /**
   *  To run this code example, ensure that you perform the Prerequisites as stated in the Amazon Rekognition Guide:
   *  https://docs.aws.amazon.com/rekognition/latest/dg/video-analyzing-with-sqs.html
   *
   * Also, ensure that set up your development environment, including your credentials.
   *
   * For information, see this documentation topic:
   *
   * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
   */
   
   //snippet-start:[rekognition.java2.detect_text.import]
   import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
   import software.amazon.awssdk.core.SdkBytes;
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.rekognition.RekognitionClient;
   import software.amazon.awssdk.services.rekognition.model.DetectTextRequest;
   import software.amazon.awssdk.services.rekognition.model.Image;
   import software.amazon.awssdk.services.rekognition.model.DetectTextResponse;
   import software.amazon.awssdk.services.rekognition.model.TextDetection;
   import software.amazon.awssdk.services.rekognition.model.RekognitionException;
   import java.io.FileInputStream;
   import java.io.FileNotFoundException;
   import java.io.InputStream;
   import java.util.List;
   //snippet-end:[rekognition.java2.detect_text.import]
   
   /**
   * Before running this Java V2 code example, set up your development environment, including your credentials.
   *
   * For more information, see the following documentation topic:
   *
   * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
   */
   public class DetectTextImage {
   
    public static void main(String[] args) {
   
        final String usage = "\n" +
            "Usage: " +
            "   <sourceImage>\n\n" +
            "Where:\n" +
            "   sourceImage - The path to the image that contains text (for example, C:\\AWS\\pic1.png). \n\n";
   
      if (args.length != 1) {
            System.out.println(usage);
            System.exit(1);
        }
   
        String sourceImage = args[0] ;
        Region region = Region.US_WEST_2;
        RekognitionClient rekClient = RekognitionClient.builder()
            .region(region)
            .credentialsProvider(ProfileCredentialsProvider.create("default"))
            .build();
   
        detectTextLabels(rekClient, sourceImage );
        rekClient.close();
    }
   
    // snippet-start:[rekognition.java2.detect_text.main]
    public static void detectTextLabels(RekognitionClient rekClient, String sourceImage) {
   
        try {
            InputStream sourceStream = new FileInputStream(sourceImage);
            SdkBytes sourceBytes = SdkBytes.fromInputStream(sourceStream);
            Image souImage = Image.builder()
                .bytes(sourceBytes)
                .build();
   
            DetectTextRequest textRequest = DetectTextRequest.builder()
                .image(souImage)
                .build();
   
            DetectTextResponse textResponse = rekClient.detectText(textRequest);
            List<TextDetection> textCollection = textResponse.textDetections();
            System.out.println("Detected lines and words");
            for (TextDetection text: textCollection) {
                System.out.println("Detected: " + text.detectedText());
                System.out.println("Confidence: " + text.confidence().toString());
                System.out.println("Id : " + text.id());
                System.out.println("Parent Id: " + text.parentId());
                System.out.println("Type: " + text.type());
                System.out.println();
            }
   
        } catch (RekognitionException | FileNotFoundException e) {
            System.out.println(e.getMessage());
            System.exit(1);
        }
    }
    // snippet-end:[rekognition.java2.detect_text.main]
   ```

------
#### [ AWS CLI ]

   此 AWS CLI 命令會顯示 CLI 操作的 JSON `detect-text` 輸出。

   將 `amzn-s3-demo-bucket` 與 `Name` 的數值取代為您在步驟 2 中所使用的 S3 儲存貯體名稱與映像名稱。

   使用您開發人員設定檔的名稱取代 `profile_name` 的值。

   ```
   aws rekognition detect-text  --image "{"S3Object":{"Bucket":"amzn-s3-demo-bucket","Name":"image-name"}}" --profile default
   ```

   如果您在 Windows 裝置上存取 CLI，請使用雙引號而非單引號，並以反斜線 (即\$1) 替代內部雙引號，以解決您可能遇到的任何剖析器錯誤。例如，請參閱下列內容：

   ```
   aws rekognition detect-text  --image "{\"S3Object\":{\"Bucket\":\"amzn-s3-demo-bucket\",\"Name\":\"image-name\"}}" --profile default
   ```

------
#### [ Python ]

   以下範例程式碼會顯示在映像中偵測到的行和文字。

   將 `amzn-s3-demo-bucket` 與 `photo` 的數值取代為您在步驟 2 中所使用的 S3 儲存貯體名稱與映像名稱。將建立 Rekognition 工作階段的行中 `profile_name` 值取代為您開發人員設定檔的名稱。

   ```
   # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   # PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   import boto3
   
   def detect_text(photo, bucket):
   
       session = boto3.Session(profile_name='default')
       client = session.client('rekognition')
   
       response = client.detect_text(Image={'S3Object': {'Bucket': bucket, 'Name': photo}})
   
       textDetections = response['TextDetections']
       print('Detected text\n----------')
       for text in textDetections:
           print('Detected text:' + text['DetectedText'])
           print('Confidence: ' + "{:.2f}".format(text['Confidence']) + "%")
           print('Id: {}'.format(text['Id']))
           if 'ParentId' in text:
               print('Parent Id: {}'.format(text['ParentId']))
           print('Type:' + text['Type'])
           print()
       return len(textDetections)
   
   def main():
       bucket = 'amzn-s3-demo-bucket'
       photo = 'photo-name'
       text_count = detect_text(photo, bucket)
       print("Text detected: " + str(text_count))
   
   if __name__ == "__main__":
       main()
   ```

------
#### [ .NET ]

   以下範例程式碼會顯示在映像中偵測到的行和文字。

   將 `amzn-s3-demo-bucket` 與 `photo` 的數值取代為您在步驟 2 中所使用的 S3 儲存貯體名稱與映像名稱。

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   using System;
   using Amazon.Rekognition;
   using Amazon.Rekognition.Model;
   
   public class DetectText
   {
       public static void Example()
       {
           String photo = "input.jpg";
           String bucket = "amzn-s3-demo-bucket";
   
           AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient();
   
           DetectTextRequest detectTextRequest = new DetectTextRequest()
           {
               Image = new Image()
               {
                   S3Object = new S3Object()
                   {
                       Name = photo,
                       Bucket = bucket
                   }
               }
           };
   
           try
           {
               DetectTextResponse detectTextResponse = rekognitionClient.DetectText(detectTextRequest);
               Console.WriteLine("Detected lines and words for " + photo);
               foreach (TextDetection text in detectTextResponse.TextDetections)
               {
                   Console.WriteLine("Detected: " + text.DetectedText);
                   Console.WriteLine("Confidence: " + text.Confidence);
                   Console.WriteLine("Id : " + text.Id);
                   Console.WriteLine("Parent Id: " + text.ParentId);
                   Console.WriteLine("Type: " + text.Type);
               }
           }
           catch (Exception e)
           {
               Console.WriteLine(e.Message);
           }
       }
   }
   ```

------
#### [ Node.JS ]

   以下範例程式碼會顯示在映像中偵測到的行和文字。

   將 `amzn-s3-demo-bucket` 與 `photo` 的數值取代為您在步驟 2 中所使用的 S3 儲存貯體名稱與映像名稱。將 `region` 的值取代為 .aws 憑證中找到的區域。將建立 Rekognition 工作階段的行中 `profile_name` 值取代為您開發人員設定檔的名稱。

   ```
   var AWS = require('aws-sdk');
   
   const bucket = 'bucket' // the bucketname without s3://
   const photo  = 'photo' // the name of file
   
   const config = new AWS.Config({
     accessKeyId: process.env.AWS_ACCESS_KEY_ID,
     secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
   }) 
   AWS.config.update({region:'region'});
   const client = new AWS.Rekognition();
   const params = {
     Image: {
       S3Object: {
         Bucket: bucket,
         Name: photo
       },
     },
   }
   client.detectText(params, function(err, response) {
     if (err) {
       console.log(err, err.stack); // handle error if an error occurred
     } else {
       console.log(`Detected Text for: ${photo}`)
       console.log(response)
       response.TextDetections.forEach(label => {
         console.log(`Detected Text: ${label.DetectedText}`),
         console.log(`Type: ${label.Type}`),
         console.log(`ID: ${label.Id}`),
         console.log(`Parent ID: ${label.ParentId}`),
         console.log(`Confidence: ${label.Confidence}`),
         console.log(`Polygon: `)
         console.log(label.Geometry.Polygon)
       } 
       )
     } 
   });
   ```

------

## DetectText 操作要求
<a name="detecttext-request"></a>

在 `DetectText` 操作中，提供 Base64 編碼位元組陣列的輸入映像或是儲存於 Amazon S3 儲存貯體中的映像。以下範例 JSON 請求顯示從 Amazon S3 儲存貯體載入的映像。

```
{
    "Image": {
        "S3Object": {
            "Bucket": "amzn-s3-demo-bucket",
            "Name": "inputtext.jpg"
        }
    }
}
```

### 篩選條件
<a name="text-filters"></a>

按文字區域、大小和可信度分數進行篩選可為您提供更大的靈活性來控製文字偵測輸出。藉由使用感興趣的區域，您可以輕鬆地將文字偵測限制在與您相關的區域，例如，從機器圖片讀取零件編號時，個人檔案相片右上角或相對於參考點的固定位置 。文字週框方塊大小篩選器可用於避免產生嘈雜或無關緊要的小背景文字。最後，文字可信度篩選器讓您可以消除因朦朧或模糊而導致的不可靠結果。

如需篩選器值的相關資訊，請參閱 `[DetectTextFilters](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectTextFilters.html)`。

您可以使用下列篩選器：
+ **MinConfidence**：設定文字偵測的可信度。可信度低於此等級的文字會從結果中排除。值應該介於 0 和 100 之間。
+ **MinBoundingBoxWidth**：設定文字週框方塊的最小寬度。週邊方塊小於此值的文字會從結果中排除。此值相對於映像影格寬度。
+ **MinBoundingBoxHeight**：設定文字週邊方塊的最小高度。週邊方塊高度小於此值的文字會從結果中排除。此值相對於映像影格高度。
+ **RegionsOfInterest**：將偵測限制為映像影格的特定區域。這些值相對於影格尺寸。對於僅部分區域內的文字，回應是未定義的。

## DetectText 操作回應
<a name="text-response"></a>

`DetectText` 操作將分析映像並傳回陣列 TextDetections，其中每個元素 (`[TextDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_TextDetection.html)`) 代表在映像中偵測到的一行文字或單字。針對每個元素，`DetectText` 會傳回以下資訊：
+ 偵測到的文字 (`DetectedText`)
+ 單字與文字行之間的關係 (`Id` 和 `ParentId`)
+ 文字在映像中的位置 (`Geometry`)
+ Amazon Rekognition 對於文字與週框方塊 (`Confidence`) 偵測精確度的可信度
+ 偵測到的文字類型 (`Type`)

### 偵測到的文字
<a name="text-detected-text"></a>

每個 `TextDetection` 元素包含辨識到的文字 (單字或行) `DetectedText` 欄位。單字是一或多個指令碼字元，不以空格分隔。`DetectText` 最多可在一個映像中偵測 100 個單字。傳回的文字可能包含字元，讓單字無法辨識。例如，*C@t* 而不是 *Cat*。若要判斷 `TextDetection` 元素代表的是一行文字或單字，請使用 `Type` 欄位。

 

每個 `TextDetection` 元素都包含百分比值，代表 Amazon Rekognition 對於文字與文字周圍的週框方塊之偵測精確度的可信度。

### 單字和行的關係
<a name="text-ids"></a>

每個 `TextDetection` 元素都有一個辨識碼欄位，`Id`。`Id` 會顯示單字在行中的位置。如果元素是一個單字，父系識別碼欄位 `ParentId` 將找出偵測到該單字的行。行的 `ParentId` 為 null。例如，範例映像中的「but keep」文字行具有下列 `Id` 和 `ParentId` 值：


|  文字  |  ID  |  父系 ID  | 
| --- | --- | --- | 
|  但保留  |  3  |     | 
|  但  |  8  |  3  | 
|  保留  |  9  |  3  | 

### 文字在映像中的位置
<a name="text-location"></a>

若要判定辨識到的文字在映像中的位置，請使用 `DetectText` 傳回的週框方塊 ([幾何圖形](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_Geometry.html)) 資訊。`Geometry` 物件包含用於偵測到的行和單字之兩種類型的週框方塊資訊：
+ 在 [BoundingBox](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_BoundingBox.html) 物件中的對齊軸粗略矩形外框
+ 在[點](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_Point.html)陣列中由多個 X 與 Y 座標組成的精密多邊形

週框方塊與多邊形座標將顯示文字在映像中所在的位置。座標值為整體映像大小的比例。如需詳細資訊，請參閱 [BoundingBox](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_BoundingBox.html)。

下列來自 `DetectText` 操作的 JSON 回應將顯示在下列映像中偵測到的單字與行。

![\[在文字旁邊微笑咖啡杯，該文字顯示「是星期一，但保持微笑」在磚塊背景上，帶有文字週框方塊。\]](http://docs.aws.amazon.com/zh_tw/rekognition/latest/dg/images/text.png)


```
{
 'TextDetections': [{'Confidence': 99.35693359375,
                     'DetectedText': "IT'S",
                     'Geometry': {'BoundingBox': {'Height': 0.09988046437501907,
                                                  'Left': 0.6684935688972473,
                                                  'Top': 0.18226495385169983,
                                                  'Width': 0.1461552083492279},
                                  'Polygon': [{'X': 0.6684935688972473,
                                               'Y': 0.1838926374912262},
                                              {'X': 0.8141663074493408,
                                               'Y': 0.18226495385169983},
                                              {'X': 0.8146487474441528,
                                               'Y': 0.28051772713661194},
                                              {'X': 0.6689760088920593,
                                               'Y': 0.2821454107761383}]},
                     'Id': 0,
                     'Type': 'LINE'},
                    {'Confidence': 99.6207275390625,
                     'DetectedText': 'MONDAY',
                     'Geometry': {'BoundingBox': {'Height': 0.11442459374666214,
                                                  'Left': 0.5566731691360474,
                                                  'Top': 0.3525116443634033,
                                                  'Width': 0.39574965834617615},
                                  'Polygon': [{'X': 0.5566731691360474,
                                               'Y': 0.353712260723114},
                                              {'X': 0.9522717595100403,
                                               'Y': 0.3525116443634033},
                                              {'X': 0.9524227976799011,
                                               'Y': 0.4657355844974518},
                                              {'X': 0.5568241477012634,
                                               'Y': 0.46693623065948486}]},
                     'Id': 1,
                     'Type': 'LINE'},
                    {'Confidence': 99.6160888671875,
                     'DetectedText': 'but keep',
                     'Geometry': {'BoundingBox': {'Height': 0.08314694464206696,
                                                  'Left': 0.6398131847381592,
                                                  'Top': 0.5267938375473022,
                                                  'Width': 0.2021435648202896},
                                  'Polygon': [{'X': 0.640289306640625,
                                               'Y': 0.5267938375473022},
                                              {'X': 0.8419567942619324,
                                               'Y': 0.5295097827911377},
                                              {'X': 0.8414806723594666,
                                               'Y': 0.609940767288208},
                                              {'X': 0.6398131847381592,
                                               'Y': 0.6072247624397278}]},
                     'Id': 2,
                     'Type': 'LINE'},
                    {'Confidence': 88.95134735107422,
                     'DetectedText': 'Smiling',
                     'Geometry': {'BoundingBox': {'Height': 0.4326171875,
                                                  'Left': 0.46289217472076416,
                                                  'Top': 0.5634765625,
                                                  'Width': 0.5371078252792358},
                                  'Polygon': [{'X': 0.46289217472076416,
                                               'Y': 0.5634765625},
                                              {'X': 1.0, 'Y': 0.5634765625},
                                              {'X': 1.0, 'Y': 0.99609375},
                                              {'X': 0.46289217472076416,
                                               'Y': 0.99609375}]},
                     'Id': 3,
                     'Type': 'LINE'},
                    {'Confidence': 99.35693359375,
                     'DetectedText': "IT'S",
                     'Geometry': {'BoundingBox': {'Height': 0.09988046437501907,
                                                  'Left': 0.6684935688972473,
                                                  'Top': 0.18226495385169983,
                                                  'Width': 0.1461552083492279},
                                  'Polygon': [{'X': 0.6684935688972473,
                                               'Y': 0.1838926374912262},
                                              {'X': 0.8141663074493408,
                                               'Y': 0.18226495385169983},
                                              {'X': 0.8146487474441528,
                                               'Y': 0.28051772713661194},
                                              {'X': 0.6689760088920593,
                                               'Y': 0.2821454107761383}]},
                     'Id': 4,
                     'ParentId': 0,
                     'Type': 'WORD'},
                    {'Confidence': 99.6207275390625,
                     'DetectedText': 'MONDAY',
                     'Geometry': {'BoundingBox': {'Height': 0.11442466825246811,
                                                  'Left': 0.5566731691360474,
                                                  'Top': 0.35251158475875854,
                                                  'Width': 0.39574965834617615},
                                  'Polygon': [{'X': 0.5566731691360474,
                                               'Y': 0.3537122905254364},
                                              {'X': 0.9522718787193298,
                                               'Y': 0.35251158475875854},
                                              {'X': 0.9524227976799011,
                                               'Y': 0.4657355546951294},
                                              {'X': 0.5568241477012634,
                                               'Y': 0.46693626046180725}]},
                     'Id': 5,
                     'ParentId': 1,
                     'Type': 'WORD'},
                    {'Confidence': 99.96778869628906,
                     'DetectedText': 'but',
                     'Geometry': {'BoundingBox': {'Height': 0.0625,
                                                  'Left': 0.6402802467346191,
                                                  'Top': 0.5283203125,
                                                  'Width': 0.08027780801057816},
                                  'Polygon': [{'X': 0.6402802467346191,
                                               'Y': 0.5283203125},
                                              {'X': 0.7205580472946167,
                                               'Y': 0.5283203125},
                                              {'X': 0.7205580472946167,
                                               'Y': 0.5908203125},
                                              {'X': 0.6402802467346191,
                                               'Y': 0.5908203125}]},
                     'Id': 6,
                     'ParentId': 2,
                     'Type': 'WORD'},
                    {'Confidence': 99.26438903808594,
                     'DetectedText': 'keep',
                     'Geometry': {'BoundingBox': {'Height': 0.0818721204996109,
                                                  'Left': 0.7344760298728943,
                                                  'Top': 0.5280686020851135,
                                                  'Width': 0.10748066753149033},
                                  'Polygon': [{'X': 0.7349520921707153,
                                               'Y': 0.5280686020851135},
                                              {'X': 0.8419566750526428,
                                               'Y': 0.5295097827911377},
                                              {'X': 0.8414806127548218,
                                               'Y': 0.6099407076835632},
                                              {'X': 0.7344760298728943,
                                               'Y': 0.6084995269775391}]},
                     'Id': 7,
                     'ParentId': 2,
                     'Type': 'WORD'},
                    {'Confidence': 88.95134735107422,
                     'DetectedText': 'Smiling',
                     'Geometry': {'BoundingBox': {'Height': 0.4326171875,
                                                  'Left': 0.46289217472076416,
                                                  'Top': 0.5634765625,
                                                  'Width': 0.5371078252792358},
                                  'Polygon': [{'X': 0.46289217472076416,
                                               'Y': 0.5634765625},
                                              {'X': 1.0, 'Y': 0.5634765625},
                                              {'X': 1.0, 'Y': 0.99609375},
                                              {'X': 0.46289217472076416,
                                               'Y': 0.99609375}]},
                     'Id': 8,
                     'ParentId': 3,
                     'Type': 'WORD'}],
 'TextModelVersion': '3.0'}
```

# 偵測已儲存影片中的文字
<a name="text-detecting-video-procedure"></a>

Amazon Rekognition Video 已儲存影片中的文字偵測是一項非同步操作。要開始偵測文字，請呼叫 [StartTextDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartTextDetection.html)。Amazon Rekognition Video 會將影片分析的完成状态发布至 Amazon SNS 主题。如果影片分析成功，請呼叫 [GetTextDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetTextDetection.html) 以取得分析結果。如需開始影片分析並取得結果的詳細資訊，請參閱 [呼叫 Amazon Rekognition Video 操作](api-video.md)。

此程序會在 [使用 Java 或 Python (SDK) 分析儲存於 Amazon S3 儲存貯體中的影片](video-analyzing-with-sqs.md) 中展開程式碼。此程序使用 Amazon SQS 佇列來獲取影片分析要求的完成狀態。

**偵測存放於 Amazon S3 儲存貯體 (SDK) 之影片中的文字**

1. 請執行 [使用 Java 或 Python (SDK) 分析儲存於 Amazon S3 儲存貯體中的影片](video-analyzing-with-sqs.md) 中的步驟。

1. 將下列程式碼加入至步驟 1 中的類別 `VideoDetect`。

------
#### [ Java ]

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   
   private static void StartTextDetection(String bucket, String video) throws Exception{
              
       NotificationChannel channel= new NotificationChannel()
               .withSNSTopicArn(snsTopicArn)
               .withRoleArn(roleArn);
       
       StartTextDetectionRequest req = new StartTextDetectionRequest()
               .withVideo(new Video()
                       .withS3Object(new S3Object()
                           .withBucket(bucket)
                           .withName(video)))
               .withNotificationChannel(channel);
       
       
       StartTextDetectionResult startTextDetectionResult = rek.startTextDetection(req);
       startJobId=startTextDetectionResult.getJobId();
       
   } 
   
   private static void GetTextDetectionResults() throws Exception{
       
       int maxResults=10;
       String paginationToken=null;
       GetTextDetectionResult textDetectionResult=null;
       
       do{
           if (textDetectionResult !=null){
               paginationToken = textDetectionResult.getNextToken();
   
           }
           
       
           textDetectionResult = rek.getTextDetection(new GetTextDetectionRequest()
                .withJobId(startJobId)
                .withNextToken(paginationToken)
                .withMaxResults(maxResults));
       
           VideoMetadata videoMetaData=textDetectionResult.getVideoMetadata();
               
           System.out.println("Format: " + videoMetaData.getFormat());
           System.out.println("Codec: " + videoMetaData.getCodec());
           System.out.println("Duration: " + videoMetaData.getDurationMillis());
           System.out.println("FrameRate: " + videoMetaData.getFrameRate());
               
               
           //Show text, confidence values
           List<TextDetectionResult> textDetections = textDetectionResult.getTextDetections();
   
   
           for (TextDetectionResult text: textDetections) {
               long seconds=text.getTimestamp()/1000;
               System.out.println("Sec: " + Long.toString(seconds) + " ");
               TextDetection detectedText=text.getTextDetection();
               
               System.out.println("Text Detected: " + detectedText.getDetectedText());
                   System.out.println("Confidence: " + detectedText.getConfidence().toString());
                   System.out.println("Id : " + detectedText.getId());
                   System.out.println("Parent Id: " + detectedText.getParentId());
                   System.out.println("Bounding Box" + detectedText.getGeometry().getBoundingBox().toString());
                   System.out.println("Type: " + detectedText.getType());
                   System.out.println();
           }
       } while (textDetectionResult !=null && textDetectionResult.getNextToken() != null);
         
           
   }
   ```

   在函數 `main` 中，將下行: 

   ```
           StartLabelDetection(amzn-s3-demo-bucket, video);
   
           if (GetSQSMessageSuccess()==true)
           	GetLabelDetectionResults();
   ```

   取代為：

   ```
           StartTextDetection(amzn-s3-demo-bucket, video);
   
           if (GetSQSMessageSuccess()==true)
           	GetTextDetectionResults();
   ```

------
#### [ Java V2 ]

   此程式碼取自 AWS 文件開發套件範例 GitHub 儲存庫。請參閱[此處](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/rekognition/src/main/java/com/example/rekognition/VideoDetectText.java)的完整範例。

   ```
   //snippet-start:[rekognition.java2.recognize_video_text.import]
   import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.rekognition.RekognitionClient;
   import software.amazon.awssdk.services.rekognition.model.S3Object;
   import software.amazon.awssdk.services.rekognition.model.NotificationChannel;
   import software.amazon.awssdk.services.rekognition.model.Video;
   import software.amazon.awssdk.services.rekognition.model.StartTextDetectionRequest;
   import software.amazon.awssdk.services.rekognition.model.StartTextDetectionResponse;
   import software.amazon.awssdk.services.rekognition.model.RekognitionException;
   import software.amazon.awssdk.services.rekognition.model.GetTextDetectionResponse;
   import software.amazon.awssdk.services.rekognition.model.GetTextDetectionRequest;
   import software.amazon.awssdk.services.rekognition.model.VideoMetadata;
   import software.amazon.awssdk.services.rekognition.model.TextDetectionResult;
   import java.util.List;
   //snippet-end:[rekognition.java2.recognize_video_text.import]
   
   /**
   * Before running this Java V2 code example, set up your development environment, including your credentials.
   *
   * For more information, see the following documentation topic:
   *
   * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
   */
   public class DetectTextVideo {
   
    private static String startJobId ="";
    public static void main(String[] args) {
   
        final String usage = "\n" +
            "Usage: " +
            "   <bucket> <video> <topicArn> <roleArn>\n\n" +
            "Where:\n" +
            "   bucket - The name of the bucket in which the video is located (for example, (for example, amzn-s3-demo-bucket). \n\n"+
            "   video - The name of video (for example, people.mp4). \n\n" +
            "   topicArn - The ARN of the Amazon Simple Notification Service (Amazon SNS) topic. \n\n" +
            "   roleArn - The ARN of the AWS Identity and Access Management (IAM) role to use. \n\n" ;
   
        if (args.length != 4) {
            System.out.println(usage);
            System.exit(1);
        }
   
        String bucket = args[0];
        String video = args[1];
        String topicArn = args[2];
        String roleArn = args[3];
   
        Region region = Region.US_EAST_1;
        RekognitionClient rekClient = RekognitionClient.builder()
            .region(region)
            .credentialsProvider(ProfileCredentialsProvider.create("profile-name"))
            .build();
   
        NotificationChannel channel = NotificationChannel.builder()
            .snsTopicArn(topicArn)
            .roleArn(roleArn)
            .build();
   
        startTextLabels(rekClient, channel, bucket, video);
        GetTextResults(rekClient);
        System.out.println("This example is done!");
        rekClient.close();
    }
   
    // snippet-start:[rekognition.java2.recognize_video_text.main]
    public static void startTextLabels(RekognitionClient rekClient,
                                   NotificationChannel channel,
                                   String bucket,
                                   String video) {
        try {
            S3Object s3Obj = S3Object.builder()
                .bucket(bucket)
                .name(video)
                .build();
   
            Video vidOb = Video.builder()
                .s3Object(s3Obj)
                .build();
   
            StartTextDetectionRequest labelDetectionRequest = StartTextDetectionRequest.builder()
                .jobTag("DetectingLabels")
                .notificationChannel(channel)
                .video(vidOb)
                .build();
   
            StartTextDetectionResponse labelDetectionResponse = rekClient.startTextDetection(labelDetectionRequest);
            startJobId = labelDetectionResponse.jobId();
   
        } catch (RekognitionException e) {
            System.out.println(e.getMessage());
            System.exit(1);
        }
    }
   
    public static void GetTextResults(RekognitionClient rekClient) {
   
        try {
            String paginationToken=null;
            GetTextDetectionResponse textDetectionResponse=null;
            boolean finished = false;
            String status;
            int yy=0 ;
   
            do{
                if (textDetectionResponse !=null)
                    paginationToken = textDetectionResponse.nextToken();
   
                GetTextDetectionRequest recognitionRequest = GetTextDetectionRequest.builder()
                    .jobId(startJobId)
                    .nextToken(paginationToken)
                    .maxResults(10)
                    .build();
   
                // Wait until the job succeeds.
                while (!finished) {
                    textDetectionResponse = rekClient.getTextDetection(recognitionRequest);
                    status = textDetectionResponse.jobStatusAsString();
   
                    if (status.compareTo("SUCCEEDED") == 0)
                        finished = true;
                    else {
                        System.out.println(yy + " status is: " + status);
                        Thread.sleep(1000);
                    }
                    yy++;
                }
   
                finished = false;
   
                // Proceed when the job is done - otherwise VideoMetadata is null.
                VideoMetadata videoMetaData=textDetectionResponse.videoMetadata();
                System.out.println("Format: " + videoMetaData.format());
                System.out.println("Codec: " + videoMetaData.codec());
                System.out.println("Duration: " + videoMetaData.durationMillis());
                System.out.println("FrameRate: " + videoMetaData.frameRate());
                System.out.println("Job");
   
                List<TextDetectionResult> labels= textDetectionResponse.textDetections();
                for (TextDetectionResult detectedText: labels) {
                    System.out.println("Confidence: " + detectedText.textDetection().confidence().toString());
                    System.out.println("Id : " + detectedText.textDetection().id());
                    System.out.println("Parent Id: " + detectedText.textDetection().parentId());
                    System.out.println("Type: " + detectedText.textDetection().type());
                    System.out.println("Text: " + detectedText.textDetection().detectedText());
                    System.out.println();
                }
   
            } while (textDetectionResponse !=null && textDetectionResponse.nextToken() != null);
   
        } catch(RekognitionException | InterruptedException e) {
            System.out.println(e.getMessage());
            System.exit(1);
        }
    }
    // snippet-end:[rekognition.java2.recognize_video_text.main]
   }
   ```

------
#### [ Python ]

   ```
   #Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   #PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
       def StartTextDetection(self):
           response=self.rek.start_text_detection(Video={'S3Object': {'Bucket': self.bucket, 'Name': self.video}},
               NotificationChannel={'RoleArn': self.roleArn, 'SNSTopicArn': self.snsTopicArn})
   
           self.startJobId=response['JobId']
           print('Start Job Id: ' + self.startJobId)
     
       def GetTextDetectionResults(self):
           maxResults = 10
           paginationToken = ''
           finished = False
   
           while finished == False:
               response = self.rek.get_text_detection(JobId=self.startJobId,
                                               MaxResults=maxResults,
                                               NextToken=paginationToken)
   
               print('Codec: ' + response['VideoMetadata']['Codec'])
               
               print('Duration: ' + str(response['VideoMetadata']['DurationMillis']))
               print('Format: ' + response['VideoMetadata']['Format'])
               print('Frame rate: ' + str(response['VideoMetadata']['FrameRate']))
               print()
   
               for textDetection in response['TextDetections']:
                   text=textDetection['TextDetection']
   
                   print("Timestamp: " + str(textDetection['Timestamp']))
                   print("   Text Detected: " + text['DetectedText'])
                   print("   Confidence: " +  str(text['Confidence']))
                   print ("      Bounding box")
                   print ("        Top: " + str(text['Geometry']['BoundingBox']['Top']))
                   print ("        Left: " + str(text['Geometry']['BoundingBox']['Left']))
                   print ("        Width: " +  str(text['Geometry']['BoundingBox']['Width']))
                   print ("        Height: " +  str(text['Geometry']['BoundingBox']['Height']))
                   print ("   Type: " + str(text['Type']) )
                   print()
   
               if 'NextToken' in response:
                   paginationToken = response['NextToken']
               else:
                   finished = True
   ```

   在函數 `main` 中，將下行:

   ```
       analyzer.StartLabelDetection()
       if analyzer.GetSQSMessageSuccess()==True:
           analyzer.GetLabelDetectionResults()
   ```

   取代為：

   ```
       analyzer.StartTextDetection()
       if analyzer.GetSQSMessageSuccess()==True:
           analyzer.GetTextDetectionResults()
   ```

------
#### [ CLI ]

   執行下列 AWS CLI 命令，開始偵測影片中的文字。

   ```
    aws rekognition start-text-detection --video "{"S3Object":{"Bucket":"amzn-s3-demo-bucket","Name":"video-name"}}"\
    --notification-channel "{"SNSTopicArn":"topic-arn","RoleArn":"role-arn"}" \
    --region region-name --profile profile-name
   ```

   更新下列的值：
   + 將 `amzn-s3-demo-bucket` 與 `video-name` 變更為您在步驟 2 中指定的 Amazon S3 儲存貯體與文檔名稱。
   + 將 `region-name` 變更為您正在使用的 AWS 區域。
   + 使用您開發人員設定檔的名稱取代 `profile-name` 的值。
   + 將 `topic-ARN` 變更為您在 [設定 Amazon Rekognition Video](api-video-roles.md) 步驟 3 建立的 Amazon SNS 主題 ARN。
   + 將 `role-ARN` 變更為您在步驟 7 建立的 [設定 Amazon Rekognition Video](api-video-roles.md) IAM 服務角色的 ARN。

   如果您在 Windows 裝置上存取 CLI，請使用雙引號而非單引號，並以反斜線 (即\$1) 替代內部雙引號，以解決您可能遇到的任何剖析器錯誤。如需範例，請參閱下列內容：

   ```
   aws rekognition start-text-detection --video \
    "{\"S3Object\":{\"Bucket\":\"amzn-s3-demo-bucket\",\"Name\":\"video-name\"}}" \
    --notification-channel "{\"SNSTopicArn\":\"topic-arn\",\"RoleArn\":\"role-arn\"}" \
    --region region-name --profile profile-name
   ```

   執行正在進行的程式碼範例之後，複製傳回的程式碼 `jobID`，並將其提供給下列 `GetTextDetection` 命令，以 `job-id-number` 取代您之前收到的 `jobID` 結果：

   ```
   aws rekognition get-text-detection --job-id job-id-number --profile profile-name             
   ```

------
**注意**  
如果您已執行 [使用 Java 或 Python (SDK) 分析儲存於 Amazon S3 儲存貯體中的影片](video-analyzing-with-sqs.md) 以外的影片範例，要取代的程式碼可能會不同。

1. 執行程式碼。在影片中偵測到的文字會顯示在清單中。

## 篩選條件
<a name="text-detection-filters"></a>

篩選器是可選的要求參數，當您呼叫 `StartTextDetection` 時，會使用此篩選器。按文字區域、大小和可信度分數進行篩選可為您提供更大的靈活性來控製文字偵測輸出。透過感興趣的區域，您可以輕鬆地將文字偵測限制在與您相關的區域，例如，圖形的底部第三區域或足球遊戲中讀取記分牌的左上角。文字週框方塊大小篩選器可用於避免產生嘈雜或無關緊要的小背景文字。最後，文字可信度篩選器讓您可以消除因朦朧或模糊而導致的不可靠結果。

如需篩選器值的相關資訊，請參閱 `[DetectTextFilters](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectTextFilters.html)`。

您可以使用下列篩選器：
+ **MinConfidence**：設定文字偵測的可信度。可信度低於此等級的文字會從結果中排除。值應該介於 0 和 100 之間。
+ **MinBoundingBoxWidth**：設定文字週框方塊的最小寬度。週邊方塊小於此值的文字會從結果中排除。此值相對於影片影格寬度。
+ **MinBoundingBoxHeight**：設定文字週邊方塊的最小高度。週邊方塊高度小於此值的文字會從結果中排除。此值相對於影片影格高度。
+ **RegionsOfInterest**：將偵測限制為影格的特定區域。這些值是對於影格尺寸。對於僅部分區域內的物件，回應是未定義的。

## GetTextDetection 回應
<a name="text-detecting-video-response"></a>

`GetTextDetection` 會傳回陣列 (`TextDetectionResults`)，其中包含影片中偵測到之文字的相關資訊。每當 [TextDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_TextDetection.html) 在視訊中偵測到文字或文字行時，就會有一個陣列元素。陣列元素會從影片開頭起依時間 (以毫秒為單位) 排序。

以下是 `GetTextDetection` 的部分 JSON 回應。在回應中，請注意下列事項：
+ **文字資訊**：`TextDetectionResult` 陣列元素包含偵測到之文字的資訊 ([TextDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_TextDetection.html))，以及在影片中偵測到文字的時間 (`Timestamp`)。
+ **分頁資訊**：該範例顯示一頁文字偵測資訊。您可以在 `GetTextDetection` 的 `MaxResults` 輸入參數中指定要傳回的文字元素數目。如果結果數目超過 `MaxResults`，或結果數目超過預設最大值，`GetTextDetection` 會傳回用來取得下一頁結果的字符 (`NextToken`)。如需詳細資訊，請參閱 [取得 Amazon Rekognition Video 分析結果](api-video.md#api-video-get)。
+ **影片資訊**：回應包含 `VideoMetadata` 所傳回之每頁資訊中影片格式 (`GetTextDetection`) 的相關資訊。

```
{
    "JobStatus": "SUCCEEDED",
    "VideoMetadata": {
        "Codec": "h264",
        "DurationMillis": 174441,
        "Format": "QuickTime / MOV",
        "FrameRate": 29.970029830932617,
        "FrameHeight": 480,
        "FrameWidth": 854
    },
    "TextDetections": [
        {
            "Timestamp": 967,
            "TextDetection": {
                "DetectedText": "Twinkle Twinkle Little Star",
                "Type": "LINE",
                "Id": 0,
                "Confidence": 99.91780090332031,
                "Geometry": {
                    "BoundingBox": {
                        "Width": 0.8337579369544983,
                        "Height": 0.08365312218666077,
                        "Left": 0.08313830941915512,
                        "Top": 0.4663468301296234
                    },
                    "Polygon": [
                        {
                            "X": 0.08313830941915512,
                            "Y": 0.4663468301296234
                        },
                        {
                            "X": 0.9168962240219116,
                            "Y": 0.4674469828605652
                        },
                        {
                            "X": 0.916861355304718,
                            "Y": 0.5511001348495483
                        },
                        {
                            "X": 0.08310343325138092,
                            "Y": 0.5499999523162842
                        }
                    ]
                }
            }
        },
        {
            "Timestamp": 967,
            "TextDetection": {
                "DetectedText": "Twinkle",
                "Type": "WORD",
                "Id": 1,
                "ParentId": 0,
                "Confidence": 99.98338317871094,
                "Geometry": {
                    "BoundingBox": {
                        "Width": 0.2423887550830841,
                        "Height": 0.0833333358168602,
                        "Left": 0.08313817530870438,
                        "Top": 0.46666666865348816
                    },
                    "Polygon": [
                        {
                            "X": 0.08313817530870438,
                            "Y": 0.46666666865348816
                        },
                        {
                            "X": 0.3255269229412079,
                            "Y": 0.46666666865348816
                        },
                        {
                            "X": 0.3255269229412079,
                            "Y": 0.550000011920929
                        },
                        {
                            "X": 0.08313817530870438,
                            "Y": 0.550000011920929
                        }
                    ]
                }
            }
        },
        {
            "Timestamp": 967,
            "TextDetection": {
                "DetectedText": "Twinkle",
                "Type": "WORD",
                "Id": 2,
                "ParentId": 0,
                "Confidence": 99.982666015625,
                "Geometry": {
                    "BoundingBox": {
                        "Width": 0.2423887550830841,
                        "Height": 0.08124999701976776,
                        "Left": 0.3454332649707794,
                        "Top": 0.46875
                    },
                    "Polygon": [
                        {
                            "X": 0.3454332649707794,
                            "Y": 0.46875
                        },
                        {
                            "X": 0.5878220200538635,
                            "Y": 0.46875
                        },
                        {
                            "X": 0.5878220200538635,
                            "Y": 0.550000011920929
                        },
                        {
                            "X": 0.3454332649707794,
                            "Y": 0.550000011920929
                        }
                    ]
                }
            }
        },
        {
            "Timestamp": 967,
            "TextDetection": {
                "DetectedText": "Little",
                "Type": "WORD",
                "Id": 3,
                "ParentId": 0,
                "Confidence": 99.8787612915039,
                "Geometry": {
                    "BoundingBox": {
                        "Width": 0.16627635061740875,
                        "Height": 0.08124999701976776,
                        "Left": 0.6053864359855652,
                        "Top": 0.46875
                    },
                    "Polygon": [
                        {
                            "X": 0.6053864359855652,
                            "Y": 0.46875
                        },
                        {
                            "X": 0.7716627717018127,
                            "Y": 0.46875
                        },
                        {
                            "X": 0.7716627717018127,
                            "Y": 0.550000011920929
                        },
                        {
                            "X": 0.6053864359855652,
                            "Y": 0.550000011920929
                        }
                    ]
                }
            }
        },
        {
            "Timestamp": 967,
            "TextDetection": {
                "DetectedText": "Star",
                "Type": "WORD",
                "Id": 4,
                "ParentId": 0,
                "Confidence": 99.82640075683594,
                "Geometry": {
                    "BoundingBox": {
                        "Width": 0.12997658550739288,
                        "Height": 0.08124999701976776,
                        "Left": 0.7868852615356445,
                        "Top": 0.46875
                    },
                    "Polygon": [
                        {
                            "X": 0.7868852615356445,
                            "Y": 0.46875
                        },
                        {
                            "X": 0.9168618321418762,
                            "Y": 0.46875
                        },
                        {
                            "X": 0.9168618321418762,
                            "Y": 0.550000011920929
                        },
                        {
                            "X": 0.7868852615356445,
                            "Y": 0.550000011920929
                        }
                    ]
                }
            }
        }
    ],
    "NextToken": "NiHpGbZFnkM/S8kLcukMni15wb05iKtquu/Mwc+Qg1LVlMjjKNOD0Z0GusSPg7TONLe+OZ3P",
    "TextModelVersion": "3.0"
}
```