资源简介
matlab运动估计代码.里面有源图像和运行结果.对写论文应该有帮助
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Name: Musawir Ali Shah
%%% Assignment #3
%%% Project title: Lucas Kanade Motion Estimation Using Pyramids (Level 4)
%%% Note: The project specification says use density of 10 in plotting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Usage: Lucas_Kanade(‘1.bmp‘‘2.bmp‘10)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Lucas_Kanade(file1file2density);
%% Read Images %%
img1 = im2double (imread (file1));
%% Take alternating rows and columns %%
[odd1 even1] = split (img1);
img2 = im2double (imread (file2));
[odd2 even2] = split (img2);
%% Run Lucas Kanade %%
[Dx Dy] = Estimate (odd1 odd2);
%% Plot %%
figure;
[maxImaxJ]=size(Dx);
Dx=Dx(1:density:maxI1:density:maxJ);
Dy=Dy(1:density:maxI1:density:maxJ);
quiver(1:density:maxJ(maxI):(-density):1Dx-Dy1);
axis square;
%% Run Lucas Kanade on all levels and interpolate %%
function [Dx Dy] = Estimate (img1 img2)
level = 4;
half_window_size=2;
[m n] = size (img1);
G00 = img1; G10 = img2;
if (level>0)
G01 = reduce (G00); G11 = reduce (G10);
end
if (level>1)
G02 = reduce (G01); G12 = reduce (G11);
end
if (level>2)
G03 = reduce (G02); G13 = reduce (G12);
end
if (level>3)
G04 = reduce (G03); G14 = reduce (G13);
end
l = level;
for i=level:-1:0
if (l == level)
switch (l)
case 4 Dx = zeros (size (G04)); Dy = zeros (size (G04));
case 3 Dx = zeros (size (G03)); Dy = zeros (size (G03));
case 2 Dx = zeros (size (G02)); Dy = zeros (size (G02));
case 1 Dx = zeros (size (G01)); Dy = zeros (size (G01));
case 0 Dx = zeros (size (G00)); Dy = zeros (size (G00));
end
else
Dx = expand (Dx); Dy = expand (Dy);
Dx = Dx .* 2; Dy = Dy .* 2;
end
switch (l)
case 4
W = warp (G04 Dx Dy);
[Vx Vy] = EstimateMotion (W G14 half_window_size);
case 3
W = warp (G03 Dx Dy);
[Vx Vy] = EstimateMotion (W G13 half_window_size);
case 2
W = warp (G02 Dx Dy);
[Vx Vy] = EstimateMotion (W G12 half_window_size);
case 1
W = warp (G01 Dx Dy);
[Vx Vy] = EstimateMotion (W G11 half_window_size);
case 0
W = warp (G00 Dx Dy);
[Vx Vy] = EstimateMotion (W G10 half_window_size);
end
[m n] = size (W);
Dx(1:m 1:n) = Dx(1:m1:n) + Vx; Dy(1:m 1:n) = Dy(1:m 1:n) + Vy;
smooth (Dx); smooth (Dy);
l = l - 1;
end
%% Lucas Kanade on the image sequence at pyramid step %%
function [Vx Vy] = EstimateMotion (W G1 half_window_size)
[m n] = size (W);
Vx = zeros (size (W)); Vy = zeros (size (W));
N = zeros (2*half_window_size+1 5);
for i = 1:m
l = 0;
for j = 1-half_window_size:1+half_window_size
l = l + 1;
N (l:) = getSlice (W G1 i j half_window_size);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2006-10-05 17:57 lk
文件 64078 2003-04-08 18:03 lk\1.bmp
文件 64078 2003-04-08 18:03 lk\2.bmp
文件 21958 2003-04-07 14:03 lk\3.bmp
文件 21958 2003-04-07 14:03 lk\4.bmp
文件 169984 2004-04-18 03:57 lk\Lucas.doc
文件 6932 2004-04-18 03:07 lk\Lucas_Kanade.m
文件 298 2004-04-18 04:01 lk\tests.m
..A.SH. 20480 2006-10-05 18:07 lk\Thumbs.db
----------- --------- ---------- ----- ----
369984 10
相关资源
- 心电图去噪MATLAB程序
- 用matlab读取视频文件中的图像,并对
- Matlab形态学梯度检测二值图像的边缘
- RSSI定位算法MATLAB代码
- matlab递归实现汉诺塔m函数文件(动画
- 物体在空间中的运动轨迹预测
- PCA人脸识别定位matlab代码
- HSMM程序matlab
- 增量式PID算法PDF+MATLAB源程序
- 变速积分PID控制算法PDF+MATLAB源程序
- 最小二乘拟合Gauss曲线Matlab
- matlab安装序列号以及license文件
- 可以matlab实现的四种图像去噪程序
- 基于Matlab的射频滤波器仿真设计
- 基于MATLAB的无刷直流电机模糊控制仿
- 自适应滤波器的MATLAB与FPGA实现
- 用MATLAB编写的贝叶斯算法程序.m
- 人脸特征提取matlab源码
- gabor滤波二值化.rar
- 基于MATLAB的语音信号特技处理延时、
- Floyd弗洛伊德算法matlab仿真代码。
- matlab实现中值滤波,不用medflict2函数
- Gabor特征提取MATLAB代码
- 椭圆拟合matlab程序
- 判断点是否在给定三角形内的matlab程
- 基于k-D树邻近点的彩色星座图绘制
- 重叠相加和重叠保留算法的MATLAB实现
- 自学Matlab必备的60个小程序代码
- 快速双边滤波matlab代码
- 神经网络预测数据Neural Networks predic
评论
共有 条评论