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


Python opengl.GLScatterPlotItem方法代码示例

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


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

示例1: scatter

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLScatterPlotItem [as 别名]
def scatter(self, name, points, colors=GLColor.Write, alphas=0.5,
                size=0.1, translucent=True):
        # if isinstance(colors, tuple):
        #     colors = gl_color(colors, alphas)
        colors = _extend_color_if_necessary(colors, points.shape[0], alphas)
        if name not in self._named_items:
            w_gl_scatter = gl.GLScatterPlotItem(
                pos=points, size=size, color=colors, pxMode=False)
            if translucent:
                w_gl_scatter.setGLOptions('translucent')
            self._named_items[name] = w_gl_scatter
            self.addItem(w_gl_scatter)
        else:
            self._named_items[name].setData(
                pos=points, size=size, color=colors, pxMode=False) 
开发者ID:traveller59,项目名称:second.pytorch,代码行数:17,代码来源:glwidget.py

示例2: __init__

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLScatterPlotItem [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: scatter

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLScatterPlotItem [as 别名]
def scatter(self, name, points, colors=GLColor.Write, alphas=0.5,
                size=0.1, translucent=False):
        # if isinstance(colors, tuple):
        #     colors = gl_color(colors, alphas)
        colors = _extend_color_if_necessary(colors, points.shape[0], alphas)
        if name not in self._named_items:
            w_gl_scatter = gl.GLScatterPlotItem(
                pos=points, size=size, color=colors, pxMode=False)
            if translucent:
                w_gl_scatter.setGLOptions('translucent')
            self._named_items[name] = w_gl_scatter
            self.addItem(w_gl_scatter)
        else:
            self._named_items[name].setData(
                pos=points, size=size, color=colors, pxMode=False) 
开发者ID:SmallMunich,项目名称:nutonomy_pointpillars,代码行数:17,代码来源:glwidget.py

示例4: add_points

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLScatterPlotItem [as 别名]
def add_points(self, points, colors):
        points_item = gl.GLScatterPlotItem(pos=points, size=2, color=colors)
        self.view.addItem(points_item) 
开发者ID:poodarchu,项目名称:Det3D,代码行数:5,代码来源:kitti.py

示例5: _qtg_plot_graph

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLScatterPlotItem [as 别名]
def _qtg_plot_graph(G, edges, vertex_size, title):

    qtg, gl, QtGui = _import_qtg()

    if G.coords.shape[1] == 2:

        window = qtg.GraphicsWindow()
        window.setWindowTitle(title)
        view = window.addViewBox()
        view.setAspectLocked()

        if edges:
            pen = tuple(np.array(G.plotting['edge_color']) * 255)
        else:
            pen = None

        adj = _get_coords(G, edge_list=True)

        g = qtg.GraphItem(pos=G.coords, adj=adj, pen=pen,
                          size=vertex_size/10)
        view.addItem(g)

        global _qtg_windows
        _qtg_windows.append(window)

    elif G.coords.shape[1] == 3:
        if not QtGui.QApplication.instance():
            QtGui.QApplication([])  # We want only one application.
        widget = gl.GLViewWidget()
        widget.opts['distance'] = 10
        widget.show()
        widget.setWindowTitle(title)

        if edges:
            x, y, z = _get_coords(G)
            pos = np.stack((x, y, z), axis=1)
            g = gl.GLLinePlotItem(pos=pos, mode='lines',
                                  color=G.plotting['edge_color'])
            widget.addItem(g)

        gp = gl.GLScatterPlotItem(pos=G.coords, size=vertex_size/3,
                                  color=G.plotting['vertex_color'])
        widget.addItem(gp)

        global _qtg_widgets
        _qtg_widgets.append(widget) 
开发者ID:epfl-lts2,项目名称:pygsp,代码行数:48,代码来源:plotting.py

示例6: _qtg_plot_signal

# 需要导入模块: from pyqtgraph import opengl [as 别名]
# 或者: from pyqtgraph.opengl import GLScatterPlotItem [as 别名]
def _qtg_plot_signal(G, signal, edges, vertex_size, limits, title):

    qtg, gl, QtGui = _import_qtg()

    if G.coords.shape[1] == 2:
        window = qtg.GraphicsWindow(title)
        view = window.addViewBox()

    elif G.coords.shape[1] == 3:
        if not QtGui.QApplication.instance():
            QtGui.QApplication([])  # We want only one application.
        widget = gl.GLViewWidget()
        widget.opts['distance'] = 10
        widget.show()
        widget.setWindowTitle(title)

    if edges:

        if G.coords.shape[1] == 2:
            adj = _get_coords(G, edge_list=True)
            pen = tuple(np.array(G.plotting['edge_color']) * 255)
            g = qtg.GraphItem(pos=G.coords, adj=adj, symbolBrush=None,
                              symbolPen=None, pen=pen)
            view.addItem(g)

        elif G.coords.shape[1] == 3:
            x, y, z = _get_coords(G)
            pos = np.stack((x, y, z), axis=1)
            g = gl.GLLinePlotItem(pos=pos, mode='lines',
                                  color=G.plotting['edge_color'])
            widget.addItem(g)

    pos = [1, 8, 24, 40, 56, 64]
    color = np.array([[0, 0, 143, 255], [0, 0, 255, 255], [0, 255, 255, 255],
                      [255, 255, 0, 255], [255, 0, 0, 255], [128, 0, 0, 255]])
    cmap = qtg.ColorMap(pos, color)

    signal = 1 + 63 * (signal - limits[0]) / limits[1] - limits[0]

    if G.coords.shape[1] == 2:
        gp = qtg.ScatterPlotItem(G.coords[:, 0],
                                 G.coords[:, 1],
                                 size=vertex_size/10,
                                 brush=cmap.map(signal, 'qcolor'))
        view.addItem(gp)

    if G.coords.shape[1] == 3:
        gp = gl.GLScatterPlotItem(pos=G.coords,
                                  size=vertex_size/3,
                                  color=cmap.map(signal, 'float'))
        widget.addItem(gp)

    if G.coords.shape[1] == 2:
        global _qtg_windows
        _qtg_windows.append(window)
    elif G.coords.shape[1] == 3:
        global _qtg_widgets
        _qtg_widgets.append(widget) 
开发者ID:epfl-lts2,项目名称:pygsp,代码行数:60,代码来源:plotting.py


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