资源简介

自己编写的计算光流场的源码,基于梯度的方法,非常简单

资源截图

代码片段和文件信息

function [UV] = OpticalFlow(Img1Img2iter_numalpha)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This MATLAB codes calculate optical flow of two consecutive frames(images)
% using Horn & Schunck‘s method.
% Input:
%        Img1Img2  :  image data
%        iter_num   :  the time of iteration
%          alpha    :  wighting coefficient
% Author:
%        Huazhong University of Science and Technology
%           Institute of Pattern Recognition and Artificial Intelligence
%               Lee Chi
% Contact me: leechi1010@163.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Pre_process
[height_1width_1dim_1] = size(Img1);
if dim_1 == 3
    Img1 = rgb2gray(Img1);
end
[height_2width_2dim_2] = size(Img2

评论

共有 条评论