Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Digital image processing
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Filtering === Digital filters are used to blur and sharpen digital images. Filtering can be performed by: * [[Kernel (image processing)#Convolution|convolution]] with specifically designed [[Kernel (image processing)|kernels]] (filter array) in the spatial domain<ref name=":0">{{Cite journal|last1=Zhang|first1=M. Z.|last2=Livingston|first2=A. R.|last3=Asari|first3=V. K.|date=2008|journal=International Journal of Computers and Applications|volume=30|issue=4|pages=298β308|doi=10.1080/1206212x.2008.11441909|title=A High Performance Architecture for Implementation of 2-D Convolution with Quadrant Symmetric Kernels|s2cid=57289814}}</ref> * masking specific frequency regions in the frequency (Fourier) domain The following examples show both methods:<ref name="Gonzalez 2008">{{cite book |last = Gonzalez |first = Rafael |title = Digital Image Processing, 3rd |publisher = Pearson Hall |date = 2008 |isbn = 978-0-13-168728-8 }}</ref> {| class="wikitable" |- ! Filter type ! Kernel or mask ! Example |- | '''Original Image''' | align="center" | <math> \begin{bmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix} </math> | [[File:Affine Transformation Original Checkerboard.jpg]] |- | '''[[lowpass|Spatial Lowpass]]''' | align="center" | <math> \frac{1}{9}\times \begin{bmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix} </math> | [[File:Spatial Mean Filter Checkerboard.png]] |- | '''[[Edge detection|Spatial Highpass]]''' | align="center" | <math> \begin{bmatrix} 0 & -1 & 0 \\ -1 & 4 & -1 \\ 0 & -1 & 0 \end{bmatrix} </math> | [[File:Spatial Laplacian Filter Checkerboard.png]] |- | '''[[Fast Fourier transform|Fourier Representation]]''' | Pseudo-code: image = checkerboard F = Fourier Transform of image Show Image: log(1+Absolute Value(F)) | align="center"| [[File:Fourier Space Checkerboard.png]] |- | '''Fourier Lowpass''' | align="center"| [[File:Lowpass Butterworth Checkerboard.png]] | align="center"| [[File:Lowpass FFT Filtered checkerboard.png]] |- | '''Fourier Highpass''' | align="center"| [[File:Highpass Butterworth Checkerboard.png]] | align="center"| [[File:Highpass FFT Filtered checkerboard.png]] |- |} ==== Image padding in Fourier domain filtering ==== Images are typically padded before being transformed to the Fourier space, the [[highpass filter]]ed images below illustrate the consequences of different padding techniques: {| class="wikitable" |- ! Zero padded ! Repeated edge padded |- | [[File:Highpass FFT Filtered checkerboard.png]] | [[File:Highpass FFT Replicate.png]] |- |} Notice that the highpass filter shows extra edges when zero padded compared to the repeated edge padding. ==== Filtering code examples ==== MATLAB example for spatial domain highpass filtering. <syntaxhighlight lang="matlab"> img=checkerboard(20); % generate checkerboard % ************************** SPATIAL DOMAIN *************************** klaplace=[0 -1 0; -1 5 -1; 0 -1 0]; % Laplacian filter kernel X=conv2(img,klaplace); % convolve test img with % 3x3 Laplacian kernel figure() imshow(X,[]) % show Laplacian filtered title('Laplacian Edge Detection') </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)