?? computelkflowparms.m
字號:
% [Ht, G]=ComputeLKFlowParms(img)
%
% Computes the optical flow parameters. The image is derived in DX and DY
% directions and matrix G is computed.
%
% Inputs:
% img - The image to compute optical flow parameters. Note that the image
% must contain a border of size 1 since the DX and DY operation work
% on 3x3 regions.
%
% Outpus:
% Ht - The transpose of matrix H, which defines the LK affine approximation of an shifted
% image
%
% G - The matrix G=H'*H
%
function [Ht, G]=ComputeLKFlowParms(img)
% Compute Ix and Iy derivatives using sobel operator
Hdy = fspecial('sobel');
Hdx = Hdy';
Ix=imfilter(img, Hdx);
Iy=imfilter(img, Hdy);
Ix=Ix(2:end-1,2:end-1);
Iy=Iy(2:end-1,2:end-1);
% Compute G
H = [Ix(:) Iy(:)];
Ht=H';
G=Ht*H;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -