• 490 likes • 750 Views
Basis beeldverwerking (8D040) dr. Andrea Fuster dr. Anna Vilanova Prof.dr.ir . Marcel Breeuwer. Convolution. Contents. Spatial filtering Correlation Convolution Filters: Smoothing filters Sharpening filters Borders. Spatial filtering.
E N D
Basis beeldverwerking (8D040)dr. Andrea Fusterdr. Anna VilanovaProf.dr.ir. Marcel Breeuwer Convolution
Contents • Spatial filtering • Correlation • Convolution • Filters: • Smoothing filters • Sharpening filters • Borders Basis beeldverwerking 8D040
Spatial filtering • Input image , use a filter to obtain processed image • Filter consists of • Neighbourhood (rectangular) • Mostly odd dimensions • Predefined operation • Create new pixel value in center of neighbourhood Basis beeldverwerking 8D040
Spatial filtering Filter operation (3x3 filter) More compact notation - filter Basis beeldverwerking 8D040
Intuition to filtering Basis beeldverwerking 8D040
Move filter over image Basis beeldverwerking 8D040
Correlation • While moving the filter, at each position • Multiply values of overlapping locations • Sum all multiplication results Basis beeldverwerking 8D040
Correlation vs. Convolution - Equivalent to first rotate the filter 180 degrees and correlate- Discrete Correlation 2D Discrete Convolution 2D Basis beeldverwerking 8D040
Example See blackboard ☺ (or figure 3.30 Gonzalez and Woods) Basis beeldverwerking 8D040
Correlation vs. Convolution Correlation and convolution give the same result if the filter used is symmetric! Basis beeldverwerking 8D040
Convolution – 1D cont. case • Imagine a system with • input signal • transfer function • output signal • then Basis beeldverwerking 8D040
input output Definition system transfer function Basis beeldverwerking 8D040
Dirac delta function (unit impulse) • Definition • Constraint • Sifting property • Specifically for t=0 Basis beeldverwerking 8D040
Convolution We saw this already in the discrete case Let Basis beeldverwerking 8D040
Properties of convolution • Commutative • Associative • Distributive Basis beeldverwerking 8D040
Convolution is commutative • Proof • Let • Q.E.D. Basis beeldverwerking 8D040
Convolution is associative - 1 Proof Basis beeldverwerking 8D040
Convolution is associative - 2 Basis beeldverwerking 8D040
Convolution is associative - 3 • Let Basis beeldverwerking 8D040
Convolution is associative - 4 Q.E.D. Basis beeldverwerking 8D040
Convolution is distributive - 1 Proof Basis beeldverwerking 8D040
Convolution is distributive - 2 Q.E.D. Basis beeldverwerking 8D040
Discrete convolution 1D 2D Basis beeldverwerking 8D040
Discrete convolution • Formulas take summation from to • Filters have a limited size, e.g., • 1D 2a + 1 • 2D (2a + 1, 2b + 1) Basis beeldverwerking 8D040
Kernel Filter Kernels Basis beeldverwerking 8D040
Filters Idea: correlate or convolve image with different filters in order to obtain different results, i.e., processed images Basis beeldverwerking 8D040
Smoothing filters … NxN filter • Average intensities – result is blurred image, less details • Response: (z’s image intensities) Basis beeldverwerking 8D040
Smoothing filters • Note that: • Sum of filter coefficients is 1 (normalized filter) • Correlation = convolution (symmetric filter) • Filter size effect? Basis beeldverwerking 8D040
Smoothing filters - example Original 3x3 smoothing filter NxN filter (see figure 3.33 in Gonzalez and Woods!) Basis beeldverwerking 8D040
Effect of normalized smoothing kernel normalized non- normalized Basis beeldverwerking 8D040
Sharpening filters Enhance parts of the image where intensities change rapidly, such as edges Basic derivative filters Measure change of intensity in x or y direction Basis beeldverwerking 8D040
Example Basis beeldverwerking 8D040
Arbitrary angle derivative Given and Basis beeldverwerking 8D040
Arbitrary angle derivative Basis beeldverwerking 8D040
Prewitt gradient kernel • Derivative in one direction, smoothing in the perpendicular direction Basis beeldverwerking 8D040
Example Prewitt Basic derivative Basis beeldverwerking 8D040
Sobel kernel Basis beeldverwerking 8D040
Example (Thanks to Wikipedia☺)
Derivative filters Note that coefficients in all of the previous filters sum to zero, i.e., zero response in area of constant intensity Also: gradient, Laplacian, … Basis beeldverwerking 8D040
Borders Do you see any problems at image borders? Try position (0,0) Basis beeldverwerking 8D040
Border problems • How to handle? • No border handling • Border is not filtered • Padding • Put values outside image border • Cyclic padding • Use values from the other side of the image Basis beeldverwerking 8D040
Zero padding Basis beeldverwerking 8D040
Cyclic padding Basis beeldverwerking 8D040
Padding Remember: padding is artificial! The values chosen outside the border influence the outcome image Basis beeldverwerking 8D040
End of part 2 Thanks and see you Tuesday 21! Basis beeldverwerking 8D040