#!/usr/bin/env python from sys import path from CVtypes import cv from time import sleep from time import clock cv.NamedWindow('win'); cap=cv.CreateCameraCapture(0) cv.SetCaptureProperty(cap, cv.CAP_PROP_FRAME_WIDTH, 160); cv.SetCaptureProperty(cap, cv.CAP_PROP_FRAME_HEIGHT, 120); while True: img = cv.QueryFrame(cap) szImg = cv.GetSize(img); gray = cv.CreateImage(cv.GetSize(img), 8 ,1); cv.CvtColor(img, gray, cv.BGR2GRAY); simg = cv.CreateImage(cv.Size(szImg.width/2, szImg.height/2), 8, 1); cv.Resize(gray, simg, cv.INTER_LINEAR); cv.SaveImage('test.jpg', simg); cv.ShowImage('win',simg) cv.WaitKey(10) #process events pass