# Implementation of Deriche filter

The Canny edge detector is expressed by the derivative of the Gaussian. Its practical implementation involves the Gaussian filter, then the Sobel filter to calculate the gradient in both directions. It's followed by non-max suppression and thresholding with hysteresis.

The Deriche filter on the other hand is described as seperable into two parts that are applied recursively. But how is this implemented practically?

• added a link to the Deriche Edge Detector wikipedia article. Is it correct this is what you refer to when you say "Deriche operator" or "Deriche Filter"? May 30, 2022 at 14:22
• @MarcusMüller Yes it is. Thanks! May 30, 2022 at 14:23
– Peter K.
May 30, 2022 at 16:18
• “Its practical implementation involves the Gaussian filter, then the Sobel filter” — I’ve seen implementations like this. Why do people think it’s practical to use three filters instead of two? Canny suggested using the derivative of Gaussian filter, as it optimizes some characteristics he proposed. It’s more precise than Sobel (even if combined with a Gaussian), and it only requires applying two filters. May 30, 2022 at 17:06
• @PeterK. How efficient is the implementation compared to the Canny operator? May 30, 2022 at 18:58

Let's assume $$\boldsymbol{b}$$ stands for gaussian blur and $$\boldsymbol{s}$$ for Sobel filter.

With $$\boldsymbol{I}$$ being the input image we have the 2 first steps of Canny Edge Detector as:

$$\boldsymbol{s} \ast \left( \boldsymbol{b} \ast \boldsymbol{I} \right)$$

Namely convolution of the image by a Gaussian Blur followed by a Sobel filter which imitates the gradient.

Since Convolution is associative it can be written as:

$$\left( \boldsymbol{s} \ast \boldsymbol{b} \right) \ast \boldsymbol{I}$$

Where $$\boldsymbol{s} \ast \boldsymbol{b}$$ is basically approximation of the derivative of the Gaussian kernel.

The trick in the Deriche Filter is to apply this in a single step and use IIR / Auto Regressive approximation of it.

As you may see in Recursive Implementation of the Gaussian Filter (1D & 2D) one may approximate the Gaussian Blur filter by an IIR filter.
One could also approximate the derivative of the Gaussian in IIR form which is what used in Deriche Filter.