我正在尝试实施一篇研究论文来验证我的结果。我已经分享了代码(由我编写)和研究论文中给出的过程描述。不幸的是,我的结果与他的结果有点不同,这意味着我做错了什么。请引导我正确的方向。
代码
fileName = 'mobile_cif.yuv';
width=352;
height=288;
numFrames=30;
SAD=0;
%for loop to traverse & process from frame '1' to 'last' frames
for t = 1 : numFrames
if t < numFrames %(Need to traverse to n-1 frames)
result=loadFileYuv(fileName,width,height,t);
currFrame = result.cdata; %reading Current frame
result=loadFileYuv(fileName,width,height,t+1);
nextFrame = result.cdata; %reading Next frame
% First, take the absolute value of the difference at each pixel
myAbsDiff = abs(double(currFrame) - double(nextFrame));
% Then, sum over all pixels
out = sum(myAbsDiff(:));
out=out/(width*height); %(Taking Average with respect to pixel)
out=out/64;%(Dividing By Block size to normalize)
disp(out);
SAD=SAD+out;
else
continue;
end
end
disp(SAD/numFrames); %(Taking Average with respect to Frames)
进度解析
绝对差和 (SAD) 是一种简单的视频质量度量,用于块比较和移动矢量计算。每帧被分成小块(即 8 × 8 像素),并且对于一帧中的每个块,找到下一帧中最相似(最小 SAD)的块。这个绝对差的最小总和被指定为每帧中每个块的 SAD(直到 n-1 帧)。然后对每一帧和剪辑中的所有帧的所有 SAD 值进行平均,并除以块区域,以进行归一化。