3
私は自分のraspberry-pi-3でMSライフスキャンを使用しようとしています。rpi3でpythonを通してwebcamを実行する方法
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
は、今私はPythonのコードを介してカメラを実行したい:それは、私は、次のコマンドを入力すると、コマンドラインで動作します
私はここで困惑しています。カメラはrasp-piでサポートされているので、私のPythonコードはどこかで更新する必要があります。手伝ってくれますか?