Hacker News new | ask | show | jobs
by salehenrahman 3609 days ago
There is a well-understood math behind it.

For blur, you can either do two things:

- generate a matrix such that each element in the matrix is equal to 1 (e.g. averaging)

- generate a matrix such that it represents the Gaussian distribution (you can use a 2D Gauss function)

For edge detection, you essentially have "derivative", e.g. rate of change; the more abrupt the change, the brighter the resulting pixel, hence why edges are highlighted. A good convolution kernel for edge detection would be the Laplacian.

For sharpness, it's pretty much the Laplacian Kernel + identity kernel.

1 comments

I never realized sharpness was identity + Laplacian, but that absolutely makes sense. Thanks!