【发布时间】:2012-07-09 07:21:14
【问题描述】:
我想从网络摄像头加载图像以在 pygame 上显示 我正在使用视频捕捉
from VideoCapture import Device
import pygame
import time
In=1
pygame.init()
w = 640
h = 480
size=(w,h)
screen = pygame.display.set_mode(size)
while True:
cam = Device()
cam.saveSnapshot(str(In)+".jpg")
img=pygame.image.load(In)
screen.blit(img,(0,0))
In=int(In)+1
In=str(In)
为什么这不起作用。Pygame 窗口打开但没有显示?
【问题讨论】:
-
您的图片是否名为 1.jpg 并且在同一个文件夹中?
-
老兄,如果您查看代码,您会看到 saveSnapshot(str(In)+".jpg")
-
可以使用
pygame.camera拍照,去掉对VideoCapture的依赖