日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

数字图像处理实验(9):PROJECT 04-05,Correlation in the Frequency Domain

發布時間:2025/3/21 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 数字图像处理实验(9):PROJECT 04-05,Correlation in the Frequency Domain 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

實驗要求:

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:Pfor y = 1:Qimg_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:Pfor y = 1:Qimg_fp(x, y) = img_fp(x, y) .* (-1)^(x+y);end endimg_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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。