I Read the image 'abc.jpg'
im MATLAB and covert its data type to double.Display the image.
Store the size of image in M and N. All the loops of x, y, u and v runs till image size.
Now I want to know
1:how Multiply the above input image by (-1)^x+y
To Center the Transform To U = M/2 And V = N/2
.
2:multiply it with ideal HPF(High Pass Filter) with value of D=50.
where D is the radius size of Ideal HPF.
After Multiplying with Ideal HPF the resulting image will look like this.
I'm not sure to understand exactly what you want to do, but it seems like you're trying to implement a high pass filter based on a FFT.
That is how I would proceed:
(
fftshift
is centering the 0 frequency component)And then crop
FreqDomain
to whichever cutoff you like, and applyifft
to the cropped image.%Distance Calculation for High Pass Filter using Distance Formula
OUTPUT
An ideal HPF is a 0-1 filter that reduce to zero all frequencies lower than
D
.Since you placed a bounty, I wrote an enhanced reply.
I should mention that you might want to consider using an appropriate window filter before calculating your fft to avoid border artifacts (I included this option in the code below). I hope it helps.
Here is a suggestion for your code:
Generating a Hanning window to suppress border artifacts: (optional)
Calculating the 2D fft of the weighted image: (remove .*Hann if you don't want it)
Generating a disc-shaped binary mask with radius D:
Masking the frequency domain image:
Computing inverse FFT:
Note that the code assumes
D
is smaller thanx/2
andy/2