数字图像和视频处理的基础-第4周运动预计matlab练习题
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练习题的更多相关文章
- Java 入门课程视频实战-0基础 上线了,猜拳游戏,ATM实战,欢迎围观
Java 入门课程视频实战-0基础 已经上传完了.欢迎小伙伴们过来围观 直接进入: http://edu.csdn.net/course/detail/196 课程文件夹例如以下: 1 初识Java ...
- 【视频】零基础学Android开发:蓝牙聊天室APP(四)
零基础学Android开发:蓝牙聊天室APP第四讲 4.1 ListView控件的使用 4.2 BaseAdapter具体解释 4.3 ListView分布与滚动事件 4.4 ListView事件监听 ...
- 【视频】零基础学Android开发:蓝牙聊天室APP(二)
零基础学Android开发:蓝牙聊天室APP第二讲 2.1 课程内容应用场景 2.2 Android UI设计 2.3 组件布局:LinearLayout和RelativeLayout 2.4 Tex ...
- 2015最全iOS开发自学视频资料(基础+实战)
最全的iOS自学视频,包括c,objective-c,UI等等,没有你找不到的,只有你学不会的,只要你想学,这里都有你所需要的. 推荐教程点这里:http://www.mobiletrain.org/ ...
- 【视频】零基础学Android开发:蓝牙聊天室APP(三)
零基础学Android开发:蓝牙聊天室APP第三讲 3.1 ImageView.ImageButton控件具体解释 3.2 GridView控件具体解释 3.3 SimpleAdapter适配器具体解 ...
- 【视频】零基础学Android开发:蓝牙聊天室APP(一)
零基础学Android开发:蓝牙聊天室APP第一讲 1. Android介绍与环境搭建:史上最高效Android入门学习 1.1 Google的大小战略 1.2 物联网与云计算 1.3 智能XX设备 ...
- [视频解说]0基础课程-运营商-Java它J2se
本节解说 运营商应用 Java 算被分成: 算术运算符 颂值运营商 逻辑运算符 位运算符 元运算符 这里录制了 视频解说这几大类运算符,并有练习题提供大家 面试题: 1. 最有效率的方式算出2乘以8等 ...
- 开始ITGEGE教育社区的视频录制----嵌入式基础知识讲解
从8月份开始,陆陆续续要对我的第一份兼职工作ITGEGE讲师做教学视频录制了,本人水平有限,我只讲一些开发在工作中的应用,其它细节的东西不做深究,毕竟本人工作经验和精力也有限,白天要上班,特别是最近又 ...
- python爬虫下载小视频和小说(基础)
下载视频: 1 from bs4 import BeautifulSoup 2 import requests 3 import re 4 import urllib 5 6 7 def callba ...
随机推荐
- hdu 1251 (Trie水题)
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submi ...
- 查询续与ajax
查询分组 事例:统计不止一个作者的图书:(作者数量大于一) Book.objects.all().values('name').annotate(author_num=Count('authors__ ...
- json,xml,html三种数据格式
json.xml.html xml解析如下: 1.DOM:基于XML文档树结构的解析 解析器读入整个文档,然后构建一个驻留内存的树结构,然后代码就可以使用 DOM 接口来操作这个树结构.优点:整个文档 ...
- insert失败自动执行update(duplicate先insert)
例如:有一张表 字段有 id主键自增,或者唯一索引:datetime时间 name名字 INSERT INTO TABLE (id,datetime) VALUES (1,1440000000), ...
- mysql常见故障问题汇总
Auth: JinDate: 20140414 UpdateDate: 继续更新 导库字符集的问题http://www.cnblogs.com/diege/p/3640618.htmlmysql-pr ...
- opensue安装eclipse进行python开发
date :20140214 auth:jin 1.install jdk zypper insgtall java-1_7_0-openjdk 2.环境 linux-gzy1:~ # env |gr ...
- POJ 3422 Kaka's Matrix Travels(费用流)
Kaka's Matrix Travels Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6792 Accepted: ...
- 各种GCC
Cross GCC Cygwin GCC Linux GCC MacOSX GCC MinGW GCC Solaris GCC Clang
- 四种有能力取代Cookies的客户端Web存储方案
目前在用户的网络浏览器中保存大量数据需要遵循几大现有标准,每一种标准都拥有自己的优势.短板.独特的W3C标准化状态以及浏览器支持级别.但无论如何,这些标准的实际表现都优于广泛存在的cookies机制. ...
- [Linux] 守护进程和守护线程
对于JAVA而言,一般一个应用程序只有一个进程——JVM.除非在代码里面另外派生或者开启了新进程. 而线程,当然是由进程开启的.当开启该线程的进程离开时,线程也就不复存在了. 所以,对于JAVA而言, ...