Error using .* Matrix dimensions must agree

clc
close all
clear all % convert the image to grey
% frequency scaling
I = imread('c.jpg');
I1=rgb2gray(I);
ed=edge(I1,'canny',0.4);
[gx gy]=gradient(double(ed),0.5);
figure;
imshow(I);
gm=sqrt(gx.^2+gy.^2);
gdp=atan2(gy,gx);
%figure;
%imshow(gm);
figure; imshow(gdp);
A = fft2(double(I)); % compute FFT of the grey image
A1=fftshift(A); % frequency scaling
% Gaussian Filter Response Calculation
[M N]=size(A); % image size
R=10; % filter size parameter
X=0:N-1;
Y=0:M-1;
[X Y]=meshgrid(X,Y);
Cx=0.5*N;
Cy=0.5*M;
Lo=exp(-((X-Cx).^2+(Y-Cy).^2)./(2*R).^2);
Hi=1-Lo; % High pass filter=1-low pass filter
% Filtered image=ifft(filter response*fft(original image))
J=A1.*Lo;
J1=ifftshift(J);
B1=ifft2(J1);
%----visualizing the results----------------------------------------------
figure(3)
imshow(abs(B1),[12 290]), colormap gray
title('low pass filtered image','fontsize',14)
i am doing processing on image i found the gradient and then appy FFT2 on image and trying to appy low pass filter on image i have this error can anyone help me

1 件のコメント

babar ali
babar ali 2017 年 12 月 6 日
Error using .* Matrix dimensions must agree.
Error in v1 (line 37) J=A1.*Lo; this is error

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2017 年 12 月 6 日

0 投票

You have
A = fft2(double(I)); % compute FFT of the grey image
However, I is not your grayscale image: I1 is your grayscale image.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by