コード例 #1
0
def eulerian_magnification(vid_data,
                           fps,
                           freq_min,
                           freq_max,
                           amplification,
                           pyramid_levels=4,
                           skip_levels_at_top=2):
    vid_pyramid = create_laplacian_video_pyramid(vid_data,
                                                 pyramid_levels=pyramid_levels)
    for i, vid in enumerate(vid_pyramid):
        if i < skip_levels_at_top or i >= len(vid_pyramid) - 1:
            # ignore the top and bottom of the pyramid. One end has too much noise and the other end is the
            # gaussian representation
            continue

        bandpassed = temporal_bandpass_filter(
            vid,
            fps,
            freq_min=freq_min,
            freq_max=freq_max,
            amplification_factor=amplification)

        play_vid_data(bandpassed)

        vid_pyramid[i] += bandpassed
        play_vid_data(vid_pyramid[i])

    vid_data = collapse_laplacian_video_pyramid(vid_pyramid)
    return vid_data
コード例 #2
0
def eulerian_magnification(vid_data, fps, freq_min, freq_max, amplification, pyramid_levels=4, skip_levels_at_top=2):
    vid_pyramid = create_laplacian_video_pyramid(vid_data, pyramid_levels=pyramid_levels)
    for i, vid in enumerate(vid_pyramid):
        if i < skip_levels_at_top or i >= len(vid_pyramid) - 1:
            # ignore the top and bottom of the pyramid. One end has too much noise and the other end is the
            # gaussian representation
            continue

        bandpassed = temporal_bandpass_filter(vid, fps, freq_min=freq_min, freq_max=freq_max, amplification_factor=amplification)

        play_vid_data(bandpassed)

        vid_pyramid[i] += bandpassed
        play_vid_data(vid_pyramid[i])

    vid_data = collapse_laplacian_video_pyramid(vid_pyramid)
    return vid_data
コード例 #3
0
def test_laplacian_video():
    orig_vid, fps = load_video_float(TEST_VIDEO_PATH)
    pyramid = create_laplacian_video_pyramid(orig_vid, 3)
    play_pyramid(pyramid)
    recomposed_video = collapse_laplacian_video_pyramid(pyramid)
    assert (recomposed_video == orig_vid).all()
コード例 #4
0
def test_laplacian_video():
    orig_vid, fps = load_video_float(TEST_VIDEO_PATH)
    pyramid = create_laplacian_video_pyramid(orig_vid, 3)
    play_pyramid(pyramid)
    recomposed_video = collapse_laplacian_video_pyramid(pyramid)
    assert (recomposed_video == orig_vid).all()