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


Python Configuration.read_video_config方法代码示例

本文整理汇总了Python中config.Configuration.read_video_config方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.read_video_config方法的具体用法?Python Configuration.read_video_config怎么用?Python Configuration.read_video_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config.Configuration的用法示例。


在下文中一共展示了Configuration.read_video_config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import read_video_config [as 别名]
    def __init__(self, pitch, color_settings, our_name, robot_details,
                 enable_gui=False, pc_name=None, robots_on_pitch=list(), goal=None):
        """
        Entry point for the SDP system.

        Params:
            [int] pitch                     0 - main pitch, 1 - secondary pitch
            [int or string] color_settings  [0, small, 1, big] - 0 or small for pitch color settings with small numbers (previously - pitch 0)
                                            1 or big - pitch color settings with big numbers (previously - pitch 1)
            [string] colour                 The colour of our teams plates
            [string] our_name               our name
            [int] video_port                port number for the camera

            [boolean] enable_gui              Does not draw the normal image to leave space for GUI.
                                            Also forces the trackers to return circle contour positons in addition to robot details.
            [string] pc_name                Name of the PC to load the files from (BUT NOT SAVE TO). Will default to local machine if not specified.
        """
        pitch = int(pitch)
        assert pitch in [0, 1]

        if goal: assert goal in ["left", "right"]

        self.pitch = pitch
        self.target_goal = goal
        self.color_settings = color_settings

        self.calibration = Configuration.read_calibration(
            pc_name, create_if_missing=True)

        self.video_settings = Configuration.read_video_config(
            pc_name, create_if_missing=True)

        # Set up camera for frames
        self.camera = Camera(pitch)
        self.camera.start_capture()
        self.frame = self.camera.get_frame()
        center_point = self.camera.get_adjusted_center()

        # Set up vision
        self.trackers = list()

        self.world_objects = dict()

        # Get machine-specific calibration

        self.enable_gui = enable_gui
        self.gui = None

        # Initialize robots
        self.robots = []

        # Initialize ball states - which robot had the ball previously.
        self.ball_median_size = 5
        self.ball_index = 0
        self.ball_states = [None] * self.ball_median_size

        self.BALL_HOLDING_AREA_SCALE = 0.1

        for r_name in robot_details.keys():
            role = 'ally'
            if robot_details[r_name]['main_colour'] != robot_details[our_name]['main_colour']:
                role = 'enemy'
            elif r_name == our_name:
                role = 'group9'

            print "[WRAPPER] Setting %s to %s." % (r_name, role)
            self.robots.append(RobotInstance(r_name,
                                             robot_details[r_name]['main_colour'],
                                             robot_details[r_name]['side_colour'],
                                             robot_details[r_name]['offset_angle'],
                                             role,
                                             r_name in robots_on_pitch))


        # Draw various things on the image
        self.draw_direction = True
        self.draw_robot     = True
        self.draw_contours  = True
        self.draw_ball      = True

        self.vision = Vision(
            pitch=pitch, frame_shape=self.frame.shape,
            frame_center=center_point, calibration=self.calibration,
            robots=self.robots,
            return_circle_contours=enable_gui, trackers_out=self.trackers)

        # Used for latency calculations
        self.t0 = time()
        self.delta_t = 0


        if self.enable_gui:
            self.gui = GUI(self.pitch, self.color_settings, self.calibration, self)

            from threading import Thread
            from gui.common import MainWindow
            from gui.status_control import StatusUI
            from gui.main import MainUI

            self.status_window = None
#.........这里部分代码省略.........
开发者ID:jsren,项目名称:sdp-vision,代码行数:103,代码来源:vision_wrapper.py


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