本文整理汇总了Python中pipeline.Pipeline.update方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.update方法的具体用法?Python Pipeline.update怎么用?Python Pipeline.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import update [as 别名]
class PipelineTest:
def __init__(self):
# project.set_project_dir("rccar")
if len(sys.argv) == 2:
file_name = sys.argv[1]
directory = None
elif len(sys.argv) == 3:
file_name = sys.argv[1]
directory = sys.argv[2]
else:
file_name = 0
directory = "rc_car"
try:
file_name = int(file_name)
except ValueError:
pass
self.width = 480
self.height = 320
self.show_original = False
self.capture = Video(file_name, directory)
self.pipeline = Pipeline(self.width, self.height, True)
self.time_start = time.time()
def update_keys(self):
key = self.capture.key_pressed()
if key == "q" or key == "esc":
print("quitting...")
return False # exit program
elif key == " ":
if self.capture.paused:
print("%0.4fs: ...Video unpaused" % (time.time() - self.time_start))
else:
print("%0.4fs: Video paused..." % (time.time() - self.time_start))
self.capture.paused = not self.capture.paused
elif key == "s":
self.capture.save_frame()
elif key == "v":
if not self.capture.is_recording:
self.capture.start_recording()
else:
self.capture.stop_recording()
elif key == "o":
self.show_original = not self.show_original
elif key == "right":
self.capture.increment_frame()
elif key == "left":
self.capture.decrement_frame()
if not self.capture.paused:
self.capture.show_frame()
return True # don't exit program
def run(self):
while True:
if not self.capture.paused or self.capture.slider_moved():
if self.capture.get_frame() is None:
break
if not self.show_original:
frame = self.pipeline.update(self.capture)
self.capture.show_frame(frame)
else:
self.capture.show_frame()
if not self.update_keys():
break