Exemple #1
0
    def update_fb(self):
        # read framebuffer
        fb = openmv.dump_fb()

        # convert to RGB888 and blit
        pixbuf = gtk.gdk.pixbuf_new_from_array(fb[2].reshape((fb[1], fb[0], 3)), gtk.gdk.COLORSPACE_RGB, 8)
        self.framebuffer.set_from_pixbuf(pixbuf)
        gobject.idle_add(omvgtk.update_fb);
Exemple #2
0
    def update_fb(self):
        # read framebuffer
        fb = openmv.dump_fb()

        # convert to RGB888 and blit
        pixbuf = gtk.gdk.pixbuf_new_from_array(
            fb[2].reshape((fb[1], fb[0], 3)), gtk.gdk.COLORSPACE_RGB, 8)
        pixbuf = pixbuf.scale_simple(fb[0] * 2, fb[1] * 2,
                                     gtk.gdk.INTERP_BILINEAR)
        self.framebuffer.set_from_pixbuf(pixbuf)
        gobject.idle_add(omvgtk.update_fb)
Exemple #3
0
# init openmv
openmv.init()

# init screen
screen = pygame.display.set_mode((160, 120), pygame.DOUBLEBUF, 32)

running = True
img_size = 160*120*2
Clock = pygame.time.Clock()
font = pygame.font.SysFont("monospace", 15)
while running:
    Clock.tick(60)

    # read framebuffer
    fb = openmv.dump_fb()

    if fb == None:
        continue

    # create image from RGB888
    image = pygame.image.frombuffer(fb[2].flat[0:], (fb[0], fb[1]), 'RGB')

    # blit stuff 
    screen.blit(image, (0, 0))
    screen.blit(font.render("FPS %.2f"%(Clock.get_fps()), 1, (255, 0, 0)), (0, 0))

    # update display
    pygame.display.flip()

    event = pygame.event.poll()
Exemple #4
0
# init openmv
openmv.init()

# init screen
screen = pygame.display.set_mode((160, 120), pygame.DOUBLEBUF, 32)

running = True
img_size = 160 * 120 * 2
Clock = pygame.time.Clock()
font = pygame.font.SysFont("monospace", 15)
while running:
    Clock.tick(60)

    # read framebuffer
    fb = openmv.dump_fb()

    if fb == None:
        continue

    # create image from RGB888
    image = pygame.image.frombuffer(fb[2].flat[0:], (fb[0], fb[1]), 'RGB')

    # blit stuff
    screen.blit(image, (0, 0))
    screen.blit(font.render("FPS %.2f" % (Clock.get_fps()), 1, (255, 0, 0)),
                (0, 0))

    # update display
    pygame.display.flip()