数字图像和视频处理的基础-第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 ...
随机推荐
- poj 1127(直线相交+并查集)
Jack Straws Description In the game of Jack Straws, a number of plastic or wooden "straws" ...
- HDU 6039 Gear Up(线段树+并查集)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6039 [题目大意] 给出一些齿轮,有些齿轮是边相连,也就是拥有相同的线速度, 有的齿轮是轴相连,也 ...
- [xsy2309]数字表格
题意:求$\prod\limits_{i=1}^n\prod\limits_{j=1}^mf_{(i,j)}$,其中$f_0=0,f_1=1,f_n=f_{n-1}+f_{n-2}$ 很妙的题 假设$ ...
- 【找规律】【递归】XVII Open Cup named after E.V. Pankratiev Stage 4: Grand Prix of SPb, Sunday, Octorber 9, 2016 Problem F. Doubling
题意: 给你一个n,问你R(n)对应的字符串长度最小的是啥. dp打个表出来,f(i)表示i值对应的字符串的最小长度,发现f(1)=1,f(2)=2,其他的情况下,若是偶数,则恰好在其外面加一对中括号 ...
- rmq问题:ST表
存板子.O(nlogn)预处理,O(1)查询.空间O(nlogn). int d[1000006][25]; int mn[1000006]; void rmq_init() { for(int i= ...
- xml和集合混合使用-图书管理器
package com.book; public class Book { private int id; //图书编号 private String name; //图书名称 private Str ...
- centos svnversion安装部署
第一步: yum install subversion; 第二步: mkdir /data/svn/conf mkdir /data/svn/library 第三步: svnadmin create ...
- 谷歌地图聚合点使用(GoogleMaps MarkerCluster)
我们有时候需要观察地图 不同地方数据的所在范围和分布密集情况,热力图和聚合点的使用无疑是最好的选择. 1.首先说说百度地图,只做国内的地图可以使用百度地图的海量点和热力图还是蛮好用的. a.海量点的最 ...
- 乐观锁悲观锁对应的JAVA代码和数据库
乐观锁悲观锁是一种思想.可以用在很多方面. 比如数据库方面.悲观锁就是for update乐观锁就是 version字段 JDK方面:悲观锁就是sync乐观锁就是原子类(内部使用CAS实现) 本质来说 ...
- Docker从12升级到17ce
先卸载 yum remove docker* yum remove container-selinux--.el7.centos.x86_64 安装 sudo yum install -y yum-u ...