Matrix dimensions must agree
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposta accettata
Geoff Hayes
il 3 Mag 2015
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Geometric Transformation and Image Registration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!