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


Python utils.draw_points_norm函数代码示例

本文整理汇总了Python中pyglui.cygl.utils.draw_points_norm函数的典型用法代码示例。如果您正苦于以下问题:Python draw_points_norm函数的具体用法?Python draw_points_norm怎么用?Python draw_points_norm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: gl_display_in_window

    def gl_display_in_window(self,world_tex_id):
        """
        here we map a selected surface onto a seperate window.
        """
        if self._window and self.detected:
            active_window = glfwGetCurrentContext()
            glfwMakeContextCurrent(self._window)
            clear_gl_screen()

            # cv uses 3x3 gl uses 4x4 tranformation matricies
            m = cvmat_to_glmat(self.m_from_screen)

            glMatrixMode(GL_PROJECTION)
            glPushMatrix()
            glLoadIdentity()
            glOrtho(0, 1, 0, 1,-1,1) # gl coord convention

            glMatrixMode(GL_MODELVIEW)
            glPushMatrix()
            #apply m  to our quad - this will stretch the quad such that the ref suface will span the window extends
            glLoadMatrixf(m)

            draw_named_texture(world_tex_id)
            glMatrixMode(GL_PROJECTION)
            glPopMatrix()
            glMatrixMode(GL_MODELVIEW)
            glPopMatrix()

            # now lets get recent pupil positions on this surface:
            draw_points_norm(self.gaze_on_srf,color=RGBA(0.,8.,.5,.8), size=80)

            glfwSwapBuffers(self._window)
            glfwMakeContextCurrent(active_window)
        if self.window_should_close:
            self.close_window()
开发者ID:elmadjian,项目名称:pupil,代码行数:35,代码来源:reference_surface.py

示例2: gl_draw_frame

    def gl_draw_frame(self,img_size):
        """
        draw surface and markers
        """
        if self.detected:
            frame = np.array([[[0,0],[1,0],[1,1],[0,1],[0,0]]],dtype=np.float32)
            hat = np.array([[[.3,.7],[.7,.7],[.5,.9],[.3,.7]]],dtype=np.float32)
            hat = cv2.perspectiveTransform(hat,self.m_to_screen)
            frame = cv2.perspectiveTransform(frame,self.m_to_screen)
            alpha = min(1,self.build_up_status/self.required_build_up)
            draw_polyline_norm(frame.reshape((5,2)),1,RGBA(1.0,0.2,0.6,alpha))
            draw_polyline_norm(hat.reshape((4,2)),1,RGBA(1.0,0.2,0.6,alpha))

            #grid = frame.reshape((5,2))
            # self.crop_region = np.array([
            #     [grid[0][0] * img_size[1], grid[0][1] * img_size[0]],
            #     [grid[1][0] * img_size[1], grid[1][1] * img_size[0]],
            #     [grid[2][0] * img_size[1], grid[2][1] * img_size[0]],
            #     [grid[3][0] * img_size[1], grid[3][1] * img_size[0]]],
            #     dtype=np.float32)

            draw_points_norm(frame.reshape((5,-1))[0:1])
            text_anchor = frame.reshape((5,-1))[2]
            text_anchor[1] = 1-text_anchor[1]
            text_anchor *=img_size[1],img_size[0]
            self.glfont.draw_text(text_anchor[0],text_anchor[1],self.marker_status())
开发者ID:elmadjian,项目名称:pupil,代码行数:26,代码来源:reference_surface.py

示例3: gl_display

    def gl_display(self):
        super(Accuracy_Test, self).gl_display()

        if not self.active and self.error_lines is not None:
            draw_polyline_norm(self.error_lines,color=RGBA(1.,0.5,0.,.5),line_type=gl.GL_LINES)
            draw_points_norm(self.error_lines[1::2],color=RGBA(.0,0.5,0.5,.5),size=3)
            draw_points_norm(self.error_lines[0::2],color=RGBA(.5,0.0,0.0,.5),size=3)
开发者ID:Reidzhang,项目名称:pupil,代码行数:7,代码来源:accuracy_test.py

