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


Python pyqtgraph.glColor方法代码示例

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


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

示例1: update

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import glColor [as 别名]
def update(self):
        time.sleep(0.03)
        global item
        pos = self.skeletons_3d[item]
        print(item, '  ')
        item += 1

        for j, j_parent in enumerate(self.skeleton_parents):
            if j_parent == -1:
                continue

            x = np.array([pos[j, 0], pos[j_parent, 0]]) * 10
            y = np.array([pos[j, 1], pos[j_parent, 1]]) * 10
            z = np.array([pos[j, 2], pos[j_parent, 2]]) * 10 - 10
            pos_total = np.vstack([x, y, z]).transpose()
            self.set_plotdata(
                name=j, points=pos_total,
                color=pg.glColor((j, 10)),
                width=6) 
开发者ID:zh-plus,项目名称:video-to-pose3D,代码行数:21,代码来源:videoThenAmination.py

示例2: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import glColor [as 别名]
def __init__(self):
        """
        Initialize the graphics window and mesh surface
        """

        # setup the view window
        self.app = QtGui.QApplication(sys.argv)
        self.window = gl.GLViewWidget()
        self.window.setWindowTitle('Terrain')
        self.window.setGeometry(0, 110, 1920, 1080)
        self.window.setCameraPosition(distance=30, elevation=12)
        self.window.show()

        gx = gl.GLGridItem()
        gy = gl.GLGridItem()
        gz = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gy.rotate(90, 1, 0, 0)
        gx.translate(-10, 0, 0)
        gy.translate(0, -10, 0)
        gz.translate(0, 0, -10)
        self.window.addItem(gx)
        self.window.addItem(gy)
        self.window.addItem(gz)

        model = 'mobilenet_thin_432x368'
        camera = 0
        w, h = model_wh(model)
        self.e = TfPoseEstimator(get_graph_path(model), target_size=(w, h))
        self.cam = cv2.VideoCapture("C:\\Users\\velpu\\Desktop\\tf-pose\dance.mp4")
        ret_val, image = self.cam.read()
        self.poseLifting = Prob3dPose('./src/lifting/models/prob_model_params.mat')
        keypoints = self.mesh(image)

        self.points = gl.GLScatterPlotItem(
            pos=keypoints,
            color=pg.glColor((0, 255, 0)),
            size=15
        )
        self.window.addItem(self.points) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:42,代码来源:webcam3d.py

示例3: _refresh_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import glColor [as 别名]
def _refresh_plot(self):
        import numpy as np
        #import pyqtgraph as pg
        from pyqtgraph import opengl as gl
        
        self._create_grid()
        pts = np.vstack([self.declaration.x,self.declaration.y,self.declaration.z]).transpose()
        plt = gl.GLLinePlotItem(pos=pts)#, color=pg.glColor((i,n*1.3)), width=(i+1)/10., antialias=True)
        self.widget.addItem(plt) 
开发者ID:frmdstryr,项目名称:enamlx,代码行数:11,代码来源:qt_plot_area.py

