示例#1
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        if self.mode == "Show markers and frames":
            for m in self.markers:
                hat = np.array([[[0,0],[0,1],[.5,1.3],[1,1],[1,0],[0,0]]],dtype=np.float32)
                hat = cv2.perspectiveTransform(hat,m_marker_to_screen(m))
                draw_gl_polyline(hat.reshape((6,2)),(0.1,1.,1.,.5))

            for s in self.surfaces:
                s.gl_draw_frame(self.img_shape)


        for s in self.surfaces:
            if self.locate_3d:
                s.gl_display_in_window_3d(self.g_pool.image_tex,self.camera_intrinsics)
            else:
                s.gl_display_in_window(self.g_pool.image_tex)


        if self.mode == "Surface edit mode":
            for s in self.surfaces:
                s.gl_draw_frame(self.img_shape)
                s.gl_draw_corners()
示例#2
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """

        for m in self.markers:
            hat = np.array([[[0,0],[0,1],[.5,1.3],[1,1],[1,0],[0,0]]],dtype=np.float32)
            hat = cv2.perspectiveTransform(hat,m_marker_to_screen(m))
            draw_gl_polyline(hat.reshape((6,2)),(0.1,1.,1.,.5))

        for s in  self.surfaces:
            s.gl_draw_frame()

        if self.surface_edit_mode.value:
            for s in  self.surfaces:
                s.gl_draw_corners()


        if self._window and self.surfaces:
            try:
                s = self.surfaces[self.show_surface_idx.value]
            except IndexError:
                s = None
            if s and s.detected:
                self.gl_display_in_window(s)
示例#3
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        self.gl_display_cache_bars()
        for s in self.surfaces:
            s.gl_display_in_window(self.g_pool.image_tex)

        if self.mode == "Show Markers and Frames":
            for m in self.markers:
                hat = np.array([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]],
                               dtype=np.float32)
                hat = cv2.perspectiveTransform(hat, m_marker_to_screen(m))
                draw_polyline(hat.reshape((5, 2)),
                              color=RGBA(0.1, 1., 1., .3),
                              line_type=GL_POLYGON)
                draw_polyline(hat.reshape((5, 2)), color=RGBA(0.1, 1., 1., .6))

            for s in self.surfaces:
                s.gl_draw_frame(self.img_shape)

        if self.mode == "Surface edit mode":
            for s in self.surfaces:
                s.gl_draw_frame(self.img_shape)
                s.gl_draw_corners()

        if self.mode == "Show Heatmaps":
            for s in self.surfaces:
                s.gl_display_heatmap()
        if self.mode == "Show Metrics":
            #todo: draw a backdrop to represent the gaze that is not on any surface
            for s in self.surfaces:
                #draw a quad on surface with false color of value.
                s.gl_display_metrics()
示例#4
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        self.gl_display_cache_bars()
        for s in self.surfaces:
            s.gl_display_in_window(self.g_pool.image_tex)

        if self.mode.value in (0,1):
            for m in self.markers:
                hat = np.array([[[0,0],[0,1],[1,1],[1,0],[0,0]]],dtype=np.float32)
                hat = cv2.perspectiveTransform(hat,m_marker_to_screen(m))
                draw_gl_polyline(hat.reshape((5,2)),(0.1,1.,1.,.3),type='Polygon')
                draw_gl_polyline(hat.reshape((5,2)),(0.1,1.,1.,.6))

            for s in self.surfaces:
                s.gl_draw_frame()

        if self.mode.value == 1:
            for s in  self.surfaces:
                s.gl_draw_corners()
        if self.mode.value == 2:
            for s in  self.surfaces:
                s.gl_display_heatmap()
        if self.mode.value == 3:
            #draw a backdrop to represent the gaze that is not on any surface
            for s in self.surfaces:
                #draw a quad on surface with false color of value.
                s.gl_display_metrics()
示例#5
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        self.gl_display_cache_bars()
        for s in self.surfaces:
            s.gl_display_in_window(self.g_pool.image_tex)

        if self.mode == "Show Markers and Frames":
            for m in self.markers:
                hat = np.array([[[0,0],[0,1],[1,1],[1,0],[0,0]]],dtype=np.float32)
                hat = cv2.perspectiveTransform(hat,m_marker_to_screen(m))
                draw_polyline(hat.reshape((5,2)),color=RGBA(0.1,1.,1.,.3),line_type=GL_POLYGON)
                draw_polyline(hat.reshape((5,2)),color=RGBA(0.1,1.,1.,.6))

            for s in self.surfaces:
                s.gl_draw_frame(self.img_shape)

        if self.mode == "Surface edit mode":
            for s in self.surfaces:
                s.gl_draw_frame(self.img_shape)
                s.gl_draw_corners()

        if self.mode == "Show Heatmaps":
            for s in  self.surfaces:
                s.gl_display_heatmap()
        if self.mode == "Show Metrics":
            #todo: draw a backdrop to represent the gaze that is not on any surface
            for s in self.surfaces:
                #draw a quad on surface with false color of value.
                s.gl_display_metrics()
示例#6
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """

        for m in self.markers:
            hat = np.array(
                [[[0, 0], [0, 1], [.5, 1.3], [1, 1], [1, 0], [0, 0]]],
                dtype=np.float32)
            hat = cv2.perspectiveTransform(hat, m_marker_to_screen(m))
            draw_gl_polyline(hat.reshape((6, 2)), (0.1, 1., 1., .5))

        for s in self.surfaces:
            s.gl_draw_frame()

        if self.surface_edit_mode.value:
            for s in self.surfaces:
                s.gl_draw_corners()

        if self._window and self.surfaces:
            try:
                s = self.surfaces[self.show_surface_idx.value]
            except IndexError:
                s = None
            if s and s.detected:
                self.gl_display_in_window(s)
