Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pygame Import Error: cannot import name _camera while accessing webcamera

Tags:

python

pygame

I reinstall pygame 3 times but issue not get resolved. Below is my code.

import pygame
import pygame.camera
import time

pygame.init()
pygame.camera.init()

camlist = pygame.camera.list_cameras()
cam = pygame.camera.Camera("C:/Program Files/iBall Face2Face ROBO K20 Webcam/VideoCap",(640,480))
cam.start()
time.sleep(0.1)  # You might need something higher in the beginning
img = cam.get_image()
pygame.image.save(img,"C:/Users/mswatg05/Desktop/filename.jpg")
cam.stop()
like image 328
NIKHIL BHORE Avatar asked Oct 22 '16 06:10

NIKHIL BHORE


1 Answers

By default, the camera extension is only enabled on linux builds. Try using a third party compile, and install VideoCapture from the same place.

like image 58
haboutnnah Avatar answered Nov 05 '22 22:11

haboutnnah