pako 发表于 2013-2-7 08:50:06

webpy做的摄像头截图

每次刷新会用摄像头截一张图,然后返回(网上不是有一个页面一直挂着美国一个街头的摄像头嘛,很多人应该看过).随便写着玩的,所以没注意性能什么的.

#! /usr/bin/env python# -*- coding: UTF-8 -*-#by:pako#email:zealzpc@gmail.comimport os, re, sys,typesimport timeimport webfrom VideoCapture import Deviceurls = (      '/', 'index',      )web.webapi.internalerror = web.debugerrorrender = web.template.render('template/')cam = Device()picnum = 0class index:    def GET(self):      picname = './static/%d.jpg'%(picnum)      cam.saveSnapshot('./static/image.jpg', timestamp=3, boldfont=1)      picnum +=1      returnrender.index()if __name__ == "__main__":    app = web.application(urls, globals())    app.run()
页: [1]
查看完整版本: webpy做的摄像头截图