主题
快速识别数字 - FastNumberOcrFromPtr
函数简介
快速识别指定图片中的数字,使用预定义的数字图片模板进行匹配识别。
接口名称
FastNumberOcrFromPtrDLL调用
int FastNumberOcrFromPtr(long instance, long source, string numbers, string colorJson, double matchVal);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| source | 长整数型 | 源图片对象的指针。 |
| numbers | 字符串 | 0~9数字图片地址,多个数字用 `。 |
| colorJson | 字符串 | 颜色模型配置字符串,用于限定图像匹配中的颜色范围,格式说明见 颜色模型说明 - ColorModel。JSON格式示例:[{"StartColor":"3278FA","EndColor":"6496FF","Type":0}];简化格式示例:`3278FA-000000。 |
| matchVal | 双精度浮点数 | 识别率阈值,范围 0.0-1.0。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9);csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9);cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9)text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.FastNumberOcrFromPtr(0, “value”, “value”, 0.9)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ret = ola.FastNumberOcrFromPtr(0, "value", "value", 0.9);原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
FastNumberOcrFromPtr(instance, 0, "value", "value", 0.9);csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FastNumberOcrFromPtr(long ola, long source, string numbers, string colorJson, int matchVal);
long instance = CreateCOLAPlugInterFace();
FastNumberOcrFromPtr(instance, 0, "value", "value", 0.9);python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.FastNumberOcrFromPtr(instance, 0, "value", "value", 0.9)返回值
| 返回值 | 说明 |
|---|---|
| (返回值) | 整数型,返回识别到的数字,识别失败返回 -1。 |
注意事项
| 项目 | 说明 |
|---|---|
| 需要预先准备0-9数字的二值化图片模板 | 需要预先准备0-9数字的二值化图片模板。 |
| 路径 | 数字图片路径用 ` |
| matchVal 参数控制识别精度 | matchVal 参数控制识别精度,值越高要求匹配度越精确。 |
