本文整理汇总了Python中SimpleCV.Display.close方法的典型用法代码示例。如果您正苦于以下问题:Python Display.close方法的具体用法?Python Display.close怎么用?Python Display.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Display
的用法示例。
在下文中一共展示了Display.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Camera
# 需要导入模块: from SimpleCV import Display [as 别名]
# 或者: from SimpleCV.Display import close [as 别名]
from SimpleCV import Camera, Display, VideoStream, VirtualCamera, Color
from time import sleep
import numpy
cam = Camera(prop_set={'width':320, 'height':240})
dis = Display(resolution=(320,240))
lastCoordinates = (0,0)
vidStream = VideoStream("test.mov", 25, True)
while not dis.isDone():
frame = cam.getImage()
faces = frame.findHaarFeatures('face')
if faces:
for face in faces:
# Checks to see if the (x,y) is greater than or less than the last (x,y). Then we have motion.
if face.coordinates()[0] > lastCoordinates[0]+3 or face.coordinates()[1] > lastCoordinates[1]+3 or face.coordinates()[0] < lastCoordinates[0]-3 or face.coordinates()[1] < lastCoordinates[1]-3:
lastCoordinates = face.coordinates()
face.draw()
frame.save(vidStream)
# Show the image
frame.show()
# My attempt to get around 30 frames per second.. though I haven't checked this.
sleep(1./30.)
if dis.IsDone():
cam.close()
dis.close()