Ejemplo n.º 1
0
    def quit(self, widget):
        # write last opened file
        with open(config_path, "w") as file:
            file.write(self.file_path)

        # stop any running code
        openmv.stop_script();
        # close VCP
        os.close(self.fd)
        # release OpenMV
        openmv.release()
        # exit
        sys.exit(0)
Ejemplo n.º 2
0
    def quit(self, widget):
        # write last opened file
        with open(config_path, "w") as file:
            file.write(self.file_path)

        # stop any running code
        openmv.stop_script()
        # close VCP
        os.close(self.fd)
        # release OpenMV
        openmv.release()
        # exit
        sys.exit(0)
Ejemplo n.º 3
0
    def disconnect(self):
        #reset terminal
        #self.terminal.set_pty(-1)
        #self.terminal.reset(True, True)

        try:
            # stop running code
            openmv.stop_script();
        except:
            pass

        # release OpenMV
        openmv.release()

        self.connected = False
        self._update_title()
        self.connect_button.set_sensitive(True)
        map(lambda x:x.set_sensitive(False), self.controls)
Ejemplo n.º 4
0
    def disconnect(self):
        #reset terminal
        #self.terminal.set_pty(-1)
        #self.terminal.reset(True, True)

        try:
            # stop running code
            openmv.stop_script();
        except:
            pass

        # release OpenMV
        openmv.release()

        self.connected = False
        self._update_title()
        self.connect_button.set_sensitive(True)
        map(lambda x:x.set_sensitive(False), self.controls)
Ejemplo n.º 5
0
    def do_disconnect(self):
        if self.connected:
            self.connected = False
            self.update_ui()
            self.framebuffer.stop_updater()

            openmv.stop_script()
            sleep(0.2)
            # release OpenMV
            openmv.release()
            sleep(0.2)
            openmv.reset()
            sleep(0.2)

            self.connector.start()
            self.statusBar().showMessage('Camera disconnected.')

            try:
                if self.serial and self.serial.isOpen():
                    print('Disconnecting terminal')
                    self.serial.close()
                    self.terminal.reset()
            except IOError as e:
                print('error disconnecting OpenMV Serial: %s' % e)
Ejemplo n.º 6
0
    # 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()
    if event.type == pygame.QUIT:
         running = False
    elif event.type == pygame.KEYDOWN:
        if event.key == pygame.K_ESCAPE:
            running = False
        if event.key == pygame.K_c:
            pygame.image.save(image, "capture.jpeg")


pygame.quit()
openmv.release()

Ejemplo n.º 7
0
    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()
    if event.type == pygame.QUIT:
        running = False
    elif event.type == pygame.KEYDOWN:
        if event.key == pygame.K_ESCAPE:
            running = False
        if event.key == pygame.K_c:
            pygame.image.save(image, "capture.png")

pygame.quit()
openmv.release()
Ejemplo n.º 8
0
    def quit(self, widget):
        os.close(self.fd)

        openmv.release()

        sys.exit(0)