I am trying to initialize the camera module in pygame and display video from a usb webcam. This is my code:
import pygame
import pygame.camera
from pygame.camera import *
from pygame.locals import *
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0",(640,480))
cam.start()
image = cam.get_image()
Yet i get this error:
Traceback (most recent call last):
File "C:/Users/Freddie/Desktop/CAMERA/Test1.py", line 7, in <module>
pygame.camera.init()
File "C:\Python27\lib\site-packages\pygame\camera.py", line 67, in init
_camera_vidcapture.init()
File "C:\Python27\lib\site-packages\pygame\_camera_vidcapture.py", line 21, in init
import vidcap as vc
ImportError: No module named vidcap
PLS HELP!!! Im on Windows
vidcap
. Did you install it? How did you install it? without these information how are we supposed to tell you what's wrong with the installation? – CinquePygame currently supports only Linux and v4l2 cameras.
pygame.org/docs/ref/camera.html It's possible that the documentation is outdated, however. – Glyph