处理时:
reproduceResultsSiggraph12
% Generates all the results for the SIGGRAPH paper at:
% http://people.csail.mit.edu/mrub/vidmag
%
% Copyright (c) 2011-2012 Massachusetts Institute of Technology,
% Quanta Research Cambridge, Inc.
%
% Authors: Hao-yu Wu, Michael Rubinstein, Eugene Shih
% License: Please refer to the LICENCE file
% Date: June 2012
%
clear;
dataDir = './data';
resultsDir = 'ResultsSIGGRAPH2012';
mkdir(resultsDir);
%% baby
% inFile = fullfile(dataDir,'baby.mp4'); % 路径拼接
% fprintf('Processing %s\n', inFile);
% amplify_spatial_lpyr_temporal_iir(inFile, resultsDir, 10, 16, 0.4, 0.05, 0.1);
% amplify_spatial_lpyr_temporal_iir 函数是一种放大算法,即空间滤波采用 拉普拉斯金字塔,时域滤波采用 IIR滤波器。
% Alternative processing using butterworth filter 使用巴特沃斯滤波器的替代处理
% amplify_spatial_lpyr_temporal_butter(inFile, resultsDir, 30, 16, 0.4, 3, 30, 0.1);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 butter 巴特沃斯滤波器
%% baby2
% inFile = fullfile(dataDir,'baby2.mp4');
% fprintf('Processing %s\n', inFile);
% amplify_spatial_Gdown_temporal_ideal(inFile,resultsDir,150,6, 140/60,160/60,30, 1);
% 空间滤波采用 Gaussian金字塔 时域滤波采用 Ideal bandpass
%% camera
% inFile = fullfile(dataDir,'camera.mp4');
% fprintf('Processing %s\n', inFile);
% amplify_spatial_lpyr_temporal_butter(inFile, resultsDir, 150, 20, 45, 100, 300, 0);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 butter 巴特沃斯滤波器
%% subway
% inFile = fullfile(dataDir,'subway.mp4');
% fprintf('Processing %s\n', inFile);
% amplify_spatial_lpyr_temporal_butter(inFile, resultsDir, 60, 90, 3.6, 6.2, 30, 0.3);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 butter 巴特沃斯滤波器
%% wrist
%% No mask is used here to generate the output video.
% inFile = fullfile(dataDir,'wrist.mp4');
% fprintf('Processing %s\n', inFile);
% amplify_spatial_lpyr_temporal_iir(inFile, resultsDir, 10, 16, 0.4, 0.05, 0.1);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 IIR滤波器
% Alternative processing using butterworth filter
% amplify_spatial_lpyr_temporal_butter(inFile, resultsDir, 30, 16, 0.4, 3, 30, 0.1);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 butter 巴特沃斯滤波器
%% shadow
% inFile = fullfile(dataDir,'shadow.mp4');
% fprintf('Processing %s\n', inFile);
% amplify_spatial_lpyr_temporal_butter(inFile, resultsDir, 5, 48, 0.5, 10, 30, 0);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 butter 巴特沃斯滤波器
%% guitar
% inFile = fullfile(dataDir,'guitar.mp4');
% fprintf('Processing %s\n', inFile);
% % amplify E
% amplify_spatial_lpyr_temporal_ideal(inFile, resultsDir, 50, 10, 72, 92, 600, 0);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 Ideal bandpass
% % amplify A
% amplify_spatial_lpyr_temporal_ideal(inFile, resultsDir, 100, 10, 100, 120, 600, 0);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 Ideal bandpass
%% face
% inFile = fullfile(dataDir,'myface.mp4');
% fprintf('Processing %s\n', inFile);
% amplify_spatial_Gdown_temporal_ideal(inFile,resultsDir,50,4, ...
% 50/60,60/60,30, 1);
% 空间滤波采用 Gaussian金字塔 时域滤波采用 Ideal bandpass
%% face2
inFile = fullfile(dataDir,'face2.mp4');
fprintf('Processing %s\n', inFile);
%
% % Motion 动作放大
% amplify_spatial_lpyr_temporal_butter(inFile,resultsDir,20,80, ...
% 0.5,10,30, 0);
% 空间滤波采用 lpyr 拉普拉斯金字塔,时域滤波采用 butter 巴特沃斯滤波器
% % Color 颜色放大
amplify_spatial_Gdown_temporal_ideal(inFile,resultsDir,50,6, ...
50/60,60/60,30, 1);
% amplify_spatial_Gdown_temporal_ideal(inFile,resultsDir,120,6, ...
% 0.8,1,30, 1);
% 空间滤波采用 Gaussian金字塔 时域滤波采用 Ideal bandpass
线性颜色和运动放大(SIGGRAPH 2012)
该代码包括以下空间和时间过滤器的组合
拉普拉斯金字塔理想带通
拉普拉斯金字塔巴特沃斯带通
拉普拉斯金字塔二阶 IIR 带通
高斯金字塔理想带通
reproduceResultsSiggraph13
clear;
dataDir = './data';
resultsDir = 'ResultsSIGGRAPH2013/';
mkdir(resultsDir);
defaultPyrType = 'halfOctave'; % Half octave pyramid is default as discussed in paper
% 如论文中所述,默认为半倍频程金字塔
scaleAndClipLargeVideos = true; % With this enabled, approximately 4GB of memory is used
% 启用此功能后,将使用大约 4GB 的内存
% Uncomment to use octave bandwidth pyramid: speeds up processing,
% but will produce slightly different results
%取消注释以使用倍频程带宽金字塔:加速处理,但会产生略有不同的结果
%defaultPyrType = 'octave';
% Uncomment to process full video sequences (uses about 16GB of memory)
% 取消注释以处理完整的视频序列(使用大约 16GB 的内存)
%scaleAndClipLargeVideos = false;
%% Car Engine
% inFile = fullfile(dataDir, 'car_engine.avi');
% samplingRate = 400; % Hz
% loCutoff = 15; % Hz
% hiCutoff = 25; % Hz
% alpha = 15;
% sigma = 3; % Pixels 像素
% pyrType = 'octave';
% if (scaleAndClipLargeVideos)
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType,'scaleVideo', 0.5);
% else
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType,'scaleVideo', 1);
% end
% % The sequence is very large. To save on CPU time, we set
% % pyramid type to 'octave'. If you have the resources or time, feel free to change it
% % to 'halfOctave'
% 序列非常大。 为了节省 CPU 时间,我们设置金字塔类型为“八度”。 如果您有资源或时间,请随时将其更改为“halfOctave”
%% Crane
% inFile = fullfile(dataDir, 'crane.avi');
% samplingRate = 24; % Hz
% loCutoff = 0.2; % Hz
% hiCutoff = 0.25; % Hz
% alpha = 100;
% sigma = 5; % Pixels
% temporalFilter = @FIRWindowBP;
% pyrType = defaultPyrType;
% if (scaleAndClipLargeVideos)
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType,'temporalFilter', temporalFilter,'scaleVideo', 2/3);
% else
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType,'temporalFilter', temporalFilter, 'scaleVideo', 1);
% end
% Crane Crop
% inFile = fullfile(dataDir, 'crane_crop.avi');
% samplingRate = 24; % Hz
% loCutoff = 0.2; % Hz
% hiCutoff = 0.25; % Hz
% alpha = 75;
% sigma = 5; % Pixels
% temporalFilter = @FIRWindowBP;
% Comparison of cropped crane 起重机比较
% pyrType = 'octave';
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType,'temporalFilter', temporalFilter);
%
% pyrType = 'halfOctave';
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType,'temporalFilter', temporalFilter);
%
% pyrType = 'quarterOctave';
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType,'temporalFilter', temporalFilter);
%% Eye
% inFile = fullfile(dataDir, 'eye.avi');
% samplingRate = 500; % Hz
% loCutoff = 30; % Hz
% hiCutoff = 50; % Hz
% alpha = 75;
% sigma = 4; % Pixels
% pyrType = 'octave';
%
% if (scaleAndClipLargeVideos)
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType, 'scaleVideo', 0.4);
% else
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType, 'scaleVideo', 1);
% end
% The sequence is very large. To save on memory and CPU time, we set
% pyramid type to 'octave'. If you have the resources, feel free to change it
% to 'halfOctave'
%% Trees
% inFile = fullfile(dataDir, 'trees.avi');
% samplingRate = 60; % Hz
% alpha = 25;
% sigma = 2; % Pixels
% attenuateOtherFrequencies = true;
% pyrType = defaultPyrType;
% Low frequencies
% loCutoff = 0.5; % Hz
% hiCutoff = 1; % Hz
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'attenuateOtherFreq', attenuateOtherFrequencies,'pyrType', pyrType);
% Middle frequencies
% loCutoff = 1.5;
% hiCutoff = 2;
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'attenuateOtherFreq', attenuateOtherFrequencies,'pyrType', pyrType);
%% Throat
% inFile = fullfile(dataDir, 'throat.avi');
% samplingRate = 1900; % Hz
% loCutoff = 90; % Hz
% hiCutoff = 110; % Hz
% alpha = 100;
% sigma = 3; % Pixels
% pyrType = 'octave';
%
% if (scaleAndClipLargeVideos)
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType, 'scaleVideo', 2/3);
% else
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'pyrType', pyrType, 'scaleVideo', 1);
% end
%% Woman
% inFile = fullfile(dataDir, 'woman.avi');
% samplingRate = 60; % Hz
% sigma = 3;
% alpha = 15;
% attenuateOtherFrequencies = true;
% pyrType = defaultPyrType;
%
% % Low frequencies
% loCutoff = 0.35;
% hiCutoff = 0.71;
% if (scaleAndClipLargeVideos)
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'attenuateOtherFreq', attenuateOtherFrequencies,'pyrType', pyrType, 'scaleVideo', 0.9);
% else
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'attenuateOtherFreq', attenuateOtherFrequencies,'pyrType', pyrType, 'scaleVideo', 1);
% end
% Middle frequencies 中频
% loCutoff = 1;
% hiCutoff = 1.9;
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma,'attenuateOtherFreq', attenuateOtherFrequencies,'pyrType', pyrType);
%% Jumping Boy
% inFile = fullfile(dataDir, 'stomp.avi');
% phaseAmplifyLargeMotions; % 用于处理 stomp 视频而不处理大动作且不使用所有内存的脚本
%% Comparisons with Wu et al.
% % Baby
% inFile = fullfile(dataDir, 'baby41.avi');
% loCutoff = 0.04;
% hiCutoff = 0.4;
% temporalFilter = @differenceOfIIR;
% alpha = 20;
% sigma = 5;
% pyrType = 'quarterOctave';
%
% if (scaleAndClipLargeVideos)
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, 1, resultsDir, 'sigma', sigma, 'pyrType', pyrType, 'temporalFilter', temporalFilter, 'scaleVideo', 0.8);
% else
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, 1, resultsDir, 'sigma', sigma, 'pyrType', pyrType, 'temporalFilter', temporalFilter, 'scaleVideo', 1);
% end
% Camera
% inFile = fullfile(dataDir, 'camera.mp4');
% samplingRate = 300;
% loCutoff = 36;
% hiCutoff = 62;
% temporalFilter = @differenceOfButterworths;
% alpha = 120;
% sigma = 5;
% pyrType = defaultPyrType;
% if (scaleAndClipLargeVideos)
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir, 'sigma', sigma, 'pyrType', pyrType, 'temporalFilter', temporalFilter, 'useFrames', [1 500]);
% else
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir, 'sigma', sigma, 'pyrType', pyrType, 'temporalFilter', temporalFilter);
% end
% Guitar
% inFile = fullfile(dataDir, 'guitar.mp4');
% samplingRate = 600;
% loCutoff = 72;
% hiCutoff = 92;
% alpha = 25;
% sigma = 2;
% pyrType = defaultPyrType;
% phaseAmplify(inFile, alpha, loCutoff, hiCutoff, samplingRate, resultsDir,'sigma', sigma, 'pyrType', pyrType);
%% Motion Attenuation 运动衰减
% Moon
% inFile = fullfile(dataDir, 'moon.avi');
% outFile = fullfile(resultsDir, 'moon-motionAttenuated.avi');
% motionAttenuateMedianPhase(inFile, outFile);
% %Face
% inFile = fullfile(dataDir, 'myface.mp4');
% motAttFile = fullfile(resultsDir, 'face_motionattenuated.avi');
% motionAttenuateFixedPhase(inFile, motAttFile);
% amplify_spatial_Gdown_temporal_ideal(motAttFile,resultsDir,100,4,50/60,60/60,30, 1);
% Shuttle
% inFile = fullfile(dataDir, 'shuttle.avi');
% outFile = fullfile(resultsDir, 'shuttle-motionAttenuated.avi');
% loCutoff = 0.05;
% motionAttenuateLowpassPhase(inFile, outFile, loCutoff);
基于相位的运动处理(SIGGRAPH 2013)
该代码包括使用频域中的理想带通滤波器和任意时域 LTI 滤波器运动放大视频的功能。它还包括衰减运动的代码。
使用任意时间滤波器放大运动
放大小动作,但保持大动作不变 (stomp.avi)
通过将所有相位固定到参考框架来衰减运动 (face.avi)
通过对相位应用中值滤波器来衰减运动 (moon.avi)