百度OCR体验地址:
https://ai.baidu.com/tech/imagerecognition/general
腾讯OCR体验地址:
https://cloud.tencent.com/act/event/ocrdemo
测试结果是:腾讯的效果要比百度的好
腾讯云目前额度是:
每个接口 1,000次/月免费,有6个文字识别的接口,一共是6,000次/月
百度接口调用之前写过文章
python实现百度OCR图片识别过程解析
使用步骤
1、注册账号: https://cloud.tencent.com/
2、开通服务:https://console.cloud.tencent.com/ocr/general
3、申请访问秘钥:https://console.cloud.tencent.com/cam/capi
4、通过 API 或 SDK 或命令行来使用服务
具体参考《操作指南》:https://cloud.tencent.com/document/product/866/17622
接口使用
1、安装SDK
https://github.com/TencentCloud/tencentcloud-sdk-python
pip3 install tencentcloud-sdk-python
2、代码实例
# -*- coding: utf-8 -*- import json from tencentcloud.common import credential from tencentcloud.common.profile.client_profile import ClientProfile from tencentcloud.common.profile.http_profile import HttpProfile from tencentcloud.ocr.v20181119 import ocr_client from tencentcloud.ocr.v20181119.models import ( GeneralAccurateOCRRequest, EnglishOCRRequest, GeneralBasicOCRRequest, GeneralEfficientOCRRequest, GeneralFastOCRRequest, GeneralHandwritingOCRRequest ) class TencentOcr(object): """ 计费说明:1,000次/月免费 https://cloud.tencent.com/document/product/866/17619 """ SECRET_ID = "你的秘钥 SECRET_ID" SECRET_KEY = "你的秘钥 SECRET_KEY" # 地域列表 # https://cloud.tencent.com/document/api/866/33518#.E5.9C.B0.E5.9F.9F.E5.88.97.E8.A1.A8 Region = "ap-beijing" endpoint = "ocr.tencentcloudapi.com" # 通用文字识别相关接口 # https://cloud.tencent.com/document/api/866/37173 mapping = { # 通用印刷体识别(高精度版) ok "GeneralAccurateOCR": GeneralAccurateOCRRequest, # 英文识别 ok "EnglishOCR": EnglishOCRRequest, # 通用印刷体识别 一般 "GeneralBasicOCR": GeneralBasicOCRRequest, # 通用印刷体识别(精简版)(免费公测版)no "GeneralEfficientOCR": GeneralEfficientOCRRequest, # 通用印刷体识别(高速版)一般 "GeneralFastOCR": GeneralFastOCRRequest, # 通用手写体识别 ok "GeneralHandwritingOCR": GeneralHandwritingOCRRequest, } def __init__(self): cred = credential.Credential(self.SECRET_ID, self.SECRET_KEY) httpProfile = HttpProfile() httpProfile.endpoint = self.endpoint clientProfile = ClientProfile() clientProfile.httpProfile = httpProfile self.client = ocr_client.OcrClient(cred, self.Region, clientProfile) def get_image_text(self, image_url, ocr="GeneralAccurateOCR"): req = self.mapping[ocr]() req.ImageUrl = image_url resp = getattr(self.client, ocr)(req) return json.loads(resp.to_json_string())['TextDetections'][0]['DetectedText'] def main(): tencentOcr = TencentOcr() url = "https://ocr-demo-1254418846.cos.ap-guangzhou.myqcloud.com/general/GeneralBasicOCR/GeneralBasicOCR3.jpg" print(tencentOcr.get_image_text(url, ocr="GeneralHandwritingOCR")) if __name__ == '__main__': main()
更多关于Python3使用腾讯云文字识别(腾讯OCR)提取图片中的文字内容实例请查看下面的相关链接
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 杨阳《约定HQCDII》头版限量编号2024[WAV+CUE]
- 曝《黑神话:悟空》DLC明年推出 农历新年前后
- PS5日本涨价19% 索尼股价应声上涨2.7%
- 《黑神话》发行平台遭大规模网攻 外媒却鲜有报道
- 伍佰《爱你伍佰年 世纪典藏原音精选3CD》[WAV+CUE][2.3GB]
- 伍佰《爱情的尽头》[WAV+CUE][2.6GB]
- 伍佰 《光环摇滚之声DSD》[WAV+CUE][500MB]
- 王菲.1999-只爱陌生人【EMI百代】【WAV+CUE】
- 林美音.1993-酒后的心声【瑞华】【WAV+CUE】
- 群星.2024-凡人歌电视剧原声带【正午阳光】【FLAC分轨】
- 黑神话悟空上品骨悚然精魄获取方法一览|上品骨悚然精魄收集攻略
- 《演灭Evotinction》正式登陆多平台发售!带你进入科幻潜行新境界
- 命运圣契2024公测最新兑换码大全 命运圣契开服可用兑换码汇总
- 银霞.1979-《回答·兰花草》新加坡限量复黑版[WAV+CUE]
- 王菲.1996-《乐乐精逊SACD日本限量版[WAV+CUE]