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