In this problem you will perform block matching motion estimation between two consecutive video frames.
Follow the instructions below to complete this problem. (1) Download the two video frames from frame_1 and frame_2.
The frames/images are of height 288 and width 352. (2) Load the frame with file name "frame_1.jpg" into a 288×352 MATLAB
array using function "imread", and then convert the array type from 8-bit integer to real number using function "double" or "cast" (note that the range of intensity values after conversion is between 0 and 255). Denote by I1 the
converted MATLAB array. Repeat this step for the frame with file name "frame_2.jpg" and denote the resulting MATLAB array by I2.
In this problem, I2 corresponds
to the current frame, and I1 corresponds
to the previous frame (i.e., the reference frame). (3) Consider the 32×32 target
block in I2 that
has its upper-left corner at (65,81) and
lower-right corner at (96,112).
Note this is MATLAB coordinate convention, i.e., the first number between the parenthesis is the row index extending from 1 to 288 and
the second number is the column index extending from 1 to 352.
This target block is therefore a 32×32 sub-array
of I2.
(4) Denote the target block by Btarget.
Motion estimation via block matching searches for the 32×32 sub-array
of I1 that
is "most similar" to Btarget.
Recall in the video lectures we have introduced various forms of matching criteria, e.g., correlation coefficient, mean-squared-error (MSE), mean-absolute-error (MAE), etc. In this problem, we use MAE as the matching criterion. Given two blocks B1 and B2 both
of size M×N,
the MAE is defined as MAE(B1,B2)=1M×N∑Mi=1∑Nj=1|B1(i,j)−B2(i,j)|.
To find the block in I1 that
is most similar to Btarget in
the MAE sense, you will need to scan through all the 32×32 blocks
in I1,
compute the MAE between each of these blocks and Btarget,
and find the one that yields the smallest value of MAE. Note in practice motion search is only performed over a certain region of the reference frame, but for the sake of simplicity, we perform motion search over the entire reference frame I1 in
this problem. When you find the matched block in I1,
enter the following information: (1) the coordinate of the upper-left corner of the matched block in MATLAB convention. This requires two integer numbers; (2) the corresponding MAE value, which is a floating-point number. Enter the last number to two decimal
points. As an example for format of answer, suppose the matched block has upper-left corner located at (1,1)

, and the corresponding MAE is 10.12, then you should enter 1 1 10.12 (the three numbers are separated
by spaces)

clear;
clear all;
clear clc; I1 = double(imread('frame1.jpg'));
I2 = double(imread('frame2.jpg'));
[height,width] = size(I1); Btarget = I2(65:96,81:112); MAE = 1000000;
x = 0;
y = 0;
for i=1:height-31
for j=1:width-31
diff = Btarget - I1(i:i+31,j:j+31);
tsum = sum(sum(abs(diff)));
if(tsum < MAE)
x = i;
y = j;
MAE = tsum;
end
end
end
MAE = MAE/(32*32);

