You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于OpenCV透明模板匹配识别游戏VOD关键时间戳

游戏直播VOD关键时间戳识别问题

我想自动识别游戏直播VOD中的关键时间戳,比如:

  • 游戏结束时屏幕上出现的“GAME” overlay(该元素中间的白色条纹会随时间缩小,但轮廓保持一致)
  • 开场时出现“GO!”的画面

我已经制作了包含轮廓等类型的匹配模板,参考相关资料后,用以下代码遍历所有OpenCV匹配方法,以及0.01到0.99的阈值做测试:

import cv2
import numpy as np

test_img = cv2.imread(test_path, cv2.IMREAD_UNCHANGED)
template_img = cv2.imread(template.template_path, cv2.IMREAD_UNCHANGED)
result = cv2.matchTemplate(test_img, template_img, method, None, template_img)
locations = np.where (result <= threshold)
locations = list(zip(*locations[::-1]))

if 0 < len(locations) < 2000:
    print("method: ", method, "threshold:", threshold, "image:", i, "locations:", len(locations))

现在我遇到了困惑:不确定是否需要手动计算alpha通道,还是对mask的整体用法存在严重误解——有部分在线回答说可以直接用模板自身作为image_mask,但实际测试没有得到预期效果。

内容的提问来源于stack exchange,提问作者mrshllstock

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 14:20:57