在没有opencv的python上显示视频? [英] display video on python without opencv?

查看:46
本文介绍了在没有opencv的python上显示视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用openCv进行视频处理.我要做的是逐帧读取视频,然后对每个帧进行一些处理,然后显示新的修改后的帧.我的代码如下:

I am using openCv for making video processing. What I do is reading a video frame by frame, then applying some processing on each frame and then displaying the new modified frame. My code looks like that :

video_capture = cv2.VideoCapture('video.mp4')


while True:
# Capture frame-by-frame
  ret, frame = video_capture.read()

# Applying some processing to frame
                 .
                 .
                 .
# Displaying the new frame with processing
  img=cv2.imshow('title', frame)

  if cv2.waitKey(1) & 0xFF == ord('q'):
      break

这样,我可以立即显示已处理的视频.问题是显示由于等待键"的存在而大大滞后.除了使用cv2之外,还有其他方法可以实时显示图像以形成视频吗?

This way I can display instantaneously the processed video. The problem is the display is lagging much due to the presence of the 'waitkey'. Is there another way for display images in real time to form a video, but with another module than cv2?

谢谢

推荐答案

一个选项是Tkinter,您可以找到一些信息

One option is Tkinter, you can find some information here. Along with Tkinter, it uses python-gstreamer and python-gobject. It is much more complicated to set up, however it allows for more customization options.

这篇关于在没有opencv的python上显示视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