实验要求:

Objective:

To know how to implement correlation of 2 functions in the frequency domain and, using the fast algorithms.

Main requirements:

Ability of programming with C, C++, or Matlab.

Instruction manual:

Download Figs. 4.41(a) and (b) and duplicate Example 4.11 to obtain Fig. 4.41(e). Give the (x,y) coordinates of the location of the maximum value in the 2D correlation function. There is no need to plot the profile in Fig. 4.41(f).

实验只是要求给出二维相关函数中最大值位置的(x,y)坐标,没有必要绘制图中的轮廓。

程序实现步骤:

1、将两幅图像的大小都拓展298×298;

2、两幅图像的每个像素都乘以(-1)^(x+y),使其在频域位于中心位置;

3、做傅里叶变换,转换到频域;

4、在频域两幅图像,一个与另一个的共轭相乘计算相关函数;

5、作傅里叶逆变换转换回空间域;

6、乘以(-1)^(x+y),得到最终结果。

要求使用的两幅图:

Figs. 4.41(a):

Figs. 4.41(b):

实验代码:

% Correlation in the Frequency Domain
close all;
clc;
clear all; %
img_f1 = imread('Fig4.41(a).jpg');
img_f2 = imread('Fig4.41(b).jpg'); [M1, N1] = size(img_f1);
[M2, N2] = size(img_f2); P = 298;
Q = 298;
img_fp1 = zeros(P, Q);
img_fp2 = zeros(P, Q);
img_fp1(1:M1, 1:N1) = img_f1(1:M1, 1:N1);
img_fp2(1:M2, 1:N2) = img_f2(1:M2, 1:N2); for x = 1:P
for y = 1:Q
img_fp1(x, y) = img_fp1(x, y) .* (-1)^(x+y);
img_fp2(x, y) = img_fp2(x, y) .* (-1)^(x+y);
end
end % 傅里叶变换
img_Fp1 = fft2(img_fp1);
img_Fp2 = fft2(img_fp2); % 求共轭
img_Fp = img_Fp2 .* conj(img_Fp1); % 傅里叶变换
img_fp = ifft2(img_Fp); % 乘以(-1)^(x+y)
for x = 1:P
for y = 1:Q
img_fp(x, y) = img_fp(x, y) .* (-1)^(x+y);
end
end img_fp = real(img_fp);
img_fp = mat2gray(img_fp); % 显示结果
imshow(img_fp); max_value = max(max(img_fp));
[row col] = find(img_fp == max_value); disp(['max value is : ', num2str(max_value)]);
disp(['row: ', num2str(row), ' col: ', num2str(col)]);

实验结果:



这是输出结果的图片,实验要求没必要显示出来。



最后求出的(x,y)位置的坐标。

