检测视频中的运动 - DetectMotion
函数简介
检测视频中的运动。
接口名称
DetectMotion
DLL调用
int64_t DetectMotion(int64_t instance, string videoPath, double threshold);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoPath | 字符串 | 视频文件路径 |
| threshold | 双精度浮点数 | 运动检测阈值(建议值:30.0) |
示例
int64_t jsonPtr = DetectMotion(instance, "test.mp4", 30.0);
if (jsonPtr != 0) {
printf("运动帧索引: %s\n", (char*)jsonPtr);
FreeStringPtr(instance, jsonPtr);
}
返回值
字符串指针,包含运动的帧索引的 JSON 数组字符串,格式:[10, 25, 67, ...],失败返回 0。
返回的字符串指针需要调用 FreeStringPtr 释放内存。