示例4: gl_draw_corners

 def gl_draw_corners(self):
     """
     draw surface and markers
     """
     if self.detected:
         frame = cv2.perspectiveTransform(marker_corners_norm.reshape(-1,1,2),self.m_to_screen)
         draw_points_norm(frame.reshape((4,2)),20,RGBA(1.0,0.2,0.6,.5))
开发者ID:JihadOsakaUniversity,项目名称:pupil,代码行数:7,代码来源:reference_surface.py

示例5: gl_display

    def gl_display(self):
        """
        use gl calls to render
        at least:
            the published position of the reference
        better:
            show the detected postion even if not published
        """

        if self.active:
            draw_points_norm([self.smooth_pos],size=15,color=RGBA(1.,1.,0.,.5))

        if self.active and self.detected:
            for e in self.candidate_ellipses:
                pts = cv2.ellipse2Poly( (int(e[0][0]),int(e[0][1])),
                                    (int(e[1][0]/2),int(e[1][1]/2)),
                                    int(e[-1]),0,360,15)
                draw_polyline(pts,color=RGBA(0.,1.,0,1.))


            # lets draw an indicator on the autostop count
            e = self.candidate_ellipses[3]
            pts = cv2.ellipse2Poly( (int(e[0][0]),int(e[0][1])),
                                (int(e[1][0]/2),int(e[1][1]/2)),
                                int(e[-1]),0,360,360/self.auto_stop_max)
            indicator = [e[0]] + pts[self.auto_stop:].tolist() + [e[0]]
            draw_polyline(indicator,color=RGBA(8.,0.1,0.1,.8),line_type=GL_POLYGON)
        else:
            pass
开发者ID:AlienorV,项目名称:pupil,代码行数:29,代码来源:adjust_calibration.py

示例6: gl_draw_corners

 def gl_draw_corners(self):
     """
     draw surface and markers
     """
     if self.detected:
         frame = np.array([[[0,0],[1,0],[1,1],[0,1]]],dtype=np.float32)
         frame = cv2.perspectiveTransform(frame,self.m_to_screen)
         draw_points_norm(frame.reshape((4,2)),15,RGBA(1.0,0.2,0.6,.5))
开发者ID:elmadjian,项目名称:pupil,代码行数:8,代码来源:reference_surface.py

示例7: gl_display

    def gl_display(self):
        global emotion_col
        print emotion_key
        if (emotion_key=='115'):
            emotion_col=RGBA(0,0,255,.4)
        elif (emotion_key=='104'):
            emotion_col=RGBA(1,.5,.2,.4)
        elif (emotion_key=='97'):
            emotion_col=RGBA(1.,.1,.1,.4)
        elif (emotion_key=='110'):
            emotion_col=RGBA(255,255,255,0)
        else:
            emotion_col=RGBA(255,255,255,0)


        draw_points_norm(self.pupil_display_list,color=emotion_col)
开发者ID:dirtydevil,项目名称:pupil,代码行数:16,代码来源:display_recent_gaze.py

示例8: gl_display

 def gl_display(self):
     if self.vis_mapping_error and self.error_lines is not None:
         draw_polyline_norm(
             self.error_lines, color=RGBA(1.0, 0.5, 0.0, 0.5), line_type=gl.GL_LINES
         )
         draw_points_norm(
             self.error_lines[1::2], size=3, color=RGBA(0.0, 0.5, 0.5, 0.5)
         )
         draw_points_norm(
             self.error_lines[0::2], size=3, color=RGBA(0.5, 0.0, 0.0, 0.5)
         )
     if self.vis_calibration_area and self.calibration_area is not None:
         draw_polyline_norm(
             self.calibration_area,
             thickness=2.0,
             color=RGBA(0.663, 0.863, 0.463, 0.8),
             line_type=gl.GL_LINE_LOOP,
         )
开发者ID:pupil-labs,项目名称:pupil,代码行数:18,代码来源:accuracy_visualizer.py

