示例#1
0
文件: 1.py 项目: thangduong/kamaelia
                        "CHANGEDISPLAYGEO": True,
                        "surface": surface,
                        "position": (800, i)
                    }, "display_signal")
                time.sleep(0.02)
                yield 1

            for i in xrange(800, 100, -10):
                self.send(
                    {
                        "CHANGEDISPLAYGEO": True,
                        "surface": surface,
                        "position": (i, 600)
                    }, "display_signal")
                time.sleep(0.02)
                yield 1

            for i in xrange(600, 100, -10):
                self.send(
                    {
                        "CHANGEDISPLAYGEO": True,
                        "surface": surface,
                        "position": (100, i)
                    }, "display_signal")
                time.sleep(0.02)
                yield 1


PygameDisplay(width=1024, height=768, fullscreen=0).activate()
Cat().run()
示例#2
0
if __name__ == "__main__":

    from Kamaelia.Util.Console import ConsoleEchoer

    dictArgs, optlist, remargs = parseArgs(sys.argv[1:])

    if "help" in dictArgs:
        print(dictArgs["help"])
        sys.exit(0)

    resolution = dictArgs.get("screensize", (800, 600))
    doNavelgaze = dictArgs.pop("navelgaze", None)
    doIntrospect = dictArgs.pop("introspect", None)

    pgd = PygameDisplay(width=resolution[0], height=resolution[1]).activate()
    PygameDisplay.setDisplayService(pgd)

    if doIntrospect is not None:
        (server, port) = doIntrospect

        Pipeline(Introspector(), TCPClient(server, port)).activate()

    if doNavelgaze:
        if "serverPort" in dictArgs:
            raise ValueError(
                "Makes no sense to navelgaze and use --port option - they're mutually exclusive"
            )
        app = Pipeline(
            Introspector(), ConsoleEchoer(forwarder=True),
            text_to_token_lists(),
示例#3
0
    from VideoSurface import VideoSurface

    class Framer(Axon.Component.component):
        def main(self):
            while 1:
                while self.dataReady("inbox"):
                    D = self.recv("inbox")
                    print D, D[1].get_width(),D[1].get_height(),
                    X = {
                          "yuv" : (D[1], D[1], D[1]),  # a tuple of strings
                          "size" : (D[1].get_width(), D[1].get_width()),          # in pixels
                          "pixformat" :  "YUV420_planar"    # format of raw video data
                        }
                    self.send(X, "outbox")
                yield 1
    X = PygameDisplay(width=640,height=480).activate()
    PygameDisplay.setDisplayService(X)
    Pipeline(
        VideoCaptureSource(fps=32),
#        Framer(),
#        VideoOverlay(),
        ProperSurfaceDisplayer(),
    ).run()

if 1:
    X = VideoCaptureSource(fps=32)
    snap = X.capture_one()

    pygame.image.save(snap, "photo.bmp")
#    pygame.image.save(snap, "photo.png")