Hacker News new | ask | show | jobs
by yan 3749 days ago
Slightly related, but I had a small epiphany when taking a class on DSP on Coursera. The kernel that is used to blur an image and that which is used to remove the treble/high frequencies from an audio sample are identical, except one is in 2 dimensions and the other is in 1. And this makes perfect sense! A low pass filter removes high frequencies, and sharp edges are high frequencies in the 2D plane.

TFA only mentions Gaussian blur, but a Gaussian blur is just a moving average, with "closer" pixels being valued higher, plus a smooth falloff. When you replace each value with an average of its neighborhood, you "soften" the transitions.

6 comments

One of the remarkable things about the Gaussian function is that its Fourier transform is also a Gaussian. A Gaussian blur means to convolve a function with the Gaussian. Convolution in the frequency (Fourier) domain is multiplication. Since the Gaussian goes to zero rapidly as you move away from zero, high-frequency components get attenuated whereas low-frequency stuff are preserved.
A pretty interesting point made here last year is that picking x, y, z coordinates from three orthogonal gaussian distributions results in a spherically symmetrical distribution. https://news.ycombinator.com/item?id=9446126
Yes, this is the separability property of the Gaussian. It makes it easy to compute Gaussian blur as compared to, say, the circular pillbox filter (lens blur or bokeh simulation) because you can just convolve it different times separately in each dimension. So, blurring an n by n image with a Gaussian of size h would only take O(n^2 h) instead of O(n^2 h^2). When h is large compared to log n, you can use the property I mentioned in my previous comment and do the Fast Fourier transform on the columns and rows of the image to improve time complexity to O(n^2 log n). It doesn't have to be a symmetrical distribution either; but in the general case with a multivariate Gaussian with some d-dimensional covariance matrix S, you'd have to rotate the data to align with the eigenvectors of S, which is lossy.

The rectangular pillbox filter also has the separable property. So does the parallelogram pillbox filter (albeit also rotated), which, by extension, allows us to do blurring by a hexagon (sum of three parallelograms) which can be used to simulate cool-looking bokeh [1].

[1] McIntosh, L., Bernhard E. Riecke, and Steve DiPaola. "Efficiently Simulating the Bokeh of Polygonal Apertures in a Post‐Process Depth of Field Shader." Computer Graphics Forum. Vol. 31. No. 6. Blackwell Publishing Ltd, 2012. http://ivizlab.sfu.ca/media/DiPaolaMcIntoshRiecke2012.pdf

Gaussian blur is the same equation as of the normal distribution. so basically it's a bell curve in one or two dimensions.
it doesn't actually have to be 1 or 2, it can be generalized for n like many distributions. Depends on the context
When you start to look at things as waves a lot changes.
Could you expand on that?
May I ask which Coursera course that was?
i would presume https://www.coursera.org/course/dsp which was pretty good when I did it - https://www.coursera.org/course/images also covered some similar things
That looks like it, great, thanks.

The reason why I'm asking instead of searching on Coursera is that Coursera has become increasingly hard to search, at least in my view, so it's easier to ask directly.

I have a bunch of audio friends that love to do glitch art by processing images in audio processes.

Something like this: https://questionsomething.wordpress.com/2012/07/26/databendi...

Gaussian blur is a low-pass filter.
*is a kind of/is an example of