Pages

Tuesday, June 11, 2013

Logitech C270 installation problem solved

I looked back what did I do in the last couple of days and found that I might have forgotten to reset some configuration files after the web cam server test.  I found that I forgot to reset the start_motion_daemon to no in the motion setting.

I am a bit confused for now, because I thought the motion thing has nothing to do with Pygame, but now I know motion can at least interfere with Pygame.caamera.

Now that the test function can run to it end.  Next step is to check out where the captured image has hidden and display it. perhaps with my Win 7 Photoshop.

.END


# ftwebcam v0.3 tlfong01 2013jun11

# *****************************************************************************
# Module - ftwebcam.py
# Description - Test Logitech webcam C920 and C270 
# Reference
#   Pygame.camera Reference - http://www.pygame.org/docs/ref/camera.html
#   Pygame.camera Turorial -  http://www.pygame.org/docs/tut/camera/CameraIntro.html
# Notes
#   Image zise 2MP 16:9 = 1920 * 1080 = 2,073,600
#   /etc/motion/motion.conf setting
#     Daemon = off
#     webcam_localhost = on
#   /etc/default/motion setting
#     start_motion_daemon = no
# *****************************************************************************

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

import time

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

import ftprint

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

def TestWebcam():

    ftprint.PrintDoubleSpaceLine("*** Sample run begin - Test web cam 2013jun11hkt11:15 ***")    
    
    webCamWidth  = 640
    webCamHeight = 480

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

    webCamList = pygame.camera.list_cameras()
    if webCamList:
        print "List of available cameras = ", webCamList
        webCam = pygame.camera.Camera(webCamList[0],(webCamWidth, webCamHeight))

    webCam.start()
    image = webCam.get_image()

    webCam.stop()
    pygame.quit()

    ftprint.PrintDoubleSpaceLine("*** Sample run end ***")

# .END

pi@raspberrypi ~/fongtoy $ sudo python fongtoy.py
/home/pi/fongtoy/ftgpio.py:116: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  setupOutputPin = lambda oPin: GPIO.setup(oPin, GPIO.OUT) # set GPIO pin as output

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


*** Sample run begin - Test web cam 2013jun11hkt11:15 ***

List of available cameras =  ['/dev/video0']

*** Sample run end ***


*** Stop Program ***

pi@raspberrypi ~/fongtoy $ date
Tue Jun 11 03:34:19 UTC 2013
pi@raspberrypi ~/fongtoy $

No comments:

Post a Comment