Esempio n. 1
0
def main():
    mystate = state()
    while (True):
        screen.fill(0x181818)
        mouse.run()
        mystate.run()
        mytimer.tick(60)
        pygame.display.flip()
Esempio n. 2
0
def loop():
    while (True):
        screen.fill(0x181818)
        mouse.run()
        mode = myctrl.run()
        if mode != None:
            print mode
            currentMode = mode

        mytimer.tick(30)
        pygame.display.flip()
Esempio n. 3
0
    def scan(self, resize=False, width=1500, height=880):
        ''' Main function, which scans the image. '''

        # add image here.
        # We can also use laptop's webcam if the resolution is good enough to capture
        # readable document content
        image = self.image

        # resize image so it can be processed
        # choose optimal dimensions such that important content is not lost
        if resize:
            image = cv2.resize(image, (width, height))

        crd = mouse.run(image)

        crop = image[int(crd[1]):int(crd[3]), int(crd[0]):int(crd[2])]

        gray = cv2.cvtColor(crop, cv2.COLOR_BGR2GRAY)

        retr, thresh = cv2.threshold(gray, 0, 255,
                                     cv2.THRESH_BINARY + cv2.THRESH_OTSU)
        th2 = cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_MEAN_C,\
            cv2.THRESH_BINARY,11,2)
        th3 = cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\
            cv2.THRESH_BINARY,11,2)

        self.scanned = thresh
        self.mean = th2
        self.gauss = th3

        self.show_scanned()
Esempio n. 4
0
    def main():

        print exitbutton
        while True:
            screen.fill(0x222222)
            mybutton.run()
            exitbutton.run()
            myslider.run()
            mytoggle.run()
            mydrop.run()
            myText.run()
            if mydrop.change:
                print mydrop.change
            pygame.display.flip()
            mytimer.tick(60)
            mouse.run()
Esempio n. 5
0
                                      ((1 - t) *
                                       (1 - t)) * t) * p1[0] + 3 * (1 - t) * (
                                           t * t) * p2[0] + (t * t * t) * p3[0]
            by = ((1 - t) * (1 - t) *
                  (1 - t)) * p0[1] + (3 *
                                      ((1 - t) *
                                       (1 - t)) * t) * p1[1] + 3 * (1 - t) * (
                                           t * t) * p2[1] + (t * t * t) * p3[1]
            pointlist.append((bx, by))
            t += 0.02
        pygame.draw.aalines(screen, (100, 255, 255), False, pointlist)


if __name__ == "__main__":

    circ1 = Variable("Magnus", 40, 40)
    circ2 = Variable("Arne", 460, 400)
    line1 = Line(circ1, circ2)

    while (True):

        screen.fill(0x101010)

        circ1.run()
        circ2.run()
        line1.draw(DRAW_GRID)

        mouse.run()
        pygame.display.flip()
        mytimer.tick(24)
Esempio n. 6
0
def mouse():
    run()
    return "Hello World!"