本文整理汇总了Python中display.Display.renderScene方法的典型用法代码示例。如果您正苦于以下问题:Python Display.renderScene方法的具体用法?Python Display.renderScene怎么用?Python Display.renderScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类display.Display
的用法示例。
在下文中一共展示了Display.renderScene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import renderScene [as 别名]
def main():
# Instantiate Classes
detector = FaceDetector(FACE_CLASSIFIER_PATH, EYE_CLASSIFIER_PATH);
model = FaceModel();
display = Display();
capture = Capture();
oldTime = time.time();
i = 0;
frames_num=0
delta_sum = 0
while True:
# escape key for exit, in linux display is not working without that
k = cv2.waitKey(30) & 0xff
if k == 27:
return
# Calculate time difference (dt), update oldTime variable
newTime = time.time();
dt = newTime - oldTime;
oldTime = newTime;
frames_num += 1
delta_sum += dt
if frames_num % 100 == 0:
print "delta:",delta_sum/float(frames_num),"frames pr sec:",1/float(delta_sum/float(frames_num))
frames_num=0
delta_sum = 0
# Grab Frames
frames = capture.read();
# Detect face 20% of the time, eyes 100% of the time
if i % 5 is 0:
rects = detector.detect(frames);
else:
rects = detector.detect(frames,model.getPreviousFaceRects());
i += 1;
# Add detected rectangles to model
model.add(rects);
display.renderScene(frames['display'],model,rects);
display.renderEyes(frames['color'],model);