Пример #1
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(),
            AxonVisualiser(caption="Axon / Kamaelia Visualiser", **dictArgs))
Пример #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")