示例9: gl_display

    def gl_display(self):
        """
        use gl calls to render
        at least:
            the published position of the reference
        better:
            show the detected postion even if not published
        """

        if self.active and self.detected:
            draw_points_norm([self.smooth_pos],size=15,color=RGBA(1.,1.,0.,.5))
            for e in self.candidate_ellipses:
                pts = cv2.ellipse2Poly( (int(e[0][0]),int(e[0][1])),
                                       (int(e[1][0]/2),int(e[1][1]/2)),
                                       int(e[-1]),0,360,15)
                draw_polyline(pts,color=RGBA(0.,1.,0,1.))

        else:
            pass
开发者ID:elmorg,项目名称:pupil,代码行数:19,代码来源:circle_detect.py

示例10: gl_display

    def gl_display(self):
        """
        use gl calls to render
        at least:
            the published position of the reference
        better:
            show the detected postion even if not published
        """

        if self.active:
            draw_points_norm([self.smooth_pos], size=15, color=RGBA(1.0, 1.0, 0.0, 0.5))

        if self.active and len(self.markers):
            # draw the largest ellipse of all detected markers
            for marker in self.markers:
                e = marker["ellipses"][-1]
                pts = cv2.ellipse2Poly(
                    (int(e[0][0]), int(e[0][1])),
                    (int(e[1][0] / 2), int(e[1][1] / 2)),
                    int(e[-1]),
                    0,
                    360,
                    15,
                )
                draw_polyline(pts, color=RGBA(0.0, 1.0, 0, 1.0))
                if len(self.markers) > 1:
                    draw_polyline(
                        pts, 1, RGBA(1.0, 0.0, 0.0, 0.5), line_type=GL_POLYGON
                    )

            # draw indicator on the first detected marker
            if self.counter and self.markers[0]["marker_type"] == "Ref":
                e = self.markers[0]["ellipses"][-1]
                pts = cv2.ellipse2Poly(
                    (int(e[0][0]), int(e[0][1])),
                    (int(e[1][0] / 2), int(e[1][1] / 2)),
                    int(e[-1]),
                    0,
                    360,
                    360 // self.counter_max,
                )
                indicator = [e[0]] + pts[self.counter :].tolist()[::-1] + [e[0]]
                draw_polyline(
                    indicator, color=RGBA(0.1, 0.5, 0.7, 0.8), line_type=GL_POLYGON
                )

            # draw indicator on the stop marker(s)
            if self.auto_stop:
                for marker in self.markers:
                    if marker["marker_type"] == "Stop":
                        e = marker["ellipses"][-1]
                        pts = cv2.ellipse2Poly(
                            (int(e[0][0]), int(e[0][1])),
                            (int(e[1][0] / 2), int(e[1][1] / 2)),
                            int(e[-1]),
                            0,
                            360,
                            360 // self.auto_stop_max,
                        )
                        indicator = [e[0]] + pts[self.auto_stop :].tolist() + [e[0]]
                        draw_polyline(
                            indicator,
                            color=RGBA(8.0, 0.1, 0.1, 0.8),
                            line_type=GL_POLYGON,
                        )
        else:
            pass
开发者ID:pupil-labs,项目名称:pupil,代码行数:67,代码来源:manual_marker_calibration.py

示例11: gl_display

 def gl_display(self):
     if self.detected:
         draw_points_norm([self.pos],size=self.r,color=RGBA(0.,1.,0.,.5))
开发者ID:lloves,项目名称:pupil,代码行数:3,代码来源:natural_features_calibration.py

示例12: gl_display

 def gl_display(self):
     for pt, a in self.pupil_display_list:
         # This could be faster if there would be a method to also add multiple colors per point
         draw_points_norm([pt], size=35, color=RGBA(1.0, 0.2, 0.4, a))
开发者ID:pupil-labs,项目名称:pupil,代码行数:4,代码来源:display_recent_gaze.py

示例13: gl_display

 def gl_display(self):
     draw_points_norm(self.pupil_display_list,
                     size=35,
                     color=RGBA(1.,.2,.4,.6))
开发者ID:cpicanco,项目名称:pupil,代码行数:4,代码来源:display_recent_gaze.py


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