首先是截图,从摄像头截取一幅图像:
复制代码 代码如下:
while 1: #测试摄像头的存在
try:
cam = Device()
except:
print "no webcam found!"
continue
break
然后是把图像上传到ftp服务器:
复制代码 代码如下:
remote = ftplib.FTP('127.0.0.1') #登陆服务器
remote.login()
file = open('%s.jpg'%cur_time,'rb') #用时间来命名图片
remote.storbinary('STOR %s.jpg'%cur_time,file) #上传图片
file.close()
当然了,最后把图片删除
下面是每隔一秒钟,把从摄像头采集的图片上传到本机ftp的程序:
复制代码 代码如下:
<span style="font-family: 宋体, Arial; line-height: 15px; background-color: rgb(245, 247, 248); "> </span><pre name="code" class="python">remote = ftplib.FTP('219.246.57.162')
remote.login()
while 1:
try:
remote.nlst("1.txt")
except:
print "not ready to start!"
continue
timex = time.localtime()
cur_time = "%4d%02d%02d%02d%02d%02d"%(timex[0],timex[1],timex[2],timex[3],timex[4],timex[5])
cam.saveSnapshot('%s.jpg'%cur_time)
#remote.dir()
file = open('%s.jpg'%cur_time,'rb')
remote.storbinary('STOR %s.jpg'%cur_time,file)
file.close()
os.system("del %s.jpg"%cur_time)
#print "upload ok!"
time.sleep(1)
remote.quit()</pre><br>
<pre></pre>
<p></p>
<pre></pre>
<p></p>
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- 《腾格尔 容中尔甲 亚东 高原三星 男人篇 3CD》[WAV/分轨][1GB]
- 命运圣契公测实测可用兑换码大全 命运圣契最新兑换码分享
- 黑神话悟空上品疾蝠精魄获取方法一览|上品疾蝠精魄收集攻略
- 《七龙珠电光炸裂!ZERO》GT角色预告片曝光,15位新角色登场
- [ABC]安娜-胆麦发烧女声[6N纯银镀膜][2016[低速原抓WAV+CUE]
- NewViennaOctetViennaWindSoloists-TheDeccaRecordings(2024)18CD[24-48][FLAC]-7
- 雨果唱片-三角琴《俄罗斯民间音乐系列-梁祝(中国名曲)》wav
- 《塞尔达传说:智慧的再现》新实机!无之世界介绍
- 任天堂公布《塞尔达传说》系列时间线:野炊与王泪独立在外
- 任天堂更新网络投稿规范:打击影响他人游戏体验行为
- 冼佩瑾.2024-女儿Daughter(EP)【杰威尔】【FLAC分轨】
- 黑豹乐队.1993-光芒之神【摇音晨【WAV+CUE】
- 曾轶可.2011-一只猫的旅行【天娱传媒】【WAV+CUE】
- 黑神话悟空上品狼刺客精魄获取方法一览|上品狼刺客精魄收集攻略
- 视觉小说《神椿市建设中REGENERATE》将于2025年2月20日发售