• evm 代码分析


    处理时:

    • 为了放大运动,我们推荐我们新的基于相位的管道(SIGGRAPH 2013)。
    • 要放大颜色,请使用线性管道(SIGGRAPH 2012)。
    • 选择您想要放大的正确时间尺度。 例如,成年人的心跳往往每秒发生一次,对应于 1Hz,您可以将内容放大 0.5Hz 到 3Hz 以确保安全。 间隔越窄,放大越集中,噪声被放大的越少,但有遗漏物理现象的风险。
    • 在指定时间通带时不要忘记考虑视频帧速率! 有关示例,请参见我们的代码。

    先介绍2012相位欧拉代码

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98

    线性颜色和运动放大(SIGGRAPH 2012)

    该代码包括以下空间和时间过滤器的组合
    在这里插入图片描述
    拉普拉斯金字塔理想带通
    拉普拉斯金字塔巴特沃斯带通
    拉普拉斯金字塔二阶 IIR 带通
    高斯金字塔理想带通
    在这里插入图片描述

    以上是2012线性欧拉相关信息

    下面介绍2013相位欧拉代码

    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);
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214

    基于相位的运动处理(SIGGRAPH 2013)
    该代码包括使用频域中的理想带通滤波器和任意时域 LTI 滤波器运动放大视频的功能。它还包括衰减运动的代码。
    在这里插入图片描述
    使用任意时间滤波器放大运动
    放大小动作,但保持大动作不变 (stomp.avi)
    通过将所有相位固定到参考框架来衰减运动 (face.avi)
    通过对相位应用中值滤波器来衰减运动 (moon.avi)
    在这里插入图片描述

  • 相关阅读:
    Web前端:Web 项目的前14个React图表库
    uniapp 模拟请求自身的JSON模拟数据
    iOS中UIColor,CGColor,CIColor详解
    深入理解Docker自定义网络:构建高效的容器网络环境
    秋招在线人才测评考什么内容?
    我和EarthSDK Cesium那点事(零)
    JAVA图书管理练习
    将你的桌面变成一个雨滴窗口:关于两个有趣的应用的整合
    Go/Golang语言学习实践[回顾]教程09--学习成绩统计的示例【上】
    使用JAVA CompletableFuture实现流水线化的并行处理,深度实践总结
  • 原文地址:https://blog.csdn.net/weixin_46118768/article/details/126332368