コード例 #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 test_uint8_to_float_and_back_for_video():
    vid_data, fps = _load_video(TEST_VIDEO_PATH)
    vid_float = uint8_to_float(vid_data)
    vid_unit8 = float_to_uint8(vid_float)
    vid_diff = vid_data - vid_unit8

    play_vid_data(vid_float)

    assert vid_diff.max() <= 1
コード例 #3
0
def test_eularian_magnification():
    # ('baby', 10, 16, 0.4, 3, 30),
    orig_vid, fps = load_video_float(TEST_VIDEO_PATH)
    enhanced_vid = eulerian_magnification(orig_vid,
                                          fps=30,
                                          freq_max=0.77,
                                          freq_min=0.4,
                                          amplification=30)
    play_vid_data(enhanced_vid)
コード例 #4
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
コード例 #5
0
def test_eularian_magnification():
    # ('baby', 10, 16, 0.4, 3, 30),
    orig_vid, fps = load_video_float(TEST_VIDEO_PATH)
    enhanced_vid = eulerian_magnification(orig_vid, fps=30, freq_max=0.77, freq_min=0.4, amplification=30)
    play_vid_data(enhanced_vid)