macromotionsearch.asv
来自「用matlab写的仿真H.263标准的程序」· ASV 代码 · 共 23 行
ASV
23 行
function [VectorRow,VectorCol] = MacroMotionSearch(MarcoBlock,Windows,WHeight,WWidth)
%在指定窗口内进行全搜索
%输入 MacroBlock ,目标16x16亮度宏块,uint8
%输入 Windows,搜索窗口,uint8
%输入 WHeight,WWidth,搜索窗口高和宽
%输出 VectorRow,VectroCol 运动矢量;与中心窗口的偏移量
sad = 9999999;
vh = 0;
vw = 0;
for i = 1:(WHeight - 15)
for j = 1:(WWidth - 15)
tmp_sad = Sad(MarcoBlock,Windows(i:i + 15,j:j + 15));
if tmp_sad < sad;
sad = tmp_sad;
vh = i;
vw = j;
elseif tmp_sad == sad && (i - 17)^2 + (j - 17)^2
end
end
end
VectorRow = vh - 17;%注意,座标是从(1,1)开始的,不同与c里的座标。
VectorCol = vw - 17;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?