3
내 라즈베리 파이와 함께 MS lifecam을 사용하려고합니다.rpi3에서 python을 통해 웹캠을 실행하는 방법
import pygame
import pygame.camera
from pygame.locals import *
DEVICE = '/dev/video0'
SIZE = (640, 480) # I also tried with img size (384,288), same error
FILENAME = 'capture.jpg'
pygame.init()
pygame.camera.init()
camera = pygame.camera.Camera(DEVICE, SIZE)
camera.start() # error on executing this line
pygame.image.save(screen, FILENAME)
camera.stop()
보고 된 오류는 다음과 같습니다 :
SystemError: ioctl(VIDIOC_S_FMT) failure: no supported formats
$ fswebcam img.jpg
Trying source module v4l2...
/dev/video0 opened.
...
Writing JPEG image to 'img.jpg' # this works fine
가 지금은 파이썬 코드를 통해 카메라를 실행하려면 : 내가 다음 명령을 입력 할 때, 명령 줄에서 작동
나는 여기서 당혹 스럽다. 카메라는 rasp-pi로 지원되므로 내 파이썬 코드가 어딘가에 업데이트되어야하는 것처럼 보입니다. 도울 수 있니?