TRANSFORMING THE INPUT GRAYSCALE IMAGE TO THE FREQUENCY DOMAIN USING FFT .... iii LIST OF ABBREVIATIONS Adobe Ps Adobe Photoshop DFT Discrete Fourier Transform FFT Fast Fourier transfor
Trang 1UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI DEPARTMENT OF AERONAUTICS
SIGNAL AND IMAGE PROCESSING
PROJECT REPORT
High-Pass Filter Experiment in Image Processing
By Phạm Quốc Chính Student ID: 23BI14077 Nguy ễn Văn Bình Student ID: 23BI14064
Instructor: Dr Bùi Quang Thành
Hanoi, 2024
Trang 2i
TABLE OF CONTENTS
ACKNOWLEDGEMENTS II LIST OF ABBREVIATIONS III LIST OF FIGURES IV
I INTRODUCTION 1
II OBJECTIVE 2
III LITERATURE REVIEW AND METHODOGY 3
1 TRANSFORMING THE INPUT GRAYSCALE IMAGE TO THE FREQUENCY DOMAIN USING FFT 3
2 DESIGNING A CIRCULAR MASK TO REMOVE LOW-FREQUENCY COMPONENTS 3
3 APPLYING THE MASK AND TRANSFORMING THE RESULT BACK TO THE SPATIAL DOMAIN 3
IV RESULTS AND DISCUSSION 4
V CONCLUSION 7
REFERENCES 8
APPENDICES 1
Trang 3ACKNOWLEDGEMENTS
We are deeply grateful to everyone who supported us in completing this report We would like to extend our heartfelt thanks to Hanoi University of Science and Technology for their academic assistance
First and foremost, we would like to sincerely thank our supervisor, Dr Bui Quang Thanh, for providing us with valuable information, formulas, and materials We also appreciate Bach The Son for guiding us in the right direction
Trang 4iii
LIST OF ABBREVIATIONS
Adobe Ps Adobe Photoshop
DFT Discrete Fourier Transform
FFT Fast Fourier transform
HPF High-pass filter
IDFT Inverse Discrete Fourier Transform
MRI Magnetic Resonance Imaging
USTH University of Science and Technology of Hanoi
Trang 5LIST OF FIGURES
Figure 1: Original Picture 4
Figure 2: Frequency domain of original picture 4
Figure 3: At a radius of 10 4
Figure 4: At a radius of 50 4
Figure 5: Freg domain with radius of 10 5
Figure 6: Freg domain with radius of 50 5
Figure 7: Before sharpening Images 6
Figure 8: After sharpening Images 6
Trang 61
I INTRODUCTION
A high-pass filter (HPF) is a type of electronic filter that allows signals with frequencies above a certain cutoff frequency to pass through while reducing signals with frequencies below that threshold High-pass filters serve multiple purposes For instance, in image processing, the application of high-pass filters clarifies details in X-rays or MRI scans
I find this topic particularly interesting because, during my high school years, I joined a photography club and had many opportunities to work with Photoshop In Adobe Photoshop, the high-pass filter is used to sharpen photos According to Adobe: "When you sharpen an image, you’re increasing the contrast along any
edges where there’s a change in brightness and texture If you’re working in
Photoshop, its High Pass Filter basically finds these edges and highlights them." [1]
For this project, I will write a high-pass filter program in MATLAB to enhance the sharpness of images
Trang 7II OBJECTIVE
The objectives of this reaseach are:
• enhance the sharpness of images
• High-pass filter application
Trang 83
III LITERATURE REVIEW AND METHODOGY
This project uses MATLAB to implement a high-pass filter by leveraging the Discrete Fourier Transform (DFT) The methodology includes:
1 Transforming the Input Grayscale Image to the Frequency Domain Using FFT
We utilize the `fft2` function in MATLAB to perform a 2D Fourier transform on a
grayscale image The result is a complex frequency spectrum, where low-frequency components are located at the corners, and high-frequency components are found at the edges Next, we use the `fftshift` function to rearrange the frequency spectrum, moving the low frequencies to the center and the high frequencies to the edges This
rearrangement makes it easier to manipulate and visualize the frequency spectrum
2 Designing a Circular Mask to Remove Low-Frequency Components
After rearranging the frequency spectrum, define the spectrum center The spectrum center, represented by the coordinates (ccol, crow), indicates the point of the lowest frequency Next, create a high-pass filter mask that removes the low-frequency region by specifying a radius size Finally, apply the mask to the frequency spectrum
3 Applying the Mask and Transforming the Result Back to the Spatial Domain The final step is to convert the filtered frequency spectrum back to the spatial domain using the inverse Discrete Fourier Transform (IDFT) In MATLAB, we use the `ifft2` function for this conversion
Trang 9IV RESULTS AND DISCUSSION
Our project involves using a high-pass filter to effectively sharpen input images by preserving edges and enhancing details We utilized photos taken with a crop-sensor digital camera (Canon Kiss X5 with a kit lens) that Chinh captured during high school Next, we applied the Fast Fourier Transform (FFT) to convert the images from the spatial domain to the frequency domain We then rearranged the frequency domain so that the lower frequencies are positioned at the center In this representation, the low-frequency components appear white, while the high-frequency components are shown in gray
Figure 1 Original Picture : Figure 2 Frequency domain of original picture :
To remove low frequencies, we create a filter by drawing a circle at the center of the image While doing this, we asked, "What is the difference between a large radius and
a small radius?" We tested radii of 10 and 50 Here are the results:
Figure 3: At a radius of 10 Figure 4: At a radius of 50
Trang 105
There are many differences between the two pictures Why is that?
To clarify, we converted figures 3 and 4 back to the frequency domain
Figure 5 Freg domain with a radius of 10.: Figure 6 Freg domain with a radius of 50 :
As you can see, the low-frequency component in Figure 4 is still quite prominent, while
in Figure 5, it has been significantly reduced However, a new question arises: “What
radius is sufficient?”
The answer depends on several factors, including the image size and its intended use A small radius will remove less of the low-frequency region, preserving more details in smoother areas This makes it suitable for gentle and subtle sharpening, allowing you to maintain much of the image’s detail In contrast, a large radius will eliminate almost all
low-frequency content, which sharpens edges and fine details This approach is better suited for edge detection
In conclusion, high-pass filters have a wide range of applications across various fields In audio processing, for example, high-pass filters are utilized to eliminate bass frequencies for use in tweeters Similarly, in image processing, high-pass filters enhance image detail For instance, if you take a blurry photo, you can use the high-pass filter in Adobe Photoshop to improve the sharpness of the details
This demonstrates how high-pass filters can effectively increase image sharpness
Trang 11Figure 7 Before sharpening Images :
Figure 8: After sharpening Images
Trang 127
V CONCLUSION
Sharpening images is very important In this project, we utilized the Fast Fourier Transform (FFT) to convert images into the frequency domain, and we developed a high-pass filter program in MATLAB We also addressed the challenges we encountered during this work
In summary, this project successfully demonstrated the application of high-pass filtering to enhance image sharpness using MATLAB The results confirm the effectiveness of frequency domain processing in highlighting high-frequency details
Looking ahead, we hope to improve the code to output color images as well
Trang 13REFERENCES
[1] Using the high pass filter in Photoshop adobe Using the High Pass Filter in Photoshop to –
sharpen your photos Available at:
https://www.adobe.com/creativecloud/photography/hub/guides/sharpen-image-high-pass-filter.html
[2] Steven W Smith (1997) The scientist and engineer’s Guide To digital Signal Processing, Fourier Image Analysis Available at: https://www.dspguide.com/ch24/5.htm
Trang 141
APPENDICES
APPENDIX 1 DFT 2D formular:
𝐹(𝑢, 𝑣) = 𝑀𝑁 ∑ ∑ 𝑓[𝑥, 𝑦]1
𝑁−1 𝑛=0
𝑀−1 𝑚=0
𝑒−𝑖2𝜋(𝑢𝑥𝑀 +𝑣𝑦𝑁 ) Inverse DFT 2D formular:
𝑓[𝑥, 𝑦] =𝑀𝑁 ∑ ∑ 𝐹(𝑢, 𝑣)𝑒1 𝑖2𝜋(𝑢𝑥𝑀 +𝑣𝑦𝑁 )
𝑁−1 𝑛=0
𝑀−1
𝑚=0 Where:
• 𝑓[𝑥, 𝑦 : Pixel intensity of the image at coordinates (x,y) in the spatial domain ]
• 𝐹(𝑢 𝑣): Frequency spectrum component at coordinates (u,v) in the frequency domain
• M: Image height (pixel)
• N: Image width (pixel)
• 𝑒±𝑖2𝜋(𝑢𝑥𝑀+𝑣𝑦𝑁): Complex exponential function, representing the oscillation of a signal
Trang 15ATTACHMENTS