hamm2d=hamm2.*hamm2';
hamm_max=max(max(hamm2));
norm_hamm2=hamm2d/hamm_max;
h_fft=(norm_hamm2);
adj_h=h_fft;%<<<<<<<<<<<<<<<<<<<<<<<<
fft_image=fft2(noisy_image);
adj_noisy_image=fftshift(fft_image);
filt_image=adj_h.*adj_noisy_image;%<<<<<<<<<<<<<<<<<<<<<<<<plot this
output_image = abs(ifft2(ifftshift(filt_image)));
Does that help?
Reply by Fred Marshall●April 4, 20062006-04-04
"Anand" <aanand17@gmail.com> wrote in message
news:1144027834.932062.275730@i39g2000cwa.googlegroups.com...
> Thanks Fred for taking time out to read the code and ur suggestions.
> I am using 'cameraman.tif' image.
>
> Earlier when using the 'fft' with hamming window , i was getting a
> image with oval shaped black spot indicating the presence of the man in
> the original image. the image looked free of the gaussian noise(grain
> free) though.
>
> Now that I have removed the 'fft' , I am getting a completely black
> image with a lot of noise(grains).
>
> I am sorry, i didn't completely understand the 2nd para of ur previous
> post, what exactly u wanted me to do. Is it pollting the function, in
> frequency domain using 'freqz' , I did that and the average magnitude
> almost seem constant.
>
Use the hamming function that you generated as hamm2.
Plot it. It's nicely peaked at the center.
Do not fft it. Use it in the frequency domain as below:
Then fft2 the image.
Then fftshift the image.
Plot it just to see what you get with something like surf.
Then multiply by hamm2.
Plot it again to see what you get.
It should be similar to the previous plot but with a gradual peak in the
center / reduction at the edges (high frequencies).
Then ifftshift the image.
Then ifft2 the image.
This will remove the high frequencies in the image to some degree which will
get rid of "noise" and some high frequency detail.
Fred
Reply by jim●April 3, 20062006-04-03
Anand wrote:
>
> Thanks Jim.
>
> I did multiply in the frequency domain. If you check my code, u'll
> know.
OK it looks like you did multiply by something but it wasn't your
window. You seem to be under the impression that all you have to do is
perform the right steps. You also need to apply them to the correct data
in the correct order. Understanding the general concepts helps
enormously in figuring out how to do that. You are approaching it like
you are making a tossed salad where you just throw the ingredients in a
bowl.
-jim
>
> I had a little misunderstanding in the beginning, and thanks for ur
> explanation. That explains it quite well.
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Reply by Anand●April 3, 20062006-04-03
Thanks Jim.
I did multiply in the frequency domain. If you check my code, u'll
know.
I had a little misunderstanding in the beginning, and thanks for ur
explanation. That explains it quite well.
Reply by Anand●April 3, 20062006-04-03
basically what 'fwind2' does is to design a 2 D filter using the 2 D
window.
So what I have been trying to do is working only with window.
Was that the missing link?
Sorry...haven't been completely understand the working of 'fwind2' .
Still trying to figure out :)
Reply by jim●April 3, 20062006-04-03
Anand wrote:
>
> Jerry,
> As far as "why i chose it?" , coz I was asked to use "only" this
> by my prof.
>
> I guess they are more used in Biomedical imaging. I have read a few
> article, using hamming window technique to remove noise from the image.
>
> Though I dont know the complete procedure, how to do that still :) .
>
> I was just playing with 'fwind2' function in Matlab, and for hamming ,
> it gave quite a decent output, with my noisy image.
See it wasn't that hard to explain the problem rather than ask why your
solution isn't working without any clue as to the problem.
So you have 2 tasks: one is to figure out what 'fwind2'
does and to figure out what Hamming means in the context of that
function.
I don't speak Matlabese so I can't answer the question but I can guess
what you did was apply the hamming window in the frequency domain with
the window functions central hump centered at F0 and that produced a
desirable result on your image in the spatial domain. This is a
predictable result.
The Hamming window you keep talking about could have been the well
known 1D Hamming window applied separately as 2 orthogonal 1D windows or
it could be a circular 2d window generated by sampling a revolved
version of the 1d window. As it happens because of the shape of the
window itself the difference between the 2 forms would be rather minor
in much the same way that the difference between 2 Gausian windows
generated by those 2 methods are very similar.
Anyway the real problem here is you are not grasping a simple Fourier
Transform property: the multiplication <-> convolution duality. That is
multiplication in one domain equals convolution in the other. In your
case you are getting confused as to which domain you want to have
convolution and which multiplication. You need to achieve some grasp of
this concept or you efforts will be just stabs in the dark.
One thing I can tell you for sure. You do not want to multiply by a
window function in the spatial domain. Even if that is what people often
do it makes no sense in the context of what you are trying to achieve.
So you want to apply your window function in the frequency domain. You
may want to think about what that will accomplish. It will attenuate the
higher frequency with less and less effect as you get closer to F0. It
is equivalent to convolving your image by some kernel in the spatial
domain that has the same effect on the frequency domain.
So if your smart your first task would be to find out what the kernel
of your window function looks like in the spatial domain. That is do an
IDFT on the window function by itself.
Good luck,
-jim
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Reply by Anand●April 3, 20062006-04-03
Can anyone tell me, how can I make the output of the hamming window
symmetric.
I kno the function in Matlab gives the symmetric output by dafault.
I am writing the function on my own using its standard equation.
Thanks,
Anand
Reply by Anand●April 3, 20062006-04-03
I still wanted to work on the code that I was writing.
Just wanted to know if I m going on the right track.
I dont seem to get the result that I desire though.
Reply by Anand●April 2, 20062006-04-02
Jerry,
As far as "why i chose it?" , coz I was asked to use "only" this
by my prof.
I guess they are more used in Biomedical imaging. I have read a few
article, using hamming window technique to remove noise from the image.
Though I dont know the complete procedure, how to do that still :) .
I was just playing with 'fwind2' function in Matlab, and for hamming ,
it gave quite a decent output, with my noisy image.
I am just trying to find out the details of the function.
Reply by Jerry Avins●April 2, 20062006-04-02
Anand wrote:
> Thanks for the link Jerry.
>
> I know what is seperable 2D filter.
>
> It can be written as w(m,n)=w(m)w(n) and I know Gaussian is one kind.
>
> But I am using a Hamming window low pass filter to remove the gaussian
> noise from the image.
>
> Is there a correlation? If it is, i dont know about that.
A Hamming window is not, as far as I know, separable. A separable 2-D
filter needs twice as many operations as the one-D prototype. A
non-separable window squares the number of prototype operations. There
are many windows -- read 'filter kernels' -- used to process images,
some separable, some not. In my limited experience, I have not before
seen a Hamming (raised cosine) window used or recommended. Why did you
choose it?
Gaussian noise has a uniform spectrum. If you remove all of it, you
remove the picture too. If you use a sharp-cutoff filter that removes
that portion of the image spectrum that is unneeded or is made useless
by the noise, you will have removed some of the noise while retaining as
much as possible of the image. The separable filters that I know which
do this reasonably well are not circularly symmetric. Oh well!
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������