资源简介
三步搜索法的一种实现方法,利用matlab实现
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Function: my_3_STEP_search(Target_I Reference_I Range)
%
% Input
% Target_I : The image we are predicting
% Reference_I : The reference image
% Range : Search Range=(2*p+1). Only search a subset based on the
% algorithm design.
%
% Ouput
% Error_I_EBMA: Error Image
% MC_I_EBMA: Motion compensated iamge
% MV_EBMA : The motion vectors
%
% Programmed by Daniel Garcia-Romero 4-24-2006
function [MV_EBMAmagu] = my_3_STEP_search(Target_I Reference_I Range)
MB_size=8;
[num_row num_col] = size(Target_I);
p=(Range-1)/2;% Assuming an odd Range 3 7 15
motionprobmap=zeros(num_rownum_col);
MV_EBMA = zeros(num_row*num_col/642);%Allocate memory for Motion vectors
m_distance = 2^15*ones(3 3);%Initialize distance matrix (Only 9 points)
MAX_ROWS=num_row-MB_size+1; %Max number of MB in the y-coordinate
MAX_COL=num_col-MB_size+1; %Max number of MB in the x-coordinate
L = floor(log2(p+1));
stepMax = 2^(L-1);
num_MB = 1;
% Explore the image in raster order and search using the three step
for i = 1 : MB_size : MAX_ROWS
for j = 1 : MB_size : MAX_COL
x = j;
y = i;
%Compute the 9th point outside of the while loop for the first STEP
m_distance(22) = my_MAD(Target_I(i:i+MB_size-1j:j+MB_size-1) Reference_I(i:i+MB_size-1j:j+MB_size-1));
stepSize = stepMax;
while(stepSize >= 1)
% m is row index
% n is col index
for m = -stepSize : stepSize : stepSize
for n = -stepSize : stepSize : stepSize
index_Ver = y + m; % row y-coordinate
index_Hor = x + n; % col x-coordinate
if ( index_Ver < 1 || index_Ver+MB_size-1 > num_row || index_Hor < 1 || index_Hor+MB_size-1 > num_col)
continue
end
%We only compute 8 points per step inside the while loop
position_row = m/stepSize + 2;
position_col = n/stepSize + 2;
if (position_row == 2 && position_col == 2)
continue
end
m_distance(position_rowposition_col) = my_MAD(Target_I(i:i+MB_size-1j:j+MB_size-1)Reference_I(index_Ver:index_Ver+MB_size-1 index_Hor:index_Hor+MB_size-1));
end
end
%Compute motion vectors
[index_yindex_x] = my_find_min_distance(m_distance); % finds position of minimum distance
mintemp=m_distance(index_yindex_x);
% shift the center point for search window to minumum distance
x = x + (index_x-2)*stepSize;
y = y + (index_y-2)*stepSize;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 316100 2009-11-09 14:49 三步搜索法\Fight_OneManDown177.tif
文件 315978 2009-11-09 14:49 三步搜索法\Fight_OneManDown178.tif
文件 14726 2009-12-02 19:16 三步搜索法\motionprobmapsanbu.tif
文件 3998 2009-12-02 19:09 三步搜索法\my_3_STEP_search.m
文件 193 2009-11-26 20:25 三步搜索法\my_find_min_distance.m
文件 66 2008-09-18 21:02 三步搜索法\my_MAD.m
文件 460 2010-03-08 19:32 三步搜索法\Unti
目录 0 2010-11-23 14:45 三步搜索法
----------- --------- ---------- ----- ----
651521 8
- 上一篇:deconvblind
- 下一篇:提取二值化图像的轮廓线
评论
共有 条评论