提取关键帧 - ExtractKeyFrames
函数简介
提取关键帧(基于场景变化检测)。
接口名称
ExtractKeyFrames
DLL调用
int32_t ExtractKeyFrames(int64_t instance, int64_t videoHandle, double threshold,
int32_t maxFrames, string outputDir, string imageFormat)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoHandle | 长整数型 | 视频句柄 |
| threshold | 双精度 | 场景变化阈值(0-1) |
| maxFrames | 整数型 | 最大提取帧数(0表示不限制) |
| outputDir | 字符串 | 输出目录 |
| imageFormat | 字符串 | 图像格式("png"、"jpg"等) |
示例
int64_t instance = CreateCOLAPlugInterFace();
int64_t videoHandle = OpenVideo(instance, "test.mp4");
int32_t count = ExtractKeyFrames(instance, videoHandle, 0.3, 100, "C:/frames", "png");
printf("提取了 %d 个关键帧\n", count);
CloseVideo(instance, videoHandle);
DestroyCOLAPlugInterFace(instance);
返回值
返回提取的关键帧数,失败返回0。
