




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、精选优质文档-倾情为你奉上数字视频处理实验报告学 院: 通信与信息工程学院系 班: 电信科0901班姓 名: 学 号: 时 间: 2012 年11月23号一、实验名称:基于块的全搜索运动估计算法实现二、实验目的:1、掌握运动估计算法的实现原理。2、掌握运动估计算法的研究现状及多种计算方法。3、学习基于块的全搜索运动估计算法,研究分析其Matlab实现程序过程,并补充完成程序,对实验结果进行分析比较。 三、实验要求三、实验要求1、 对实验程序motionEstAnalysis.m进行分析,完成主程序流程图。函数流程图:2、编写补充完成部分不全程序代码,调试程序使其能正确运行(1) motionE
2、stES( )% Computes motion vectors using exhaustive search method(全搜索法计算运动矢量)% Input% imgP : The image for which we want to find motion vectors(当前图像)% imgI : The reference image(参考图像)% mbSize : Size of the macroblock(宏块尺寸)% p : Search parameter (read literature to find what this means)(搜索参数)% Ouput% m
3、otionVect : the motion vectors for each integral macroblock in imgP(当前图像中每一个积分宏块的运动矢量)% EScomputations: The average number of points searched for a macroblock(每个宏块搜索的平均点数)% Written by Aroh Barjatyafunction BlockCenter, motionVect, EScomputations = motionEstES(imgP, imgI, mbSize, p) % 定义函数文件motionEst
4、ES.m,imgP、 imgI、 mbSize、 p为传入参数,BlockCenter、motionVect、 EScomputations为返回参数row col = size(imgI); % 将参考图像的行数赋值给row,列数赋值给colblockcenter = zeros(2,row*col/mbSize2);vectors = zeros(2,row*col/mbSize2); % 定义全0的矢量矩阵的大小costs = ones(2*p + 1, 2*p +1) * 65537; % 定义最小绝对差矩阵的大小computations = 0; % 搜索点数赋初值为0 % we s
5、tart off from the top left of the image(从图像左上角开始)% we will walk in steps of mbSize(以宏块尺寸为步长)% for every marcoblock that we look at we will look for% a close match p pixels on the left, right, top and bottom of it (对于每一个宏块,在它的上下左右找到与搜索参数p最匹配的像素)mbCount = 1; %搜索的宏块数赋初值为1%1为循环起始值,mbSize为步长值,row-mbSize+
6、1为循环终止值for i = 1 : mbSize : row-mbSize+1 for j = 1 : mbSize : col-mbSize+1 % the exhaustive search starts here(全搜索开始) % we will evaluate cost for (2p + 1) blocks vertically % and (2p + 1) blocks horizontaly(我们将计算水平方向上(2p + 1)个块的最小绝对差和垂直方向上(2p + 1)个块的最小绝对差) % m is row(vertical) index(m为行指数) % n is co
7、l(horizontal) index(n为列指数) % this means we are scanning in raster order for m = -p : p %水平方向上位移矢量范围 for n = -p : p %垂直方向上位移矢量范围 % 补充下面程序 % row/Vert co-ordinate for ref block (参考块的行(垂直方向)的范围) refBlkVer = i+m; % col/Horizontal co-ordinate(参考块的列(水平方向)的范围) refBlkHor = j+n; %如果参考块的行列范围的任意一个在已经搜索过的宏块之外,则继
8、续下一步的搜索 if ( refBlkVer < 1 | refBlkVer+mbSize-1 > row . | refBlkHor < 1 | refBlkHor+mbSize-1 > col) continue; end costs(m+p+1,n+p+1) = costFuncMAD(imgP(i:i+mbSize-1,j:j+mbSize-1), . imgI(refBlkVer:refBlkVer+mbSize-1, refBlkHor:refBlkHor+mbSize-1), mbSize); % 搜索下一个点 computations = computa
9、tions + 1; end end % Now we find the vector where the cost is minimum % and store it . this is what will be passed back.(现在找到有最小绝对差的矢量并存储它,这就是将被返回的东西) % 补充下面程序 blockcenter(1,mbCount) = i+ mbSize/2-1; blockcenter(2,mbCount) = j+ mbSize/2-1; % finds which macroblock in imgI gave us min Cost(找到参考图像中最小绝
10、对差的宏块) dx, dy, min = minCost(costs); % row co-ordinate for the vector(矢量的行集合) vectors(1,mbCount) = dy-p-1; % col co-ordinate for the vector(矢量的列集合) vectors(2,mbCount) = dx-p-1; %搜索下一个宏块 mbCount = mbCount + 1; costs = ones(2*p + 1, 2*p +1) * 65537; endendBlockCenter = blockcenter;motionVect = vectors
11、; %返回当前图像中每一个积分宏块的运动矢量EScomputations = computations/(mbCount - 1); %返回每个宏块搜索的平均点数 (2) costFuncMAD( )% Computes the Mean Absolute Difference (MAD) for the given two blocks(对给定的两个块计算最小绝对差)% Input% currentBlk : The block for which we are finding the MAD(当前块)% refBlk : the block w.r.t. which the MAD is
12、being computed(参考块)% n : the side of the two square blocks% Output% cost : The MAD for the two blocks(两个块的最小绝对差)% Written by Aroh Barjatya% 定义函数文件costFuncMAD.m,currentBlk、refBlk、 n为传入参数,cost为返回参数function cost = costFuncMAD(currentBlk,refBlk, n) % 补充下面程序cost=sum(sum(abs(currentBlk-refBlk)/(n*n); (3)
13、minCost( )% Finds the indices of the cell that holds the minimum cost(找到拥有最小绝对差的点的指数)% Input% costs : The matrix that contains the estimation costs for a macroblock(包含宏块的估计代价的矩阵)% Output% dx : the motion vector component in columns(列方向上运动矢量组成)% dy : the motion vector component in rows(行方向上运动矢量组成)% W
14、ritten by Aroh Barjatyafunction dx, dy, min = minCost(costs)row, col = size(costs);% we check whether the current value of costs is less then the already present value in min.% If its inded smaller then we swap the min value with the current one and note the indices.% (检测costs的当前值是否比已经出现的最小值小。如果小的话,
15、我们将当前值与最小值对调,并注明指数)% 补充下面程序minnum=65536;x=8;y=8;for i=1:rowfor j=1:colif(costs(i,j)<minnum)minnum=costs(i,j);x=i;y=j;endendenddx=x;dy=y;min=minnum; (4) imgPSNR( )% Computes motion compensated image's PSNR(计算运动补偿图像的峰值信噪比)% Input% imgP : The original image (原始图像)% imgComp : The compensated image(补偿图像)% n : the peak value possible of any pixel in the images(图像中任何一个像素的可能的峰值)% Ouput% psnr : The motion compensated image's PSNR(运动补偿图像的峰值信噪比)% Written by Aroh Barjatyafunction psnr = imgPSNR(imgP, imgComp, n)% 补充下面程序MSE=(1/(n*n)*sum(sum(imgP-imgComp).2);PSNR=10*log10(2552/MSE);psnr=PSNR;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025城区租房合同模板
- 设备采购及管理工作计划
- 助产士礼仪规范
- 2025版权许可合同范本协议
- 2025商业大厦建设施工合同
- 院内病例讨论会的定期举办计划
- 口腔科常见口腔问题预防计划
- 针对园艺师考试备考的特别措施试题及答案
- 2025装修工程模板、脚手架劳务承包合同范本
- 慢性白血病的健康宣教
- 介绍梅西的英语演讲稿
- 《民航危险品运输》教学课件 第一章 民航危险品运输概述
- 四川省邛崃市天府现代种业园管理委员会面向社会公开招考9名员额制社会化专业人才(共200题含答案解析)模拟检测(自我提高)试卷-1
- 伦理学考试题库及答案
- 《路德维希 费尔巴哈和德国古典哲学的终结》
- 抽油井检泵作业课件
- 2022年06月2022年广东肇庆广宁县司法局招考聘用政府雇员名师点拨卷V答案详解版(3套版)
- 《HSK标准教程3》第5课课件
- HSK标准教程4上第1课课件
- 民俗学概论 第一章 概述课件
- 干粉灭火器点检记录表(样表)
评论
0/150
提交评论