测试代码:
# pip install potencent
import potencent
# 可以填写本地图片的地址:img_path,也可以填写在线图片的地址:img_url
# 如果2个都填,则只用在线图片
res = potencent.ocr.BankCardOCR(
img_path=r'./img/cards/yinhangka.jpg',
img_url='',
configPath=r'./potencent-config.toml')
print(res)
print("\n\n")
res = potencent.ocr.IDCardOCR(
img_path=r'./img/cards/shenfenzheng-test.jpg',
img_url='',
configPath=r'./potencent-config.toml')
print(res)
potencent-config.toml内容:
[tencent-ai]
TENCENTCLOUD_SECRET_ID = ''
TENCENTCLOUD_SECRET_KEY = ''
测试图片:
测试结果: