如何在opencv python中通过单击鼠标按钮在正在播放的视频上绘制形状

2024-05-15 03:30:32 发布

您现在位置:Python中文网/ 问答频道 /正文

好吧,首先,我应该承认这是一个相当长的问题,我没能通过谷歌搜索找到可能的解决方案

我有一段视频,里面有个入侵者试图闯入围栏的另一边。在

enter image description here

我可以跟踪入侵者,但当他在另一边时,我应该能够将入侵持续时间保存到一个文件中。入侵区域应该是这样的

enter image description here

我想这些步骤:

I. Reading a video file;
II. Getting the very first frame displayed,
  1. Pausing the video playback;
  2. Manually drawing intrusion area on that frame with a mouse; (making draw and reset buttons as events maybe)
  3. Replaying the video again
III. Waiting for the intruder to appear, etc. (III part is not important)

到目前为止,我已经完成了I和II(我知道很傻),应该完成步骤II的1、2、3子部分。在

^{pr2}$

我希望你能给你建议和指示!在

PS:参考任何相关帖子、博客或链接,我很高兴找到


Tags: 文件the区域视频video步骤解决方案frame
1条回答
网友
1楼 · 发布于 2024-05-15 03:30:32

添加cv2.waitKey(0)将无限期地暂停while循环!只有在按下任何键后才会恢复。在

我想你要做的是用背景减法来跟踪目标。Refer Here看看它是否符合你的要求。在

编辑:

我猜你想为入侵区域画一个徒手的形状!This Link会指导你去做。我希望这有帮助

相关问题 更多 >

    热门问题