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


Python Camera.update_views方法代码示例

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


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

示例1: LivePlot

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import update_views [as 别名]

#.........这里部分代码省略.........
        self.floor_grid.resize(len(floor_grid[0]) // 3)
        self.floor_grid.vertices = floor_grid[0]
        self.floor_grid.colors   = floor_grid[1]
        
        axes = drawAxes((0, 0, 0), 1000)
        self.axes.resize(len(axes[0]) // 3)
        self.axes.vertices = axes[0]
        self.axes.colors   = axes[1]


    ## Step function, called every tick ---------------------------------------
    def step(self, dt):
        self.fps.append(1/dt)
        self.fps = self.fps[int(-self.frequency):]
        self.fps_display.text = '{:.2f}'.format(sum(self.fps)/len(self.fps))
        
        if self.camera.mode == Camera.FREE:
            self.camera_mode_display.text = "FREE"
        elif self.camera.mode == Camera.FOLLOW:
            self.camera_mode_display.text = "FOLLOW"
        elif self.camera.mode == Camera.XY:
            self.camera_mode_display.text = "XY"
        elif self.camera.mode == Camera.FIXED:
            self.camera_mode_display.text = "FIXED"
        
        ready,_,_ = select.select([self.sock], [], [], 0)
        #ready = False
        if ready:
            msg = getMessage(ready[0])

            for t,d in msg.iteritems():
                if t == "cameras":
                    self.cameras = d
                    self.camera.update_views(self.cameras)
                    
                    cone_color_cycle = [[1.0, 0.3, 0.3, 0.3], \
                                        [0.3, 1.0, 0.3, 0.3], \
                                        [0.3, 0.3, 1.0, 0.3]]
                    area_color_cycle = [[1.0, 0.3, 0.3, 0.5], \
                                        [0.3, 1.0, 0.3, 0.5], \
                                        [0.3, 0.3, 1.0, 0.5]]
                    
                    verts  = []
                    colors = []
                    for cam in d:
                        v,c = drawCameraCone(cam, cone_color_cycle[0], area_color_cycle[0])
                        verts  += v
                        colors += c
                        
                        cone_color_cycle = cone_color_cycle[1:] + cone_color_cycle[:1]
                        area_color_cycle = area_color_cycle[1:] + area_color_cycle[:1]
                    
                    self.camera_cones.resize(len(verts) // 3)
                    self.camera_cones.vertices = verts
                    self.camera_cones.colors   = colors
                        
                elif t == "markers":
                    markers = []
                    for m in d:
                        markers += list(m['mark'])
                        
                    self.markers.resize(len(d))
                    self.markers.vertices = markers
                    self.markers.colors   = [0, 0, 1, 1] * len(d)
        
        
开发者ID:ngieseker,项目名称:Vision-System,代码行数:68,代码来源:LivePlot.py


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