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