数字图像和视频处理的基础-第4周运动预计matlab练习题的更多相关文章

  1. Java 入门课程视频实战-0基础 上线了,猜拳游戏,ATM实战,欢迎围观

    Java 入门课程视频实战-0基础 已经上传完了.欢迎小伙伴们过来围观 直接进入: http://edu.csdn.net/course/detail/196 课程文件夹例如以下: 1 初识Java  ...

  2. 【视频】零基础学Android开发:蓝牙聊天室APP(四)

    零基础学Android开发:蓝牙聊天室APP第四讲 4.1 ListView控件的使用 4.2 BaseAdapter具体解释 4.3 ListView分布与滚动事件 4.4 ListView事件监听 ...

  3. 【视频】零基础学Android开发:蓝牙聊天室APP(二)

    零基础学Android开发:蓝牙聊天室APP第二讲 2.1 课程内容应用场景 2.2 Android UI设计 2.3 组件布局:LinearLayout和RelativeLayout 2.4 Tex ...

  4. 2015最全iOS开发自学视频资料(基础+实战)

    最全的iOS自学视频,包括c,objective-c,UI等等,没有你找不到的,只有你学不会的,只要你想学,这里都有你所需要的. 推荐教程点这里:http://www.mobiletrain.org/ ...

  5. 【视频】零基础学Android开发:蓝牙聊天室APP(三)

    零基础学Android开发:蓝牙聊天室APP第三讲 3.1 ImageView.ImageButton控件具体解释 3.2 GridView控件具体解释 3.3 SimpleAdapter适配器具体解 ...

  6. 【视频】零基础学Android开发:蓝牙聊天室APP(一)

    零基础学Android开发:蓝牙聊天室APP第一讲 1. Android介绍与环境搭建:史上最高效Android入门学习 1.1 Google的大小战略 1.2 物联网与云计算 1.3 智能XX设备 ...

  7. [视频解说]0基础课程-运营商-Java它J2se

    本节解说 运营商应用 Java 算被分成: 算术运算符 颂值运营商 逻辑运算符 位运算符 元运算符 这里录制了 视频解说这几大类运算符,并有练习题提供大家 面试题: 1. 最有效率的方式算出2乘以8等 ...

  8. 开始ITGEGE教育社区的视频录制----嵌入式基础知识讲解

    从8月份开始,陆陆续续要对我的第一份兼职工作ITGEGE讲师做教学视频录制了,本人水平有限,我只讲一些开发在工作中的应用,其它细节的东西不做深究,毕竟本人工作经验和精力也有限,白天要上班,特别是最近又 ...

  9. python爬虫下载小视频和小说(基础)

    下载视频: 1 from bs4 import BeautifulSoup 2 import requests 3 import re 4 import urllib 5 6 7 def callba ...

随机推荐

  1. EasyUI学习总结(一)——EasyUI入门(转载)

    本文转载自:http://www.cnblogs.com/xdp-gacl/p/4075079.html 一.EasyUI下载 EasyUI官方下载地址:http://www.jeasyui.com/ ...

  2. 【BZOJ 2124】【CodeVS 1283】等差子序列

    http://www.lydsy.com/JudgeOnline/problem.php?id=2124 http://codevs.cn/problem/1283/ 重点是把判断是否存在3个数组成等 ...

  3. BZOJ 2956 模积和(分块)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2956 [题目大意] 求∑∑((n%i)*(m%j))其中1<=i<=n,1 ...

  4. BZOJ 1834 [ZJOI2010]network 网络扩容(费用流)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1834 [题目大意] 给定一张有向图,每条边都有一个容量C和一个扩容费用W. 这里扩容费 ...

  5. (原创)Stanford Machine Learning (by Andrew NG) --- (week 8) Clustering & Dimensionality Reduction

    本周主要介绍了聚类算法和特征降维方法,聚类算法包括K-means的相关概念.优化目标.聚类中心等内容:特征降维包括降维的缘由.算法描述.压缩重建等内容.coursera上面Andrew NG的Mach ...

  6. 1.1(SQL学习笔记)SQL基础

    一.SELECT 建表及数据填充语句下载:链接: https://pan.baidu.com/s/1WHYafwqKJEKq1kDwCH_Zlg 提取码: 3wy4 SELECT用于指定检索返回的结果 ...

  7. Z-Stack协议栈网络号与信道号的设置

    1.网络号设置 默认是:-DZDAPP_CONFIG_PAN_ID=0xFFFF 代表的是随机选择一个网络号,并加入此网络,可以将0xffff改成4位数字,如图所示. 2.信道号的设置 这个地方在网络 ...

  8. 【fastJSON】利用fastJSON处理循环引用的问题

    下载fastJSON jar   com.alibaba.fastjson 第一种:[写死的] 将需要序列化的字段传递进去,得到结果 //需要序列化的实体+字段 SimplePropertyPreFi ...

  9. piwik网站访问统计系统

    一.Piwik介绍 Piwik是一套基于PHP+MySQL技术构建的开源网站访问统计系统.Piwik可以给你详细的统计信息,比如网页浏览人数,访问最多的页面,搜索引擎关键词等流量分析功能.此外,它还采 ...

  10. metal 优化数据分析

    https://developer.apple.com/documentation/metal/render_pipeline/viewing_pipeline_statistics_of_a_dra ...