In image filtering and computer simulations, derivatives can be applied to a image by performing a convolution of the image/data with an appropriate kernel matrix. For example, in 1D this could be

$ k = [-1,0,1]/2 $

This form makes sense for discrete, evenly spaced data. How would you express this in a general way?

I'm thinking of something of the form:

$\frac{df}{dx} = f * k$

$ k = ?$

Does this make sense?

  • 1
    $\begingroup$ That should be k=[1,0,-1]/2. $\endgroup$ – Cris Luengo Dec 16 '18 at 16:09
  • $\begingroup$ @CrisLuengo, yes you are right. $\endgroup$ – user668074 Dec 17 '18 at 5:50

To answer your question directly: No there is no such function There is not even a function k such that $f = f*k$.

BUT: If one is not very mathematically precise, and one is familiar with the Dirac-„Function“ one could say „$f = f*\delta_0$“. Then one could look at one of the differential quatients (vor example the symmetric one, since you already mentioned [-1,0,1]) which would then look like this $k:=\lim_{h\rightarrow 0} \frac{\delta_{h}-\delta_{-h}}{2*h}$ And use this as a kind of pseudo definition for such a „function“

If you then assume, that limit exists, and you can pull out the limit from the integral you get $f*k(x)=f*(\lim_{h\rightarrow 0} \frac{\delta_{h}-\delta_{-h}}{2h})(x) = \lim_{h\rightarrow 0} \frac{1}{2h}(f*\delta_{h}-f*\delta_{-h})(x) =\lim_{h\rightarrow 0} \frac{1}{2h}(f(x+h)-f(x-h)) = f‘(x)$

If you are interested in the real workings behind that, you would have to learn something about (tempered) Distributions.


I guess this answer is “not very precise”. I also use “image” and “function” interchangeably.

In the continuous domain,

$$\frac{\partial}{\partial x} f = \frac{\partial}{\partial x} (f * \delta_0) = f * \frac{\partial}{\partial x} \delta_0\;,$$

easily provable using Fourier analysis.

In the discrete domain, this kernel can be approximated by [1,0,-1]/2 or [1,-1], or in many other ways (e.g. using different samplings of the derivative of the sinc function). With a non-regular grid this becomes more complicated to approximate.

One very good approach to estimating derivatives in images uses Gaussian regularization (images hace noise, regularization helps there; a Gaussian is a good filter because it is perfectly isotropic yet separable). In fact, one can compute the exact derivative of a function smoothed by a Gaussian by convolving with the derivative of a Gaussian,

$$\frac{\partial}{\partial x} (f*g) = f * \frac{\partial}{\partial x} g\;,$$

which can be sampled with very little loss.

For irregular sampling, this regularization helps too: normalized convolution [1] allows to apply a Gaussian smoothing to a function with missing or uncertain samples, as well as an irregularly sampled function.

The normalized differential convolution is as follows, with $m$ an indicator function that is 1 where there is a sample in $f$, and $g$ the Gaussian kernel.

$$\frac{\partial}{\partial x} \frac{(f \, m) \ast g}{m \ast g} = \frac{(f \, m) \ast \frac{\partial}{\partial x} g}{m \ast g} - \frac{(f \, m) \ast g}{m \ast g} \frac{m \ast \frac{\partial}{\partial x} g}{m \ast g} \;. $$

[1] H. Knutsson and C. F. Westin, "Normalized and differential convolution," Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, New York, NY, 1993, pp. 515-523.


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.