コード例 #1
0
# apply dust particles
if APPLY_DUST:
    dust1 = plt.imread(DUST1_PATH)[0:SHAPE[0], 0:SHAPE[1],
                                   0]  #float normalized to (0,1)
    dust2 = plt.imread(DUST2_PATH)[0:SHAPE[0], 0:SHAPE[1],
                                   0]  #float normalized to (0,1)

    dust = ((dust1, dust2), ) * NFRAMES_DUAL
    video = multiply(video, dust, dtype="uint16")

noise_model = (NOISE_MODEL, NOISE_MODEL)

video = (tuple((adc(f,
                    noise_model=noise_model[i],
                    saturation=SATURATION,
                    readout_noise=READOUT_NOISE,
                    bit_depth=BIT_DEPTH) for i, f in enumerate(frames)))
         for frames in video)

#video = load(video, NFRAMES_DUAL)

if __name__ == "__main__":

    #: no need to load video, but this way we load video into memory, and we
    #: can scroll back and forth with the viewer. Uncomment the line below
    if SAVEFIG:
        video = load(video, NFRAMES_DUAL)  # loads and displays progress bar
        import matplotlib.pyplot as plt
        plt.figure(figsize=(8, 3))
        plt.subplot(121)
コード例 #2
0
ファイル: full_video.py プロジェクト: inwwin/cddm
                              intensity=INTENSITY,
                              dtype="uint16")

#: crop video to selected region of interest
video = crop(video, roi=((0, SHAPE[0]), (0, SHAPE[1])))

#: apply dust particles
if APPLY_DUST:
    dust = plt.imread(DUST1_PATH)[0:SHAPE[0], 0:SHAPE[1],
                                  0]  #float normalized to (0,1)
    dust = ((dust, ), ) * NFRAMES_FULL
    video = multiply(video, dust)

video = (tuple((adc(f,
                    noise_model=NOISE_MODEL,
                    saturation=SATURATION,
                    readout_noise=READOUT_NOISE,
                    bit_depth=BIT_DEPTH) for f in frames)) for frames in video)

if __name__ == "__main__":
    #: no need to load video, but this way we load video into memory, and we
    #: can scroll back and forth with the viewer. Uncomment the line below.
    #video = load(video, NFRAMES) # loads and displays progress bar

    #: VideoViewer either expects a multi_frame iterator, or a numpy array
    viewer = VideoViewer(video,
                         count=NFRAMES_FULL,
                         vmin=0,
                         cmap="gray",
                         vmax=VMAX)
    viewer.show()