MATLAB – Ideal Highpass Filter in Image Processing
In the field of Image Processing,
Ideal Highpass Filter (IHPF) is used for image sharpening in the frequency domain. Image Sharpening is a technique to enhance the fine details and highlight the edges in a digital image. It removes low-frequency components from an image and preserves high-frequency components.
This ideal highpass filter is the reverse operation of the ideal lowpass filter. It can be determined using the following relation-
where,
is the transfer function of the highpass filter and
is the transfer function of the corresponding lowpass filter.
The transfer function of the IHPF can be specified by the function-
Where,
- is a positive constant. IHPF passes all the frequencies outside of a circle of radius from the origin without attenuation and cuts off all the frequencies within the circle.
- This is the transition point between H(u, v) = 1 and H(u, v) = 0, so this is termed as cutoff frequency.
- is the Euclidean Distance from any point (u, v) to the origin of the frequency plane, i.e,
Approach:
Step 1: Input – Read an image
Step 2: Saving the size of the input image in pixels
Step 3: Get the Fourier Transform of the input_image
Step 4: Assign the Cut-off Frequency
Step 5: Designing filter: Ideal High Pass Filter
Step 6: Convolution between the Fourier Transformed input image and the filtering mask
Step 7: Take Inverse Fourier Transform of the convoluted image
Step 8: Display the resultant image as output
Implementation in MATLAB:
input_image = imread( '[name of input image file].[file format]' );
[M, N] = size(input_image);
FT_img = fft2(double(input_image));
D0 = 10;
u = 0:(M-1);
idx = find(u>M/2);
u(idx) = u(idx)-M;
v = 0:(N-1);
idy = find(v>N/2);
v(idy) = v(idy)-N;
[V, U] = meshgrid(v, u);
D = sqrt(U.^2+V.^2);
H = double(D > D0);
G = H.*FT_img;
output_image = real(ifft2(double(G)));
subplot(2, 1, 1), imshow(input_image),
subplot(2, 1, 2), imshow(output_image, [ ]);
|
Input Image –
Output:
Last Updated :
22 Apr, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...