示例#7
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        if self.mode == "Show Markers and Surfaces":
            for m in self.markers:
                hat = np.array(
                    [[[0, 0], [0, 1], [.5, 1.3], [1, 1], [1, 0], [0, 0]]],
                    dtype=np.float32)
                hat = cv2.perspectiveTransform(hat, m_marker_to_screen(m))
                if m['perimeter'] >= self.min_marker_perimeter and m[
                        'id_confidence'] > self.min_id_confidence:
                    draw_polyline(hat.reshape((6, 2)),
                                  color=RGBA(0.1, 1., 1., .5))
                    draw_polyline(hat.reshape((6, 2)),
                                  color=RGBA(0.1, 1., 1., .3),
                                  line_type=GL_POLYGON)
                else:
                    draw_polyline(hat.reshape((6, 2)),
                                  color=RGBA(0.1, 1., 1., .5))

            for s in self.surfaces:
                if s not in self.edit_surfaces and s is not self.marker_edit_surface:
                    s.gl_draw_frame(self.img_shape)

            for s in self.edit_surfaces:
                s.gl_draw_frame(self.img_shape,
                                highlight=True,
                                surface_mode=True)
                s.gl_draw_corners()

            if self.marker_edit_surface:
                inc = []
                exc = []
                for m in self.markers:
                    if m['perimeter'] >= self.min_marker_perimeter:
                        if m['id'] in self.marker_edit_surface.markers:
                            inc.append(m['centroid'])
                        else:
                            exc.append(m['centroid'])
                draw_points(exc, size=20, color=RGBA(1., 0.5, 0.5, .8))
                draw_points(inc, size=20, color=RGBA(0.5, 1., 0.5, .8))
                self.marker_edit_surface.gl_draw_frame(self.img_shape,
                                                       color=(0.0, 0.9, 0.6,
                                                              1.0),
                                                       highlight=True,
                                                       marker_mode=True)

        elif self.mode == 'Show Heatmaps':
            for s in self.surfaces:
                if self.g_pool.app != 'player':
                    s.generate_heatmap()
                s.gl_display_heatmap()

        for s in self.surfaces:
            if self.locate_3d:
                s.gl_display_in_window_3d(self.g_pool.image_tex)
            else:
                s.gl_display_in_window(self.g_pool.image_tex)
示例#8
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        for m in self.markers:
            hat = np.array([[[0,0],[0,1],[.5,1.3],[1,1],[1,0],[0,0]]],dtype=np.float32)
            hat = cv2.perspectiveTransform(hat,m_marker_to_screen(m))
            draw_gl_polyline(hat.reshape((6,2)),(0.1,1.,1.,.5))

        for s in self.surfaces:
            s.gl_draw_frame()
            s.gl_display_in_window(self.g_pool.image_tex)

        if self.surface_edit_mode.value:
            for s in  self.surfaces:
                s.gl_draw_corners()
示例#9
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        for m in self.markers:
            hat = np.array([[[0,0],[0,1],[.5,1.3],[1,1],[1,0],[0,0]]],dtype=np.float32)
            hat = cv2.perspectiveTransform(hat,m_marker_to_screen(m))
            draw_gl_polyline(hat.reshape((6,2)),(0.1,1.,1.,.5))


        for s in self.surfaces:
            s.gl_draw_frame()
            s.gl_display_in_window(self.g_pool.image_tex)

        if self.surface_edit_mode.value:
            for s in  self.surfaces:
                s.gl_draw_corners()
示例#10
0
    def gl_display(self):
        """
        Display marker and surface info inside world screen
        """
        if self.mode == "Show Markers and Surfaces":
            for m in self.markers:
                hat = np.array([[[0, 0], [0, 1], [0.5, 1.3], [1, 1], [1, 0], [0, 0]]], dtype=np.float32)
                hat = cv2.perspectiveTransform(hat, m_marker_to_screen(m))
                if m["perimeter"] >= self.min_marker_perimeter:
                    draw_polyline(hat.reshape((6, 2)), color=RGBA(0.1, 1.0, 1.0, 0.5))
                    draw_polyline(hat.reshape((6, 2)), color=RGBA(0.1, 1.0, 1.0, 0.3), line_type=GL_POLYGON)
                else:
                    draw_polyline(hat.reshape((6, 2)), color=RGBA(0.1, 1.0, 1.0, 0.5))

            for s in self.surfaces:
                if s not in self.edit_surfaces and s is not self.marker_edit_surface:
                    s.gl_draw_frame(self.img_shape)

            for s in self.edit_surfaces:
                s.gl_draw_frame(self.img_shape, highlight=True, surface_mode=True)
                s.gl_draw_corners()

            if self.marker_edit_surface:
                inc = []
                exc = []
                for m in self.markers:
                    if m["perimeter"] >= self.min_marker_perimeter:
                        if self.marker_edit_surface.markers.has_key(m["id"]):
                            inc.append(m["centroid"])
                        else:
                            exc.append(m["centroid"])
                draw_points(exc, size=20, color=RGBA(1.0, 0.5, 0.5, 0.8))
                draw_points(inc, size=20, color=RGBA(0.5, 1.0, 0.5, 0.8))
                self.marker_edit_surface.gl_draw_frame(
                    self.img_shape, color=(0.0, 0.9, 0.6, 1.0), highlight=True, marker_mode=True
                )

        for s in self.surfaces:
            if self.locate_3d:
                s.gl_display_in_window_3d(self.g_pool.image_tex, self.camera_calibration)
            else:
                s.gl_display_in_window(self.g_pool.image_tex)