要確定正確的填充大小(例如,如果圖像的寬度和高度是10X10,那麼應該是20X20)之後創建的高斯高通濾波器。我如何高斯濾波器應用到DFT輸出中的OpenCV
我有我試圖在OpenCV的端口Matlab代碼,但我正常有困難將它移植。我Matlab代碼低於顯示:
f1_seg = imread('thumb1-small-test.jpg');
Iori = f1_seg;
% Iori = imresize(Iori, 0.2);
%Convert to grayscale
I = Iori;
if length(size(I)) == 3
I = rgb2gray(Iori);
end
%
%Determine good padding for Fourier transform
PQ = paddedsize(size(I));
I = double(I);
%Create a Gaussian Highpass filter 5% the width of the Fourier transform
D0 = 0.05*PQ(1);
H = hpfilter('gaussian', PQ(1), PQ(2), D0);
% Calculate the discrete Fourier transform of the image.
F=fft2(double(I),size(H,1),size(H,2));
% Apply the highpass filter to the Fourier spectrum of the image
HPFS_I = H.*F;
我知道如何在OpenCV中使用DFT,我能夠產生自己的形象,但我不知道如何創建高斯濾波器。請指導我如何創建如上所示的高通高斯濾波器?
感謝您的答案我在想我是非常接近你的出色指導的結果,但我不知道如何生產這樣的濾波器是在matlab中生成的... [編輯] http:/ /uploading.com/files/498a6e9b/filter.png/ – wolvorinePk 2012-03-07 13:25:35
這一個是matlab的輸出...這是否意味着我需要爲這種類型的過濾器創建4個不同的平面併合並所有這些? http://i44.tinypic.com/r0twf7.png – wolvorinePk 2012-03-07 13:38:11
實際上,發生的情況是在Matlab中使用'fftshift'移動了過濾器。正如我在第一篇文章中提到的那樣,交換象限1 <-> 4和2 <-> 3.另外,我相信'dft.cpp' OpenCV示例演示瞭如何執行此操作。 – mevatron 2012-03-07 13:50:29