• 大小: 601KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-07
  • 语言: Matlab
  • 标签: 光流  KLT  matlab  

资源简介

有两篇文章:Pyramidal Implementation of the Lucas Kanade Feature Tracker Description of the algorithm 以及它的翻译(当然不是我翻译的 如果有侵权的话联系我我就删啊 QAQ) 还有matlab计算光流 看文章有助于理解程序  ̄▽ ̄ y

资源截图

代码片段和文件信息

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%DENSE LUCAS KANADE PYRAMIDAL + ITERATIVE REFINMENT 
%J.MARZAT - ENSEM / INRIA Rocquencourt (France) julien.marzat@gmail.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Data acquisition
im1=single((imread(‘yos_img_10.pgm‘)));
im2=single((imread(‘yos_img_11.pgm‘)));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%parameters : levels number window size iterations number regularization
numLevels=3; %Lm:height of the pyramid.(234)
window=9;% integration window
iterations=1;
alpha = 0.001;

hw = floor(window/2); %WxWy?
t0=clock;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%pyramids creation
pyramid1 = im1;
pyramid2 = im2;
%init
for i=2:numLevels
    im1 = impyramid(im1 ‘reduce‘);
    im2 = impyramid(im2 ‘reduce‘);
    pyramid1(1:size(im11) 1:size(im12) i) = im1;
    pyramid2(1:size(im21) 1:size(im22) i) = im2;
end;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Processing all levels
for p = 1:numLevels
   
    %current pyramid
    im1 = pyramid1(1:(size(pyramid11)/(2^(numLevels - p))) 1:(size(pyramid12)/(2^(numLevels - p))) (numLevels - p)+1);
    im2 = pyramid2(1:(size(pyramid21)/(2^(numLevels - p))) 1:(size(pyramid22)/(2^(numLevels - p))) (numLevels - p)+1);
       
    %init
    if p==1
    u=zeros(size(im1));%Vx
    v=zeros(size(im1));%Vy
    else  
    %resizing
    u = 2 * imresize(usize(u)*2‘bilinear‘);   
    v = 2 * imresize(vsize(v)*2‘bilinear‘);
    end
    
    %refinment loop
    for r = 1:iterations
   
    u=round(u);
    v=round(v);
    
    %every pixel loop
        for i = 1+hw:size(im11)-hw
            for j = 1+hw:size(im22)-hw
            patch1 = im1(i-hw:i+hw j-hw:j+hw);
      
            %moved patch 
            lr = i-hw+v(ij);
            hr = i+hw+v(ij);
            lc = j-hw+u(ij);
            hc = j+hw+u(ij);
           
                  if (lr < 1)||(hr > size(im11))||(lc < 1)||(hc > size(im12))  
                  %Regularized least square processing
                  else
                  patch2 = im2(lr:hr lc:hc);
      
                  fx = conv2(patch1 0.25* [-1 1; -1 1]) + conv2(patch2 0.25*[-1 1; -1 1]);
                  fy = conv2(patch1 0.25* [-1 -1; 1 1]) + conv2(patch2 0.25*[-1 -1; 1 1]);
                  ft = conv2(patch1 0.25*ones(2)) + conv2(patch2 -0.25*ones(2));

      
                  Fx = fx(2:window-12:window-1)‘;
                  Fy = fy(2:window-12:window-1)‘;
                  Ft = ft(2:window-12:window-1)‘;

                  A = [Fx(:) Fy(:)];      
                  G=A‘*A;
              
                  G(11)=G(11)+alpha; G(22)=G(22)+alpha;
                  U=1/(G(11)*G(22)-G(12)*G(21))*[G(22) -G(12);-G(21) G(11)]*A‘*-Ft(:);
                  u(i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1334  2010-03-08 04:31  LKPR-marzat\license.txt

     文件       3324  2013-10-15 09:41  LKPR-marzat\LKPR.m

     文件     270836  2012-12-11 18:17  LKPR-marzat\Pyramidal_Implementation_of_the_Lucas_Kanade_Feature_Tracker_Description_of_the_algorithm.pdf

     文件       1285  2008-04-30 15:34  LKPR-marzat\showmap3.m

     文件      79647  2003-04-18 21:18  LKPR-marzat\yos_img_10.pgm

     文件      79647  2003-04-18 21:18  LKPR-marzat\yos_img_11.pgm

     文件     350669  2012-12-11 21:13  LKPR-marzat\基于金字塔的LK特征点跟踪算法.pdf

     目录          0  2013-10-15 13:30  LKPR-marzat

----------- ---------  ---------- -----  ----

               786742                    8


评论

共有 条评论