示例#1
0
    print "Camera modes:", cam0.modes
    cam0.mode = "640x480_Y8"  # the Y16 mode does not seem to work
    print "Used camera mode: %s" %(cam0.mode)

    matplotlib.interactive(True)
    fs = 12.5
    fig = pl.figure(num=1, figsize=(fs, fs))
    ax = fig.add_subplot(111)

    cam0.start(interactive=True)
    elements = None
    dimx, dimy = 640, 480
    pixelsize = 5.6

    while True:  # image collection and display
        try:
            data = np.array(cam0.current_image, dtype='f')
            if elements is None:  # First display, set up output screen
                elements = interface.createiface(data)
            else:  # Every other iteration just update data
                interface.updateiface(data, elements)
            pl.draw()
        except KeyboardInterrupt:
            print "Stopping"
            break
        except:
            break

    cam0.stop()
示例#2
0
    print "Used camera mode: %s" %(cam0.mode)
    print "Camera FPS: %.1f" %(cam0.fps)

    matplotlib.interactive(True)
    fig = pl.figure(num=1, figsize=(12.5, 12.5))

    cam0.start(interactive=True)
    imgnum = 0
    image = None
    cross = None
    pos = np.array(range(0, 640))
    ellipse = None
    fit = None    
    dimx, dimy = 640, 480
    xl = np.array(range(0, dimx))
    yl = np.array(range(0, dimy))

    timestamp = strftime("%y%m%d_%H%M%S")
    for index in range(picnum):
        data = cam0.current_image
        outname = 'beamprofile_%s_%d' %(timestamp, index)
        # save txt format for interoperation
        np.savetxt(outname+".txt", data, fmt="%d")
        interface.createiface(data)
        pl.title(outname)
        pl.savefig("%s.png" %outname)
    pl.draw()
    cam0.stop()

    pl.show()