def test_eulerian_magnification(): # ('baby', 10, 16, 0.4, 3, 30), orig_vid, fps = load_video_float(get_test_media_filepath(TEST_VIDEO_NAME)) enhanced_vid = eulerian_magnification(orig_vid, fps=30, freq_max=0.77, freq_min=0.4, amplification=30) if DISPLAY_RESULTS: play_vid_data(enhanced_vid) del enhanced_vid
def test_laplacian_video(): orig_vid, fps = load_video_float(get_test_media_filepath(TEST_VIDEO_NAME)) pyramid = create_laplacian_video_pyramid(orig_vid, 3) if DISPLAY_RESULTS: play_pyramid(pyramid) recomposed_video = collapse_laplacian_video_pyramid(pyramid) assert (recomposed_video == orig_vid).all() del pyramid del recomposed_video
def replicate_study(): download_videos() image_processing = 'laplacian' pyramid_levels = 4 for name, amplification_factor, cutoff, lower_hertz, upper_hertz, framerate in PAPER_REPLICATION_VALUES: source_filename = name + '.mp4' source_path = os.path.join(SOURCE_VIDEOS_DIR, source_filename) vid, fps = load_video_float(source_path) vid = em.eulerian_magnification( vid, fps, freq_min=lower_hertz, freq_max=upper_hertz, amplification=amplification_factor, pyramid_levels=pyramid_levels ) file_name = os.path.splitext(source_path)[0] file_name = file_name + "__" + image_processing + "_levels" + str(pyramid_levels) + "_min" + str( lower_hertz) + "_max" + str(upper_hertz) + "_amp" + str(amplification_factor) save_video(vid, fps, file_name + '.avi')
def test_create_gaussian_video(): orig_vid, fps = load_video_float(get_test_media_filepath(TEST_VIDEO_NAME)) pyramid = create_gaussian_video_pyramid(orig_vid, 3) if DISPLAY_RESULTS: play_pyramid(pyramid) del pyramid
def test_fourier_transform_video(): vid_data, fps = load_video_float(get_test_media_filepath(TEST_VIDEO_NAME)) if DISPLAY_RESULTS: show_frequencies(vid_data, fps)
def test_eulerian_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)
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()
def test_create_gaussian_video(): orig_vid, fps = load_video_float(TEST_VIDEO_PATH) pyramid = create_gaussian_video_pyramid(orig_vid, 3) play_pyramid(pyramid)
def test_fourier_transform_video(): vid_data, fps = load_video_float(TEST_VIDEO_PATH) show_frequencies(vid_data, fps)