convolution of the two image

조회 수: 3 (최근 30일)
TULIKA
TULIKA 2014년 8월 23일
댓글: Image Analyst 2014년 8월 23일
i have to code convolution of the two image(the greyimage output and the image i posted)(once in space domain and again in frequency domain using fft2 and ifft2)there is no error in the code but it didn't give proper output...please let me know where i'm going wrong in the coding...
x= 1:256;y=1:256;
[p,q]=freqspace(256);
[X,Y]=meshgrid(p,q);
R=(X.^2 + Y.^2);
Lambda=10*10^-9;
dis=4*10^-2;
F = (exp(i.*pi.*R))./(Lambda.*dis);
grayImage = imag(F);
mesh(grayImage);
imshow(grayImage, []);
colormap(gray(256));
A=imread('image.jpg');
R=A(:,:,1);
G=A(:,:,2);
B=A(:,:,3);
igray=rgb2gray(A);
A1=im2double(igray);
I=conv2(A1,grayImage);
figure,imshow(I,'InitialMagnification','fit');
  댓글 수: 2
Image Analyst
Image Analyst 2014년 8월 23일
Please attach image.jpg or give us a standard demo image we can use instead.
TULIKA
TULIKA 2014년 8월 23일
i posted but didn't showed it.i hope this time it upload the image

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 8월 23일
This seems like two separate programs - the top half does stuff with F, then the bottom half ignores F and does stuff with image.jpg and gray scale versions of it. Are they supposed to be related in anyway? You're basically convolving A with itself, which is the autocorrelation and will give you a strong central spike with steep sides. What do you think the proper output should be? Are you sure you want an autocorrelation of A or do you want to convolve A with F? Please supply more information and images.
  댓글 수: 5
TULIKA
TULIKA 2014년 8월 23일
if you don't mind may i know in my coding where i was going wrong...i want to clear confusion...even in my coding i also doubled the image separately....why it was being auto-correlated?why my program is not working??
and Thanks it works....
is it necessary to have the same dimension iin multiplying the two iamges in frequency domain?
Image Analyst
Image Analyst 2014년 8월 23일
Well the main reason you didn't get any good display is because you didn't use [] in imshow so any values more than 1 just got clipped to 1. Several other problems/issues (though nothing major though and some just a matter of style), so I just did it correct from scratch.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by