Pages

Monday, June 10, 2013

Logitech C920 test program not working

Now I have written a Python module to do web cam.  No luck in the first test.  The following initialization does not work!

  cam = pygame.camera.Camera("/dev/video0",(640,480))

cam.start()
SystemError: ioctl(VIDIOC_S_FMT) failure: no supported formats

.END

# ftwebcam v0.1 tlfong01 2013jun10

# *****************************************************************************
# Module - ftwebcam.py
# Description - Logitech C920 testing
# Reference
#   Pygame.camera
#   Reference = http://www.pygame.org/docs/ref/camera.html
#   Turorial = http://www.pygame.org/docs/tut/camera/CameraIntro.html
# Image size
#   2 MP 16:9 (1920 x 1080 = 2,073,600)
# *****************************************************************************

# *****************************************************************************
# Imports
# *****************************************************************************

import time

import pygame
import pygame.camera
from pygame.locals import *

import ftprint

# *****************************************************************************
# Function - TestLogitechC902()
# Description -
#   Test Webcam
# *****************************************************************************

def TestLogitechC902():

    ftprint.PrintDoubleSpaceLine("*** Start testing Logitech WebCam C902 ***")  

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

    camlist = pygame.camera.list_cameras()
     if camlist:
        print "List of available cameras = ", pygame.camera.list_cameras()
        cam = pygame.caemra.Camera(camlist[0],(640,480))

    cam = pygame.camera.Camera("/dev/video0",(640,480))
    cam.start()
    image = cam.get_image()

    ftprint.PrintDoubleSpaceLine("*** Stop testing Logitech WebCam C902***")

# .END



*** Start Program - FongToy v1.7 tlfong01 2013jun10 ***

*** Start testing Logitech WebCam C902 ***

List of available cameras =  ['/dev/video0']
Traceback (most recent call last):
  File "fongtoy.py", line 77, in <module>
    ftwebcam.TestLogitechC902()
  File "/home/pi/fongtoy/ftwebcam.py", line 42, in TestLogitechC902
    cam.start()
SystemError: ioctl(VIDIOC_S_FMT) failure: no supported formats
pi@raspberrypi ~/fongtoy $

.END

No comments:

Post a Comment