示例#1
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")