跳到主要内容
版本:v6.5.0

图像OCR识别

命令说明

对指定图像进行OCR识别,调用时需要访问互联网

命令原型

sText = MicrosoftOCR.ImageOCR(sFileName, sUrl, sApiKey)

命令参数

参数必选类型默认值说明
sFileNameTruepath'''C:\Users'''被识别的图片路径,支持jpeg、png、bmp、pdf、tiff格式,图片大小必须小于50M
sUrlTruestring""请登录Microsoft Azure,在创建的计算机视觉资源中找到Keys and Endpoint,复制Endpoint并填入
sApiKeyTruestring""请从 Microsoft Cognitive Services 上的 Keys and endpoints 中复制 API Key

返回结果

sText,将命令运行后的结果赋值给此变量。

运行实例

/*********************************图像OCR识别*************************************
命令原型:
sText = MicrosoftOCR.ImageOCR(sFileName, sUrl, sApiKey)
入参:
sFileName--识别图片。注:被识别的图片路径,支持jpeg、png、bmp、pdf、tiff格式,图片大小必须小于50M
sUrl--终结点。注:请登录Microsoft Azure,在创建的计算机视觉资源中找到Keys and Endpoint,复制Endpoint并填入
sApiKey--API Key。注:请从 Microsoft Cognitive Services 上的 Keys and endpoints 中复制 API Key
出参:
sText--函数调用的输出保存到的变量。
注意事项:

********************************************************************************/
Dim sText = ""
sText = MicrosoftOCR.ImageOCR('''C:\Users''', "", "")
TracePrint(sText)