4 ms·
Yeah, weirdly a lot of basic image processing tasks can be expressed as convolutions: https://en.wikipedia.org/wiki/Kernel_(image_processing) https://en.wikiped
by jey 9y ago
Yeah, weirdly a lot of basic image processing tasks can be expressed as convolutions: https://en.wikipedia.org/wiki/Kernel_(image_processing) https://en.wikipedia.org/wiki/Kernel_(image_processing)
- eat_veggies 9y agoI don't fully grok the math behind convolutions yet, but the symmetry of the numbers in the matrices is beautiful.
- mlevental 9y agodiscrete convolution is just dot product. in 2d it's elementwise matrix multiplication. https://i.stack.imgur.com/YDusp.png https://i.stack.imgur.com/YDusp.png don't worry about continuous convolutions
- eat_veggies 9y agoThat's simpler than I thought. Thank you for the wonderful diagram!
- llamaz 9y agoit's not that simple. Have a look at my reply to the parent.
- llamaz 9y agoDiscrete convolution definitely isn't the dot product. Given an n-tuple a and an m-tuple b, form a polynomial p_1 from the coefficients of a and a polynomial p_2 from the coefficients of p_2. The the convolution of a and b is the coefficients of a * b. e.g. a= [1,2,3] and b=[4,5,6]. p_1 = 1 + 2x + 3x^2 + ... p_2 = 4 + 5x + 6x^2 + ... p_1 * p_2 = 4 + 13x + 28x^2 + ... Hence the convolution of a and b is [4, 13, 28, ...]. Here's the full answer: octave:1> conv([1,2,3], [4,5,6]) ans = 4 13 28 27 18 The intuition behind convolution to me for an image is uniform blurring. If you have a square shaped eraser, and you use it to blur a pencil sketch, the sketch will appear blocky and square shaped. Or perhaps a better analogy is painting: your wall will appear different depending on whether you use a paintbrush or a roller.
- mlevental 9y agowhy in the world are you presenting convolution of polynomials? i was being glib true but the crux of convolution (what's important for someone who expresses that they don't understand the mathematics) is elementwise multiplication i.e. dot product. yes you take a filter and sweep it across your input (or vice-versa depending on whether you're really talking about convolution or correlation) and that's important but in my opinion what's more important (obviously since that's what /i/ expressed) is elementwise multiplication. once you understand that (the elementwise multiplication) sweeping and padding and etc are simple to understand. >The intuition behind convolution to me for an image is uniform blurring. If you have a square shaped eraser, and you use it to blur a pencil sketch, the sketch will appear blocky and square shaped. Or perhaps a better analogy is painting: your wall will appear different depending on whether you use a paintbrush or a roller. this is a very bad example since you can easily convolve with filters that sharpen (e.g. literally any gaussian kernel). so you're really not illustrating convolution but instead convolution with an averaging filter (or something like that). in general you shouldn't jump to criticize someone's explanation to a student unless you are prepared to give a much better and (this is important) pedagogically sound explanation because 1 you look foolish 2 you sabotage the student's understanding.
- llamaz 9y agoI don't care about the "student", I'm telling /you/ what convolution is. It's not the dot product. "yes you take a filter and sweep it across your input..." Sweeping across your input is the heart and soul of convolution. I've taken courses in image processing, control theory, probability theory, and digital signal processing - and in all these contexts, convolution is always sweeping across in a very specific way. If you change a single minus sign, you get cross correlation which is completely different. I don't appreciate the rude tone you're taking so I will not be replying further. I didn't take that tone when replying to your initial message.
- mlevental 9y ago> don't care about the "student", I'm telling /you/ what convolution is. It's not the dot product. Then don't comment on expositions given to students. >Sweeping across your input is the heart and soul of convolution. But that's like just your opinion man. The definition is what the definition is and a component of it is the translation of the filter and a component of it is the weighted sum. It's up to each individual to decide what's the most significant component and each individual is free to adjust their focus according to the problem at hand. In this instant I chose to focus on the sum for the sake of pedagogy. >If you change a single minus sign, you get cross correlation which is completely different. No in fact you get literally the same function just flipped about t=0. I would not call that completely different. > I didn't take that tone when replying to your initial message. Read your response again and reflect some more because absolutely your initial message was antagonistic
- alexcnwy 9y agoI think about it as a 2-D weighted average. Not certain that's the correct intuition but it makes sense to me haha.
- rootlocus 9y agoThat's precisely correct.
- LolWolf 9y agoThe symmetry is mostly an effect of 'natural' images not favoring a specific axis (i.e., vertical vs horizontal lines are still distinguished as the same 'type' of lines, in some sense). Another way of seeing why the symmetry emerges is that mirroring the image over an axis shouldn't change the edges you observe (this is the case for the edge detection). So, mirroring the underlying image shouldn't change the operation we wish to apply to detect edges.