資源簡介
LK光流法的實現(xiàn)算法,內(nèi)容包括普通LK光流法,改進的金字塔算法,以及根據(jù)光流場計算下一幀圖像
代碼片段和文件信息
function?LK1
image1?=?imread(‘image1.png‘);
image2?=?imread(‘image2.png‘);
image1?=?rgb2gray(image1);
image2?=?rgb2gray(image2);
image1?=?single(image1);
image2?=?single(image2);
[dx1dy1]?=?gradient(image1);
[dx2dy2]?=?gradient(image2);
dx?=?1/2*(dx1+dx2);
dy?=?1/2*(dy1+dy2);
dt?=?image1?-?image2;
u?=?zeros(size(image1));?
v?=?zeros(size(image1));
window?=?9;
half?=?floor(window/2);
for?i?=?half+1:size(dx1)-half
????for?j?=?half+1:size(dx2)-half
????????tempdx?=?(dx(i-half:i+half?j-half:j+half))‘;
????????tempdy?=?(dy(i-half:i+half?j-half:j+half))‘;
????????tempdt?=?(dt(i-half:i+half?j-half:j+half))‘;
????????tempdx?=?tempdx(:);?
????????tempdy?=?tempdy(:);?
????????tempdt?=?tempdt(:);???
????????A?=?[tempdx?tempdy];??
????????U?=?-pinv(A‘*A)*A‘*tempdt;???
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????158936??2013-06-04?09:40??Code\image1.png
?????文件?????159975??2013-06-04?09:41??Code\image2.png
?????文件???????1565??2013-07-01?16:19??Code\LK1.m
?????文件???????3699??2013-07-07?15:02??Code\LK2.m
?????文件???????2237??2013-06-28?14:50??Code\smooth.m
?????目錄??????????0??2013-07-04?10:59??Code
-----------?---------??----------?-----??----
???????????????326412????????????????????6
評論
共有 條評論