资源简介

视频中运动的放大,欧拉运动放大,包含实例视频,以及代码使用方法。

资源截图

代码片段和文件信息

% amplify_spatial_Gdown_temporal_ideal(vidFile outDir alpha 
%                                      level fl fh samplingRate 
%                                      chromAttenuation)
%
% Spatial Filtering: Gaussian blur and down sample
% Temporal Filtering: Ideal bandpass

% 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
%
function amplify_spatial_Gdown_temporal_ideal(vidFileoutDiralphalevel ...
                     flfhsamplingRate chromAttenuation)
 

    [~vidName] = fileparts(vidFile);

    outName = fullfile(outDir[vidName ‘-ideal-from-‘ num2str(fl) ...
                           ‘-to-‘ num2str(fh) ...
                           ‘-alpha-‘ num2str(alpha) ...
                           ‘-level-‘ num2str(level) ...
                           ‘-chromAtn-‘ num2str(chromAttenuation) ‘.avi‘]);


    % Read video
    vid = VideoReader(vidFile);
    % Extract video info
    vidHeight = vid.Height;
    vidWidth = vid.Width;
    nChannels = 3;
    fr = vid.frameRate;
    len = vid.NumberOfframes;
    temp = struct(‘cdata‘ zeros(vidHeight vidWidth nChannels ‘uint8‘) ‘colormap‘ []);

    startIndex = 1;
    endIndex = len-10;

    vidOut = VideoWriter(outName);
    vidOut.frameRate = fr;

    open(vidOut)


    % compute Gaussian blur stack
    disp(‘Spatial filtering...‘)
    Gdown_stack = build_GDown_stack(vidFile startIndex endIndex level);
    disp(‘Finished‘)
    
    
    % Temporal filtering
    disp(‘Temporal filtering...‘)
    filtered_stack = ideal_bandpassing(Gdown_stack 1 fl fh samplingRate);
    disp(‘Finished‘)
    
    %% amplify
    filtered_stack(:::1) = filtered_stack(:::1) .* alpha;
    filtered_stack(:::2) = filtered_stack(:::2) .* alpha .* chromAttenuation;
    filtered_stack(:::3) = filtered_stack(:::3) .* alpha .* chromAttenuation;



    %% Render on the input video
    disp(‘Rendering...‘)
    % output video
    k = 0;
    for i=startIndex:endIndex
        k = k+1
        temp.cdata = read(vid i);
        [rgbframe~] = frame2im(temp);
        rgbframe = im2double(rgbframe);
        frame = rgb2ntsc(rgbframe);

        filtered = squeeze(filtered_stack(k:::));

        filtered = imresize(filtered[vidHeight vidWidth]);

        filtered = filtered+frame;

        frame = ntsc2rgb(filtered);

        frame(frame > 1) = 1;
        frame(frame < 0) = 0;


        writeVideo(vidOutim2uint8(frame));
    end

    disp(‘Finished‘)
    close(vidOut);

end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-07-05 21:16  EVM_Matlab\
     文件        2633  2013-03-03 22:17  EVM_Matlab\amplify_spatial_Gdown_temporal_ideal.m
     文件        5145  2014-05-29 16:30  EVM_Matlab\amplify_spatial_lpyr_temporal_butter.m
     文件        3808  2013-03-03 22:17  EVM_Matlab\amplify_spatial_lpyr_temporal_ideal.m
     文件        4916  2013-03-03 22:17  EVM_Matlab\amplify_spatial_lpyr_temporal_iir.m
     文件         495  2013-03-03 22:17  EVM_Matlab\blurDnClr.m
     文件         517  2013-03-03 22:17  EVM_Matlab\blurUpClr.m
     文件        1705  2013-03-03 22:17  EVM_Matlab\build_GDown_stack.m
     文件        1804  2013-03-03 22:17  EVM_Matlab\build_Lpyr_stack.m
     文件         105  2013-03-03 22:17  EVM_Matlab\ChangeLog.txt
     文件         730  2013-03-03 22:17  EVM_Matlab\create_mask.m
     目录           0  2014-07-05 21:24  EVM_Matlab\data\
     文件     1839450  2013-04-27 10:30  EVM_Matlab\data\baby.mp4
     文件     5091781  2013-04-27 10:30  EVM_Matlab\data\baby2.mp4
     文件     9065924  2013-04-27 10:32  EVM_Matlab\data\camera.mp4
     文件     1639646  2013-04-25 09:15  EVM_Matlab\data\face.mp4
     文件     2819114  2013-04-27 10:31  EVM_Matlab\data\shadow.mp4
     文件     5038250  2013-04-27 10:31  EVM_Matlab\data\subway.mp4
     文件     2002507  2013-04-27 10:32  EVM_Matlab\data\wrist.mp4
     文件        1190  2013-03-03 22:17  EVM_Matlab\ideal_bandpassing.m
     文件          62  2013-03-03 22:17  EVM_Matlab\install.m
     文件       17296  2013-03-03 22:17  EVM_Matlab\LICENSE.pdf
     文件         132  2013-03-03 22:17  EVM_Matlab\make.m
     目录           0  2014-07-05 21:16  EVM_Matlab\matlabPyrTools\
     文件         309  2013-03-03 22:17  EVM_Matlab\matlabPyrTools\binomialFilter.m
     文件        1731  2013-03-03 22:17  EVM_Matlab\matlabPyrTools\blur.m
     文件        1364  2013-03-03 22:17  EVM_Matlab\matlabPyrTools\blurDn.m
     文件        1931  2013-03-03 22:17  EVM_Matlab\matlabPyrTools\buildGpyr.m
     文件        2632  2013-03-03 22:17  EVM_Matlab\matlabPyrTools\buildLpyr.m
     文件        2713  2013-03-03 22:17  EVM_Matlab\matlabPyrTools\buildSCFpyr.m
     文件        2187  2013-03-03 22:17  EVM_Matlab\matlabPyrTools\buildSCFpyrLevs.m
............此处省略265个文件信息

评论

共有 条评论