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. Struts2中的设计模式----ThreadLocal模式

    http://www.cnblogs.com/gw811/archive/2012/09/07/2675105.html 设计模式(Design pattern):是经过程序员反复实践后形成的一套代码 ...

  2. 8VC Venture Cup 2016 - Elimination Round F. Group Projects dp

    F. Group Projects 题目连接: http://www.codeforces.com/contest/626/problem/F Description There are n stud ...

  3. FORM - FILE.EXPORT 导出功能

    对于数据块项,是不用添加任何触发器就可以使用导出功能的. 如果不能使用该功能,可能是由于在需要使用导出功能的块上添加了block级触发器when-new-item-instance,但执行层次为&qu ...

  4. 前端工业化工具Gulp初体验

    1. 全局安装 gulp: npm install --global gulp 2.在项目目录下,用以下命令创建一个基本的package.json文件 npm init 3.安装Gulp npm in ...

  5. Android源代码编译apk导入第三方包报错

    报错内容例如以下: make: *** 没有规则能够创建"out/target/common/obj/APPS/ AndroidWFS_intermediates/classes-full- ...

  6. ECCV 2014 Oral Paper

    今年的ECCV 的paper已经挂到了网上.本文整了当中Oral Paper. 一,Tracking and Activity Recognition

  7. [转]ssis cannot retrieve the column code page info from the ole db provider

    本文转自:http://social.msdn.microsoft.com/Forums/sqlserver/en-US/dc1a61f2-1ab8-4ed3-b85c-db6481800b50/er ...

  8. Android 将ARGB图片转换为灰度图

    思路如下: 1.读取or照相,得到一张ARGB图片. 2.转化为bitmap类,并对其数据做如下操作: A通道保持不变,然后逐像素计算:X = 0.3×R+0.59×G+0.11×B,并使这个像素的值 ...

  9. Azkaban配置

    1,新建azkaban目录,用于安置azkaban程序 2,azkaban web服务器安装  解压 azkaban-web-server-2.5.0.tar.gz tar -zvxf azkaban ...

  10. appium-desktop使用

    Appium移动测试中有个很重新的组件Appium-Server,它主要用来监听我们的移动设备(真机或模拟器),然后将不同编程语言编写的 appium 测试脚本进行解析,然后,驱动移动设备来运行测试. ...