添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

百度OCR体验地址:

https://ai.baidu.com/tech/imagerecognition/general


腾讯OCR体验地址:

https://cloud.tencent.com/act/event/ocrdemo


测试结果是:腾讯的效果要比百度的好


腾讯云目前(2020年2月16日)额度是:

每个接口 1,000次/月免费,有6个文字识别的接口,一共是6,000次/月


百度接口调用之前写过文章


Python编程:通过百度文字识别提取表格数据


使用步骤

步骤:

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()


SpringCloud微服务实战——搭建企业级开发框架(二十九):集成对象存储服务MinIO+七牛云+阿里云+腾讯云
微服务应用中图片、文件等存储区别于单体应用,单体应用可以放到本地读写磁盘文件,微服务应用必需用到分布式存储,将图片、文件等存储到服务稳定的分布式存储服务器。目前,很多云服务商提供了存储的云服务,比如阿里云OSS、腾讯云COS、七牛云对象存储Kodo、百度云对象存储BOS等等、还有开源对象存储服务器,比如FastDFS、MinIO等。
超级快速使用阿里云OSS或腾讯COS及七牛云Koa获取、放置、删除对象 Supper quick use Aliyun OSS or Tencent COS or Qiniu Koa to get、put、delete Object.