主题
识别图片排除指定区域 - ExcludePos
函数简介
排除掉指定区域的识别结果,用于颜色识别结果及图像识别结果的过滤。
接口名称
ExcludePosDLL调用
c
long ExcludePos(long ola, char* json, int type, int x1, int y1, int x2, int y2);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| json | 字符串 | 识别返回的结果。 |
| type | 整数型 | 识别类型:1 颜色识别,2 图像识别。 |
| x1 | 整数型 | 排除区域左上角的X坐标。 |
| y1 | 整数型 | 排除区域左上角的Y坐标。 |
| x2 | 整数型 | 排除区域右下角的X坐标。 |
| y2 | 整数型 | 排除区域右下角的Y坐标。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
std::string filtered = ola.ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230);csharp
using OLAPlug;
var ola = new OLAPlugServer();
string filtered = ola.ExcludePos(@"[{"x":100,"y":200,"id":1},{"x":150,"y":220,"id":2},{"x":300,"y":100,"id":3}]", 2, 90, 190, 160, 230);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
filtered = ola.ExcludePos(r'[{"x":100,"y":200,"id":1},{"x":150,"y":220,"id":2},{"x":300,"y":100,"id":3}]', 2, 90, 190, 160, 230)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
String filtered = ola.ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230);cpp
var ola = com("OlaPlug.OlaSoft")
var filtered = ola.ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
filtered = ola.ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230)text
.局部变量 ola, OLAPlug
ola.创建 ()
filtered = ola.ExcludePos (“[{\“x\“:100,\“y\“:200,\“id\“:1},{\“x\“:150,\“y\“:220,\“id\“:2},{\“x\“:300,\“y\“:100,\“id\“:3}]“, 2, 90, 190, 160, 230)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var filtered = ola.ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
文本型 filtered = ola.ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
std::string filtered = ola.ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230);原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
std::string filtered = ExcludePos("[{\"x\":100,\"y\":200,\"id\":1},{\"x\":150,\"y\":220,\"id\":2},{\"x\":300,\"y\":100,\"id\":3}]", 2, 90, 190, 160, 230);csharp
using System.Runtime.InteropServices;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
long instance = CreateCOLAPlugInterFace();
string filtered = ExcludePos(@"[{"x":100,"y":200,"id":1},{"x":150,"y":220,"id":2},{"x":300,"y":100,"id":3}]", 2, 90, 190, 160, 230);python
from ctypes import CDLL, c_int, c_int64
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
filtered = ola.ExcludePos(r'[{"x":100,"y":200,"id":1},{"x":150,"y":220,"id":2},{"x":300,"y":100,"id":3}]', 2, 90, 190, 160, 230)返回值
| 返回值 | 说明 |
|---|---|
| (返回值) | 返回排除掉指定区域后的结果JSON字符串指针。 返回的字符串指针需要调用 FreeStringPtr 释放内存。 |
