Hi,
Even though I use acceptable matrix dimensions, I am getting Matrix dimensions error. dft matrix size is: 500x332 H_blurring matrix size is: 332x500 I multiply these 2 matrix.
"Error using .*
Matrix dimensions must agree."
if true
% A=load('Blurred.mat');
B=A.blurred;
image = im2double(B);
[rows, cols] = size(image);
figure; imshow(image,[]); title('Original image');
%%Blurring (atmospheric turbulence)
dft = fftshift(fft2(image));
k = 0.002;
u0 = floor(rows/2)+1;
v0 = floor(cols/2)+1;
u = (1:rows)-u0;
v = (1:cols)-v0;
[U,V] = meshgrid(u,v);
D = (U.^2+V.^2);
H_blurring = exp(-k*(D.^(5/6)));
figure;
imshow(dft); title('dft');
figure;
imshow(H_blurring); title('Blurred');
result = dft .* H_blurring;
end

 採用された回答

Geoff Hayes
Geoff Hayes 2015 年 5 月 3 日

0 投票

Ismail - using the .* implies that you want to do element-wise multiplication i.e. multiply each element of one matrix with the corresponding (same row and column) element of the other matrix. Since your matrices are of different dimensions then the error makes sense. Just change this line to
result = dft * H_blurring;
and you will now be doing the usual matrix multiplication.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Images についてさらに検索

タグ

質問済み:

2015 年 5 月 3 日

回答済み:

2015 年 5 月 3 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by