正しいパディング サイズを決定した後、ガウス ハイパス フィルターを作成したいと考えています (たとえば、画像の幅と高さが 10X10 の場合、20X20 にする必要があります)。
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 を使用する方法を知っており、そのイメージを生成できますが、ガウス フィルターを作成する方法がわかりません。上記のようなハイパス ガウス フィルターを作成する方法を教えてください。