数字图像处理实验(9):PROJECT 04-05,Correlation in the Frequency Domain 标签: 图像处理MATLAB 2017-05-25 10:14的更多相关文章

  1. 数字图像处理实验(总计23个)汇总 标签: 图像处理MATLAB 2017-05-31 10:30 175人阅读 评论(0)

    以下这些实验中的代码全部是我自己编写调试通过的,到此,最后进行一下汇总. 数字图像处理实验(1):PROJECT 02-01, Image Printing Program Based on Half ...

  2. ubuntu系统---ubuntu16.04 + virtualenv + py2.7 + tf1.5.0 + keras2.2.4 + opencv2.4.9 +Numpy1.14

    ubuntu16.04 + virtualenv + py2.7 + tf1.5.0 + keras2.2.4 + opencv2.4.9 +Numpy1.14 @https://www.liaoxu ...

  3. 数字图像处理实验(16):PROJECT 06-03,Color Image Enhancement by Histogram Processing 标签: 图像处理MATLAB 2017

    实验要求: Objective: To know how to implement image enhancement for color images by histogram processing ...

  4. 数字图像处理实验(15):PROJECT 06-02,Pseudo-Color Image Processing 标签: 图像处理MATLAB 2017-05-27 20:53

    实验要求: 上面的实验要求中Objective(实验目的)部分是错误的. 然而在我拿到的大纲中就是这么写的,所以请忽视那部分,其余部分是没有问题的. 本实验是使用伪彩色强调突出我们感兴趣的灰度范围,在 ...

  5. 数字图像处理实验(14):PROJECT 06-01,Web-Safe Colors 标签: 图像处理MATLAB 2017-05-27 20:45 116人阅读

    实验要求: Objective: To know what are Web-safe colors, how to generate the RGB components for a given jp ...

  6. 数字图像处理实验(12):PROJECT 05-03,Periodic Noise Reduction Using a Notch Filter 标签: 图像处理MATLAB 2017-0

    实验要求: Objective: To understand the principle of the notch filter and its periodic noise reducing abi ...

  7. 数字图像处理实验(11):PROJECT 05-02,Noise Reduction Using a Median Filter 标签: 图像处理MATLAB 2017-05-26 23:

    实验要求: Objective: To understand the non-linearity of median filtering and its noise suppressing abili ...

  8. 数字图像处理实验(10):PROJECT 05-01 [Multiple Uses],Noise Generators 标签: 图像处理MATLAB 2017-05-26 23:36

    实验要求: Objective: To know how to generate noise images with different probability density functions ( ...

  9. 数字图像处理实验(8):PROJECT 04-04,Highpass Filtering Using a Lowpass Image 标签: 图像处理MATLAB 2017-05-25 0

    实验要求: 高通滤波器可以通过1减去低通滤波器的传递函数得到. 使用公式 计算可以的得到 . 实验代码: % PROJECT 04-04 Highpass Filtering Using a Lowp ...

随机推荐

  1. Django json处理

    转自:http://www.gowhich.com/blog/423 1, 发往浏览器端 前端:jQuery发送GET请求,并解析json数据. url = "http://example. ...

  2. Mac 及 Xcode快捷键

    mac快捷键: 窗口最大化:control+command+F 窗口最小化:command+M 关闭当前:    command+W 退出程序:    command+Q Safari往下翻页:空格 ...

  3. 系列文章--SharePoint 2013 Designer 入门教程

    SharePoint的使用中,SharePoint Designer是非常重要的工具,我们可以通过Designer设计页面.母版页,维护.管理站点,也可以定制列表表单.数据视图,设计工作流等等.下面总 ...

  4. 使用appassembler-maven-plugin插件生成启动脚本

    appassembler-maven-plugin可以自动生成跨平台的启动脚本,省去了手工写脚本的麻烦,而且还可以生成jsw的后台运行程序. 首先pom引入相关依赖 <build> < ...

  5. bzoj 2784 时间流逝 —— 树上高斯消元

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2784 其实转移是一棵树,从根到一个点表示一种能量圈状态,当能量值大于 T 是停止,也就是成为 ...

  6. List,ArrayList

    List是一个接口,而ListArray是一个类. ListArray继承并实现了List. 所以List不能被构造,但可以向上面那样为List创建一个引用,而ListArray就可以被构造. Lis ...

  7. Verilog-2001新增特性

    l generate语句 Verilog-2001添加了generate循环,允许产生 module和primitive的多个实例化,同时也可以产生多个variable,net,task,functi ...

  8. android中HttpClient的应用(POST方法)

    首先在http://hc.apache.org/downloads.cgi下载HttpClient包 直接看代码 import android.os.Handler; import android.o ...

  9. 【转】 Pro Android学习笔记(九三):AsyncTask(2):小例子

    目录(?)[-] 继承AsyncTask UI操作接口 使用AsyncTask 文章转载只能用于非商业性质,且不能带有虚拟货币.积分.注册等附加条件.转载须注明出处:http://blog.csdn. ...

  10. json and pickle 序列化和反序列化

    类似vmware虚拟机里的虚拟主机挂起操作,把当前内存拷贝成文件保存. 上面的这种操作就叫内存序列化:如下图: 有序列化就有反序列化,要把文件里的东西再恢复成字典:eval把字符串变成字典. 但是上面 ...