停车标志读取器
城市规划人员拥有由卡车摄像头拍摄的数百万张图像。由于城市并未保存这些数据的记录,若能提取出停车规定,将对规划工作非常有价值。
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)