【发布时间】:2015-05-30 19:38:37
【问题描述】:
我正在尝试在 matlab 中对图像进行去模糊处理。这是我的代码
im = im2double(imread('C:\Users\adhil\Desktop\matlab pics\test.JPG'));
figure, imshow (G1);
% FFT for B1
G_1 = fftshift(G1);
G_1 = fft2(G_1);
G_1 = ifftshift(G_1);
h_1 = fspecial( 'gaussian', [130 221] , 1.0 );
% Fourier Transform of 2D Gaussian
H_1 = fftshift(h_1);
H_1 = fft2(H_1);
H_1 = ifftshift(H_1);
% Apply the filter for Image G_1
display(size(G_1));
display(size(H_1));
F_1a = G_1 ./ H_1;
F_1a = ifftshift (F_1a);
F_1a = ifft2 (F_1a);
F_1a = fftshift (F_1a);
figure, imshow (F_1a);
但是我收到以下错误
使用./时出错
矩阵尺寸必须一致。去模糊错误(第 18 行)
F_1a = G_1 ./ H_1;
我注意到我的图像的数组尺寸是
display(size(G_1));
ans = 130 221 3
display(size(H_1));
ans = 130 221
然而,
h_1 = fspecial( 'gaussian', [130 221 3] , 1.0 );
不接受3维数组,请指教
【问题讨论】:
标签: image matlab image-processing computer-vision