Ejemplo n.º 1
0
    def __init__(self):
        logging.info('Initialising vision')
        #required on DICE:
        #self.capture = MPlayerCapture(self.rawSize)
        self.capture = Capture(self.rawSize)

        world = World('blue') # arbitrary colour
        world.pointer=None

        self.threshold = vision.threshold.AltRaw()
        self.pre = Preprocessor(self.rawSize, self.threshold, None)
        self.gui = GUI(world, self.rawSize, self.threshold)
        logging.debug('Vision initialised')
Ejemplo n.º 2
0
class BasicVision():
    #rawSize = (768,576)
    rawSize = (640, 480)

    def __init__(self):
        logging.info('Initialising vision')
        #required on DICE:
        #self.capture = MPlayerCapture(self.rawSize)
        self.capture = Capture(self.rawSize)

        world = World('blue') # arbitrary colour
        world.pointer=None

        self.threshold = vision.threshold.AltRaw()
        self.pre = Preprocessor(self.rawSize, self.threshold, None)
        self.gui = GUI(world, self.rawSize, self.threshold)
        logging.debug('Vision initialised')

    def processFrame(self):
        logging.debug("Capturing a frame")
        startTime = time.time()
        frame = self.capture.getFrame()
        ents = {'yellow':None, 'blue':None, 'balls':[]}

        logging.debug("Updating GUI")
        self.gui.updateWindow('standard', frame)
        self.gui.updateWindow('foreground', frame)
        self.gui.draw(ents, startTime)

    def run(self):
        while not self.gui.quit:
            self.processFrame()