示例4: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import glColor [as 别名]
def __init__(self, input_video):
        self.traces = dict()
        self.app = QtGui.QApplication(sys.argv)
        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 45.0  ## distance of camera from center
        self.w.opts['fov'] = 60  ## horizontal field of view in degrees
        self.w.opts['elevation'] = 10  ## camera's angle of elevation in degrees 仰俯角
        self.w.opts['azimuth'] = 90  ## camera's azimuthal angle in degrees 方位角
        self.w.setWindowTitle('pyqtgraph example: GLLinePlotItem')
        self.w.setGeometry(450, 700, 980, 700)  # 原点在左上角
        self.w.show()

        # create the background grids
        gx = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gx.translate(-10, 0, 0)
        self.w.addItem(gx)
        gy = gl.GLGridItem()
        gy.rotate(90, 1, 0, 0)
        gy.translate(0, -10, 0)
        self.w.addItem(gy)
        gz = gl.GLGridItem()
        gz.translate(0, 0, -10)
        self.w.addItem(gz)

        # special setting
        self.cap = cv2.VideoCapture(input_video)
        self.video_name = input_video.split('/')[-1].split('.')[0]
        self.kpt2Ds = []
        pos = pos_init

        for j, j_parent in enumerate(common.skeleton_parents):
            if j_parent == -1:
                continue

            x = np.array([pos[j, 0], pos[j_parent, 0]]) * 10
            y = np.array([pos[j, 1], pos[j_parent, 1]]) * 10
            z = np.array([pos[j, 2], pos[j_parent, 2]]) * 10 - 10
            pos_total = np.vstack([x, y, z]).transpose()
            self.traces[j] = gl.GLLinePlotItem(pos=pos_total, color=pg.glColor((j, 10)), width=6, antialias=True)
            self.w.addItem(self.traces[j]) 
开发者ID:zh-plus,项目名称:video-to-pose3D,代码行数:43,代码来源:amination.py

示例5: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import glColor [as 别名]
def __init__(self, skeletons_3d):
        self.traces = dict()
        self.app = QtGui.QApplication(sys.argv)
        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 45.0  ## distance of camera from center
        self.w.opts['fov'] = 60  ## horizontal field of view in degrees
        self.w.opts['elevation'] = 10  ## camera's angle of elevation in degrees 仰俯角
        self.w.opts['azimuth'] = 90  ## camera's azimuthal angle in degrees 方位角
        self.w.setWindowTitle('pyqtgraph example: GLLinePlotItem')
        self.w.setGeometry(450, 700, 980, 700)  # 原点在左上角
        self.w.show()

        # create the background grids
        gx = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gx.translate(-10, 0, 0)
        self.w.addItem(gx)
        gy = gl.GLGridItem()
        gy.rotate(90, 1, 0, 0)
        gy.translate(0, -10, 0)
        self.w.addItem(gy)
        gz = gl.GLGridItem()
        gz.translate(0, 0, -10)
        self.w.addItem(gz)

        # special setting
        pos = pos_init
        self.skeleton_parents = common.skeleton_parents
        self.skeletons_3d = skeletons_3d

        for j, j_parent in enumerate(self.skeleton_parents):
            if j_parent == -1:
                continue
            x = np.array([pos[j, 0], pos[j_parent, 0]]) * 10
            y = np.array([pos[j, 1], pos[j_parent, 1]]) * 10
            z = np.array([pos[j, 2], pos[j_parent, 2]]) * 10 - 10
            pos_total = np.vstack([x, y, z]).transpose()
            self.traces[j] = gl.GLLinePlotItem(pos=pos_total, color=pg.glColor((j, 10)), width=6, antialias=True)
            self.w.addItem(self.traces[j]) 
开发者ID:zh-plus,项目名称:video-to-pose3D,代码行数:41,代码来源:videoThenAmination.py

