当前位置: 首页>>代码示例>>Python>>正文


Python Pipeline.update方法代码示例

本文整理汇总了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
开发者ID:Woz4tetra,项目名称:Atlas,代码行数:73,代码来源:pipeline_test.py


注:本文中的pipeline.Pipeline.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。