0
\$\begingroup\$

What is the difference between kernel and filter? (Not for CNN, in general)

\$\endgroup\$
6
  • \$\begingroup\$ Kernel is the matrix a digital filter is using to calculate the result (the matrix which is convolved with the source data). \$\endgroup\$
    – Eugene Sh.
    Oct 30, 2019 at 15:38
  • \$\begingroup\$ What I understand is filter is a more general terms including kernel, because filter can be a matrix, too. Is it correct? \$\endgroup\$
    – henry
    Oct 30, 2019 at 15:45
  • 2
    \$\begingroup\$ Filter is a thing that is working by applying the kernel. The difference is as between a painter and a paint. Painter is not more general than paint. It's just a different thing. \$\endgroup\$
    – Eugene Sh.
    Oct 30, 2019 at 15:47
  • \$\begingroup\$ For image processing: A filter would be the result of using a kernel (or masking). CNN's use, surprise surprise, convolution but that's an entirely different algorithm since there are weights and activation functions, etc. \$\endgroup\$
    – user103380
    Oct 30, 2019 at 16:15
  • \$\begingroup\$ A filter is more of a general transfer function or model concept, while a kernel has a specific and unique realization (ex. gaussian kernel, Laplacian, etc.). Kernels are different models to realize filters, but not the other way around. \$\endgroup\$
    – pat
    Sep 11, 2021 at 20:29

1 Answer 1

0
\$\begingroup\$

A kernel is the 2 dimensional matrix for 2d convolution (or 1d also), A kernel defines the size of the convolution. A filter is the values stored in the kernel matrix. A kernel matrix doesn't have to be a filter, for example if you had a kernel with

\begin{bmatrix}0&0&0\\0&1&0\\0&0&0\end{bmatrix}

the kernal above wouldn't filter anything, but leave you with what you started after convolution.

You can also make edge detectors, like the one below \begin{bmatrix}1&0&-1\\1&0&-1\\1&0&-1\end{bmatrix}

\$\endgroup\$
8
  • \$\begingroup\$ A filter is the values stored in the kernel matrix - this doesn't sound right. \$\endgroup\$
    – Eugene Sh.
    Oct 30, 2019 at 16:18
  • \$\begingroup\$ You don't have to build a filter with a kernel matrix, \$\endgroup\$
    – Voltage Spike
    Oct 30, 2019 at 16:22
  • \$\begingroup\$ The kernel is the thing that stores the values for convolution. \$\endgroup\$
    – Voltage Spike
    Oct 30, 2019 at 16:23
  • \$\begingroup\$ You don't, but it doesn't make filter to be the values of the matrix. Kernel is a property of a filter, not vice versa \$\endgroup\$
    – Eugene Sh.
    Oct 30, 2019 at 16:24
  • \$\begingroup\$ In image processing, a kernel, convolution matrix, or mask is a small matrix. -wikipedia \$\endgroup\$
    – Voltage Spike
    Oct 30, 2019 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.