示例6: __drawSegment

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import glColor [as 别名]
def __drawSegment(self, segment):

    # Update properties according to state
    isVisible = True
    if segment.isRemoved.atGivenStepAgo(Global.selStep) or (segment.type == SegmentType.proximal and self.menuShowProximalSegmentsNone.isChecked()) or (segment.type == SegmentType.distal and self.menuShowDistalSegmentsNone.isChecked()):
      isVisible = False
    else:
      if segment.isFalselyPredicted.atGivenStepAgo(Global.selStep):
        if segment.type == SegmentType.proximal and self.menuShowProximalSegmentsFalselyPredicted.isChecked():
          color = self.colorSegmentFalselyPredicted
        else:
          isVisible = False
      elif segment.isPredicted.atGivenStepAgo(Global.selStep):
        if segment.type == SegmentType.proximal and self.menuShowProximalSegmentsPredicted.isChecked():
          color = self.colorSegmentPredicted
        else:
          isVisible = False
      elif segment.isActive.atGivenStepAgo(Global.selStep):
        if (segment.type == SegmentType.proximal and self.menuShowProximalSegmentsActive.isChecked()) or (segment.type == SegmentType.distal and self.menuShowDistalSegmentsActive.isChecked()):
          color = self.colorSegmentActive
        else:
          isVisible = False
      else:
        if segment.type == SegmentType.proximal:
          color = self.colorInactive
        else:
          isVisible = False

    if isVisible:
      # Draw the segment
      if not segment.tree3d_initialized:
        pts = numpy.array([[segment.tree3d_x1, segment.tree3d_y1, segment.tree3d_z1], [segment.tree3d_x2, segment.tree3d_y2, segment.tree3d_z2]])
        segment.tree3d_item = gl.GLLinePlotItem(pos=pts, width=1, antialias=False)
        segment.tree3d_initialized = True
        self.simulationViewer.addItem(segment.tree3d_item)

      # Update the color
      if segment.tree3d_selected:
        color = self.colorSelected
      segment.tree3d_item.color = pg.glColor(color)
    else:
      segment.tree3d_initialized = False
      if segment.tree3d_item in self.simulationViewer.items:
        self.simulationViewer.removeItem(segment.tree3d_item)

    # Draw/update all synapses of this segment
    for synapse in segment.synapses:
      self.__drawSynapse(segment, synapse, isVisible) 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:50,代码来源:simulation_form.py

示例7: __drawSynapse

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import glColor [as 别名]
def __drawSynapse(self, segment, synapse, segmentIsVisible):

    # Update properties according to state
    isVisible = True
    if synapse.isRemoved.atGivenStepAgo(Global.selStep) or (not segment.isActive.atGivenStepAgo(Global.selStep) and not segment.isPredicted.atGivenStepAgo(Global.selStep) and not segment.isFalselyPredicted.atGivenStepAgo(Global.selStep)) or (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesNone.isChecked()) or (segment.type == SegmentType.distal and self.menuShowDistalSynapsesNone.isChecked()):
      isVisible = False
    else:
      if synapse.isFalselyPredicted.atGivenStepAgo(Global.selStep):
        if (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesFalselyPredicted.isChecked()):
          color = self.colorSynapseFalselyPredicted
        else:
          isVisible = False
      elif synapse.isPredicted.atGivenStepAgo(Global.selStep):
        if (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesPredicted.isChecked()):
          color = self.colorSynapsePredicted
        else:
          isVisible = False
      elif synapse.isConnected.atGivenStepAgo(Global.selStep):
        if (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesConnected.isChecked()) or (segment.type == SegmentType.distal and self.menuShowDistalSynapsesConnected.isChecked()):
          color = self.colorSynapseConnected
        else:
          isVisible = False
      else:
        if (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesActive.isChecked()) or (segment.type == SegmentType.distal and self.menuShowDistalSynapsesActive.isChecked()):
          color = self.colorInactive
        else:
          isVisible = False

    if isVisible and segmentIsVisible:
      # Draw the synapse
      if not synapse.tree3d_initialized:
        pts = numpy.array([[segment.tree3d_x2, segment.tree3d_y2, segment.tree3d_z2], [synapse.inputElem.tree3d_x, synapse.inputElem.tree3d_y, synapse.inputElem.tree3d_z]])
        synapse.tree3d_item = gl.GLLinePlotItem(pos=pts, width=1, antialias=False)
        synapse.tree3d_initialized = True
        self.simulationViewer.addItem(synapse.tree3d_item)

      # Update the color
      if synapse.tree3d_selected:
        color = self.colorSelected
      synapse.tree3d_item.color = pg.glColor(color)
    else:
      synapse.tree3d_initialized = False
      if synapse.tree3d_item in self.simulationViewer.items:
        self.simulationViewer.removeItem(synapse.tree3d_item) 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:46,代码来源:simulation_form.py


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