convolution of two image in frequency domain?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
TULIKA
il 23 Ago 2014
Commentato: Image Analyst
il 13 Dic 2021
x= 1:150;y=1:150;
[p,q]=freqspace(150);
[X,Y]=meshgrid(p,q);
R=(X.^2 + Y.^2);
Lambda=633*10^-9;
dis=10*10^-3;
F = (exp(i.*pi.*R))./(Lambda.*dis);
kernel = imag(F); % Gray scale image = imaginary part.
mesh(kernel);
axis square
imshow(kernel, []);
axis on;
colormap(gray(256));
rgbImage = imread('image.jpg');
imshow(rgbImage);
axis on;
% R=rgbImage(:,:,1);
% G=rgbImage(:,:,2);
% B=rgbImage(:,:,3);
grayImage = rgb2gray(rgbImage);
imshow(grayImage, []);
axis on;
grayImage1=fft2(double(grayImage));
kernel1=fft2(kernel);
Imagef=kernel*grayImage1;
Imagefinal=ifft2(Imagef);
imshow(Imagefinal, []);
axis on;
This code has no errors. Its output should be like a hazy image of concentrating circle or may be overlapped, but it shows hazy straight line. Please help.
2 Commenti
Linas Svilainis
il 13 Dic 2021
Are you sure this code has no erros? kernel1=fft2(kernel);
BUT
Imagef=kernel*grayImage1;
NOT kernel1?
Why * not .*?
Image Analyst
il 13 Dic 2021
@Linas Svilainis I think they meant to say "This code has errors." The problem is to multiply the spectrum of a kernel times a spectrum of a filter, you'd need to use .* (dot star) instead of *, and you'd need to make sure they both have the same size (number of pixels).
Risposta accettata
Image Analyst
il 23 Ago 2014
See my demos, attached. They're good examples that show you how it's done. Once you understand and run those I have no doubt you will be able to do the same thing with your image and kernel.
13 Commenti
Image Analyst
il 25 Ago 2014
This is one situation where clear all is good. See how you were able to display image4? But you never defined image4, so where did that image4 come from? Not from this running of the program. It must have existed already. Who knows how many other times this happened with other variables. Either call clear all or put it in the front of your script.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!