Lecture: Image manipulations (2) Filters and kernels Alireza Akhavan Pour CLASS.VISION سه شنبه - ۸ اسفند ۱۳۹۶
Image Manipulations (Part 2) 1. Intro to Convolution 2. Blurring 3.Sharpening 4. Dilation, Erosion, Opening and Closing 5. Edge Detection & Image Gradients سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average 2D DS moving average over a 3 × 3 window of neighborhood h 1 سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average 90 90 Courtesy of S. Seitz سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average 90 90 10 5 سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average 90 90 10 20 سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average 90 90 10 20 30 سه شنبه - ۸ اسفند ۱۳۹۶
90 10 20 30 سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average 90 10 20 30 40 60 90 50 80 Source: S. Seitz سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average In summary: This filter “Replaces” each pixel with an average of its neighborhood. Achieve smoothing effect (remove sharp features) 1 سه شنبه - ۸ اسفند ۱۳۹۶
Filter example #1: Moving Average سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution Assume we have a filter(h[,]) that is 3x3. and an image (f[,]) that is 7x7. سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution Assume we have a filter(h[,]) that is 3x3. and an image (f[,]) that is 7x7. سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution Assume we have a filter(h[,]) that is 3x3. and an image (f[,]) that is 7x7. سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution Assume we have a filter(h[,]) that is 3x3. and an image (f[,]) that is 7x7. سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution Assume we have a filter(h[,]) that is 3x3. and an image (f[,]) that is 7x7. سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution Assume we have a filter(h[,]) that is 3x3. and an image (f[,]) that is 7x7. سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution example سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution example Slide credit: Song Ho Ahn سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution example Slide credit: Song Ho Ahn سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution example Slide credit: Song Ho Ahn سه شنبه - ۸ اسفند ۱۳۹۶
سه شنبه - ۸ اسفند ۱۳۹۶
Slide credit: Song Ho Ahn سه شنبه - ۸ اسفند ۱۳۹۶
2D convolution example سه شنبه - ۸ اسفند ۱۳۹۶
1 ? = * Original Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
Convolution in 2D - examples 1 = * Original Filtered (no change) Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
Convolution in 2D - examples 1 ? = * Original Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
Convolution in 2D - examples 1 = * Original Shifted right By 1 pixel Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
? 1 = * Original Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
Convolution in 2D - examples 1 = * Original Blur (with a box filter) Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
- = ? - 2 1 1 1 1 (Note that filter sums to 1) Original 2 1 = ? (Note that filter sums to 1) Original “details of the image” - 1 1 1 + Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
What does blurring take away? detail – = original smoothed (5x5) Let’s add it back: original detail sharpened + a = سه شنبه - ۸ اسفند ۱۳۹۶
Convolution in 2D – Sharpening filter - 2 1 = Original Sharpening filter: Accentuates differences with local average Courtesy of D Lowe سه شنبه - ۸ اسفند ۱۳۹۶
Image support and edge effect A computer will only convolve finite support signals. What happens at the edge? • zero “padding” • edge value replication • mirror extension • more (beyond the scope of this class) -> Matlab conv2 uses zero-padding f h سه شنبه - ۸ اسفند ۱۳۹۶
Convolution vs. (Cross) Correlation A convolution is an integral that expresses the amount of overlap of one function as it is shifted over another function. convolution is a filtering operation Correlation compares the similarity of two sets of data. Correlation computes a measure of similarity of two input signals as they are shifted by one another. The correlation result reaches a maximum at the time when the two signals match best . correlation is a measure of relatedness of two signals سه شنبه - ۸ اسفند ۱۳۹۶
What about OpenCV? Convolution or (Cross) Correlation? http://docs.opencv.org/modules/imgproc/doc/filtering.html#filter2d سه شنبه - ۸ اسفند ۱۳۹۶
https://en.wikipedia.org/wiki/Kernel_(image_processing) سه شنبه - ۸ اسفند ۱۳۹۶
سه شنبه - ۸ اسفند ۱۳۹۶
سه شنبه - ۸ اسفند ۱۳۹۶
سه شنبه - ۸ اسفند ۱۳۹۶
سه شنبه - ۸ اسفند ۱۳۹۶
سه شنبه - ۸ اسفند ۱۳۹۶
منابع http://vision.stanford.edu/teaching/cs131_fall1718/ https://en.wikipedia.org/wiki/Kernel_(image_processing) https://www.udemy.com/master-computer-vision-with-opencv-in-python/ http://docs.opencv.org/ سه شنبه - ۸ اسفند ۱۳۹۶