gpt4 book ai didi

python - 将 Pygame 网络摄像头提要显示到 wxpanel 项中

转载 作者:太空宇宙 更新时间:2023-11-04 06:09:07 25 4
gpt4 key购买 nike

我创建了一个包含三个按钮的 wxpython 框架,在将视频格式化到 wxpanel 上时出现问题

这就是我流式传输网络摄像头的方式。

#code for the stream of webcam to frame
pygame.camera.init()
screen = pygame.display.set_mode((220,220))
cam = pygame.camera.Camera("/dev/video0", (220,220))
cam.start()

while 1:
image = cam.get_image()
screen.blit(image,(0,0))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()

这是面板的代码

self.panel  = wx.Panel(self, -1, (550, 20), (410, 500), style=wx.SUNKEN_BORDER)

如何将我的摄像头屏幕放入面板中。

最佳答案

我还没有听说过有人在 wxPython 中使用 PyGame 作为网络摄像头。为什么不直接在 PyGame 窗口中显示提要呢?

或者,您可以将 openCV 与 wxPython 一起用于网络摄像头,详见以下链接:

您还可以使用 MPlayerCtrl 查看网络摄像头源。这里有一些关于在 wxPython 中使用 MPlayerCtrl 的链接:

关于python - 将 Pygame 网络摄像头提要显示到 wxpanel 项中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19943575/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com