開始使用免費開始

停車標誌讀取器

市府規劃師手上有來自垃圾車攝影機的數百萬張影像。由於市府沒有保存這些資料的紀錄,若能知道停車規則,對規劃師會非常有幫助。

Sam 在 boto3 Rekognition 文件中找到了 detect_text()。她打算用它從市府提供的影像中擷取文字。

Sam 已經:

  • 建立了 Rekognition 用戶端。
  • 呼叫了 .detect_text() 並將結果存入 response

請協助 Sam 為市府建立停車規則的資料來源。使用 Rekognition 的 .detect_text() 方法,從停車標誌的影像中擷取各行與各字。

本練習屬於課程

Python 中的 AWS Boto 入門

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Create empty list of words
words = []
# Iterate over the TextDetections in the response dictionary
for text_detection in response['____']:
  	# If TextDetection type is WORD, append it to words list
    if text_detection['____'] == 'WORD':
        # Append the detected text
        words.append(text_detection['____'])
# Print out the words list
print(words)
編輯並執行程式碼