

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 텍스트 감지
<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은 같은 방향으로 정렬된 텍스트에서 줄 여러 개를 감지할 수 있습니다. 문장이 여러 줄에 걸쳐 있는 경우 작업에서 여러 줄을 반환합니다.

다음 이미지를 봐 주세요.

![\[웃는 얼굴이 있는 커피 머그잔과 경계 상자 및 추출된 텍스트로 표시된 ‘It's Monday but keep smiling’ 텍스트.\]](http://docs.aws.amazon.com/ko_kr/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 객체로 제공할 수 있습니다. 이 절차에서는 S3 버킷에 JPEG 또는 PNG 이미지를 업로드하고 파일 이름을 지정합니다.

**이미지(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 설명서 SDK 예제 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 명령은 `detect-text` CLI 작업에 대한 JSON 출력을 표시합니다.

   `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개의 단어를 감지할 수 있습니다. 반환된 텍스트에는 단어를 인식할 수 없도록 만드는 문자가 포함될 수 있습니다. 예를 들어 *Cat* 대신 *C@t*이 반환될 수 있습니다. `TextDetection` 요소가 텍스트 또는 단어로 구성된 줄을 나타내는지 확인하려면 `Type` 필드를 사용합니다.

 

각 `TextDetection` 요소에는 감지된 텍스트와 텍스트를 둘러싼 경계 상자의 정확도에 대한 Amazon Rekognition의 신뢰도를 나타내는 백분율 값이 포함됩니다.

### 단어와 줄의 관계
<a name="text-ids"></a>

각 `TextDetection` 요소에는 식별자 필드 `Id`가 있습니다. `Id`는 줄에서 단어의 위치를 나타냅니다. 요소가 단어인 경우, 상위 식별자 `ParentId`는 단어가 감지되는 줄을 확인해 줍니다. 줄의 `ParentId`는 null입니다. 예를 들어 예제 이미지의 "but keep"이라는 줄에는 `Id` 및 `ParentId` 값이 있습니다.


|  텍스트  |  ID  |  상위 ID  | 
| --- | --- | --- | 
|  but keep  |  3  |     | 
|  but  |  8  |  3  | 
|  Keep  |  9  |  3  | 

### 이미지에서 텍스트의 위치
<a name="text-location"></a>

이미지에서 인식된 텍스트의 위치를 확인하려면 `DetectText`가 반환하는 경계 상자([Geometry](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_Geometry.html)) 정보를 사용합니다. `Geometry` 객체에는 감지된 선과 단어에 대한 두 가지 유형의 경계 상자 정보가 있습니다.
+ [BoundingBox](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_BoundingBox.html) 객체의 축으로 정렬된 거친 직사각형 윤곽
+ [Point](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 응답은 다음 이미지에서 감지된 단어와 줄을 표시합니다.

![\[벽돌을 배경으로 텍스트 경계 상자로 표시된 ‘It's Monday but keep Smiling’이라는 텍스트 옆에 미소 짓는 커피 머그잔.\]](http://docs.aws.amazon.com/ko_kr/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으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](video-analyzing-with-sqs.md)의 코드를 확장하여 Amazon SQS 대기열을 사용해 비디오 분석 요청의 완료 상태를 가져옵니다.

**Amazon S3 버킷에 저장된 비디오에서 텍스트를 감지하려면(SDK)**

1. [Java 또는 Python으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](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 설명서 SDK 예제 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`을 [Amazon Rekognition Video 구성](api-video-roles.md)의 7단계에서 생성한 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으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](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) 단원을 참조하십시오.
+ **비디오 정보** - 응답에는 `GetTextDetection`에서 반환된 정보의 각 페이지에 있는 비디오 형식(`VideoMetadata`)에 관한 정보가 포함되어 있습니다.

```
{
    "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"
}
```