2D Signal Processing (III): 2D Filtering
Total Page:16
File Type:pdf, Size:1020Kb
6.003 Signal Processing Week 11, Lecture A: 2D Signal Processing (III): 2D Filtering 6.003 Fall 2020 Filtering and Convolution Time domain: Frequency domain: 푋[푘푟, 푘푐] ∙ 퐻[푘푟, 푘푐] = 푌[푘푟, 푘푐] Today: More detailed look and further understanding about 2D filtering. 2D Low Pass Filtering Given the following image, what happens if we apply a filter that zeros out all the high frequencies in the image? Where did the ripples come from? 2D Low Pass Filtering The operation we did is equivalent to filtering: 푌 푘푟, 푘푐 = 푋 푘푟, 푘푐 ∙ 퐻퐿 푘푟, 푘푐 , where 2 2 1 푓 푘푟 + 푘푐 ≤ 25 퐻퐿 푘푟, 푘푐 = ቊ 0 표푡ℎ푒푟푤푠푒 2D Low Pass Filtering 2 2 1 푓 푘푟 + 푘푐 ≤ 25 Find the 2D unit-sample response of the 2D LPF. 퐻퐿 푘푟, 푘푐 = ቊ 0 표푡ℎ푒푟푤푠푒 퐻 푘 , 푘 퐿 푟 푐 ℎ퐿 푟, 푐 (Rec 8A): 푠푛 Ω 푛 ℎ 푛 = 푐 퐿 휋푛 Ω푐 Ω푐 The step changes in 퐻퐿 푘푟, 푘푐 generated overshoot: Gibb’s phenomenon. 2D Convolution Multiplying by the LPF is equivalent to circular convolution with its spatial-domain representation. ⊛ = 2D Low Pass Filtering Consider using the following filter, which is a circularly symmetric version of the Hann window. 2 2 1 1 푘푟 + 푘푐 2 2 + 푐표푠 휋 ∙ 푓 푘푟 + 푘푐 ≤ 25 퐻퐿2 푘푟, 푘푐 = 2 2 25 0 표푡ℎ푒푟푤푠푒 2 2 1 푓 푘푟 + 푘푐 ≤ 25 퐻퐿1 푘푟, 푘푐 = ቐ Now the ripples are gone. 0 표푡ℎ푒푟푤푠푒 But image more blurred when compare to the one with LPF1: With the same base-width, Hann window filter cut off more high freq. component than the rectangular window. Use the “width at half maximum” 2D Low Pass Filtering Using a Hann window Filter with similar “width at half maximum”: With Hann window Filter the ripples are gone. Comparing Filters LPF1: 2 2 1 푓 푘푟 + 푘푐 ≤ 25 퐻퐿1 푘푟, 푘푐 = ቐ 0 표푡ℎ푒푟푤푠푒 LPF2: 퐻퐿2 푘푟, 푘푐 1 1 푘2 + 푘2 + 푐표푠 휋 ∙ 푟 푐 푓 푘2 + 푘2 ≤ 50 = ൞2 2 50 푟 푐 0 표푡ℎ푒푟푤푠푒 2D High Pass Filtering What does the high frequency content of the image look like? One simple way to implement a high-pass filter: In the spatial domain, then, we have: 2 2 1 푓 푘푟 + 푘푐 > 25 퐻퐻 푘푟, 푘푐 = 1 − 퐻퐿 푘푟, 푘푐 = ቐ ℎ퐻 푟, 푐 = 푅퐶훿[푟, 푐] − ℎ퐿 푟, 푐 0 표푡ℎ푒푟푤푠푒 1 − 퐻퐿1 푘푟, 푘푐 1 − 퐻퐿2 푘푟, 푘푐 ringing artifacts reduced 2D High Pass Filtering What does the high frequency content of the image look like? One simple way to implement a high-pass filter: In the spatial domain, then, we have: 2 2 1 푓 푘푟 + 푘푐 > 25 퐻퐻 푘푟, 푘푐 = 1 − 퐻퐿 푘푟, 푘푐 = ቐ ℎ퐻 푟, 푐 = 푅퐶훿[푟, 푐] − ℎ퐿 푟, 푐 0 표푡ℎ푒푟푤푠푒 220x220 =48400 2D High Pass Filtering 1 − 퐻퐿2 푘푟, 푘푐 Convolving with another kernel: Sharp edges will be enhanced/ detected with this type of kernel. Smooth features are leveled out. Check yourself! What manipulation was done in the frequency Below shows the MIT dome image, and its domain to produce the following image? 2D DFT. Check yourself! What manipulation was done in the frequency Below shows the MIT dome image, and its domain to produce the following image? 2D DFT. 2D Magnitude and Phase So far, we have only considered magnitude. Does phase matter? There is clearly structure in the magnitude; phase looks random. 2D Magnitude and Phase Zeroing out the phase has an enormous impact on the image. Phase is clearly important. 2D Magnitude and Phase Flattening the magnitude has some effect. But the image is still recognizable! 2D Magnitude and Phase Different Mag Substituting the magnitude from a different image has some effect. But the boat is recognizable. What magnitude was used? 2D Magnitude and Phase The magnitude for the previous image was taken from this image. 2D Magnitude and Phase • Two different images: bird and plane. • Apparently the phase information takes a dominate role of how the image look like. Discrete Fourier Series of Sounds We previously looked at Fourier representations for sounds. Phase played a minor role in auditory perception. The following signals have the same magnitudes but different phases. But they all sound very similar to each other. Visual Perception of Phase Why are the phase information of images so important? It appears our visual perception is more influenced by phase. All Fourier components must have correct phase to preserve an edge. Changing the phase of just one component can have a drastic effect on an image. Auditory Perception of Phase Why are we insensitive to the phase of components of sound? Different frequencies are processed in different regions of the cochlea, with little sensitivity to changes in phase across frequency regions. However, we are very sensitive to binaural phase differences at a given frequency. An Interesting Optical Illusion A hybrid image is created by combining the low frequencies from one image (left) with the high frequencies of another (right). An Interesting Optical Illusion A hybrid image is created by combining the low frequencies from one image with the high frequencies of another. Summary 2D Filtering: • Sharp transitions between passbands and stopbands produce overshoot (Gibb’s phenomenon) in 2D filters. This ringing shows up as ripples in processed images. • Low frequency content vs. high frequency content in an image. • The sensitivity to different frequency content of our eyes: distance, eyesight, etc Many features of an image (such as the orientations of structures) are apparent in the magnitude of the Fourier transform, but the phase of the Fourier transform is crucial to representing sharp edges. 6.003 Fall 2020.