1
$\begingroup$

What does convolving an image with the filter [1 -2 1] do? I see that it's a form of edge detection but it's also very similar to the results I get when convolving with the derivative kernel [1 -1] so I don't really see the difference between them

$\endgroup$

2 Answers 2

4
$\begingroup$

Both are high pass filters. Filtering with [1 -2 1] is the same as filtering with [1 -1] twice. So the longer kernel is a steeper high pass filter and emphasize the edges more.

$\endgroup$
1
  • $\begingroup$ As mentioned by @Cris below, it's not general highpass filter, but is a discrete-time differentiator (first derivative or slope) and two differentiators (second derivative or curvature). $\endgroup$ Oct 1, 2022 at 21:45
6
$\begingroup$

Convolution with the [1 -1] kernel (A) is a derivative filter, which computes the finite difference approximation to the first derivative.

The [1 -2 1] kernel (B) is the result of convolving kernel A with itself. Thus, convolving an image with kernel A twice is the same as convolving with kernel B once. This means that convolution with kernel B is a second derivative filter, and computes the finite difference approximation to the second derivative.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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