资源描述:
《运动估计作业 MATLAB仿真》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、运动是视频序列的一个主要特点之一运动估计技术是视频压缩领域中最重要、发展最快的技术之一,它是提高编码效率的主要途径。研究快速有效的运动估计算法一直是视频编码领域的热点问题运动估计主程序clearallmbSize=16;p=7;filename='hao.yuv';fp=fopen(filename,'r');width=176;height=144;i=17;fseek(fp,i*1.5*width*height,'bof');bufI=fread(fp,width*height,'uchar');imgI=double((reshape(bu
2、fI,width,height))');imgI0=uint8((reshape(bufI,width,height))');Figure1,imshow(imgI0);title('第10帧');imgI=double(imgI0);fseek(fp,0.5*width*height,'cof');bufP=fread(fp,width*height,'uchar');imgP0=uint8((reshape(bufP,width,height))');figure,imshow(imgP0);title('第35帧');imgP=double
3、(imgP0);将搜索中心定在搜索框的最左上角点。搜索中心从左至右,从上至下移位,并计算每一个点,直到计算完搜索框内所有点。比较所有计算的点,最小值点即为最佳匹配点。全搜索法[motionVect,computations]=motionEstES(b,a,blocksize,p);imgComp=motionComp(a,motionVect,blocksize);c=b-imgComp;figure(2);subplot(121);imshow(uint8(imgComp));title('全搜索法运动估计得到的第35帧');subplot(
4、122);imshow(uint8(c));title('与第35帧的误差');ESpsnr=imgPSNR(b,imgComp,255);、先以中心点为搜索中心,进行四周±4点距离搜索,计算9个点,得到最小值点。将搜索中心移至最小值点,进行四周±2点距离搜索,计算9个点,得到最小值点。将搜索中心移至最小值点,进行四周±1点距离搜索,计算9个点,得到最小值点,此最小值点即为最终的搜索结果作为运动估计的最优匹配点。三步法[motionVect,computations]=motionEstTSS(b,a,blocksize,p)imgComp=mo
5、tionComp(a,motionVect,blocksize);c=b-imgComp;figure(3);subplot(121);imshow(uint8(imgComp));title('三步法运动估计得到的第35帧');subplot(122);imshow(uint8(c));title('与第35帧的误差');TSSpsnr=imgPSNR(b,imgComp,255);先以中心点为搜索中心,进行大钻石搜索,计算9个点。如果9个点的最小值点不在大钻石的中心,则将大钻石的中心移至该点,重复大钻石搜索,直到最小值点处于大钻石中心为止。在
6、大钻石的中心点切换到小钻石搜索模式,共搜索5个点,其中值最小的点即为最终的搜索结果作为运动估计的最优匹配点。四步法[motionVect,computations]=motionEst4SS(b,a,blocksize,p)tocimgComp=motionComp(a,motionVect,blocksize);c=b-imgComp;figure(4);subplot(121);imshow(uint8(imgComp));title('四步法运动估计得到的第35帧');subplot(122);imshow(uint8(c));title(
7、'与第35帧的误差');SS4psnr=imgPSNR(b,imgComp,255);钻石法[motionVect,computations]=motionEstDS(b,a,blocksize,p)tocimgComp=motionComp(a,motionVect,blocksize);c=b-imgComp;figure(5);subplot(121);imshow(uint8(imgComp));title('钻石法运动估计得到的第35帧');subplot(122);imshow(uint8(c));title('与第35帧的误差');
8、DSpsnr=imgPSNR(b,imgComp,255);