Noise Robust Gradient Operators

This page is about efficient gradient operators which combine isotropic noise suppression and precise partial derivatives estimation. They are targeted for applications where differentiation of discrete 2D surface is required: feature/edge detection in image, coordinate measurement machine data processing, etc.

Gradient operator uses linear combination of neighboring points/pixels to approximate
partial derivatives at any given point of the discrete surface. Set of coefficients is called filter.

There are several widely used filters – Sobel, Prewitt, Roberts. All of them are based on forward or central differences. Although these numerical methods have favorable theoretical properties, they can be inaccurate in the presence of noise as shown on central differences page.

Digital data derived from real world signals contain noise inherently. Which means that reliable and robust gradient operator should poses important property of noise suppression. One more desired property is to process 2D data isotropically, i.e. remove noise along all directions identically.

Frequency domain is valuable tool to research properties of discrete filters. Let’s consider frequency response of popular Sobel and Prewitt filters to investigate their noise suppression capabilities.

Sobel

Sobel3x3
Prewitt

Prewitt3x3

Parameters w_1 and w_2 are angular frequencies along horizontal and vertical directions correspondingly. Lower values of w_1 and w_2 represent smooth regions in data. Higher indicate regions with abrupt changes which most likely corrupted by noise. Surface plot shows how filter processes particular frequencies and their combinations. To be noise robust filter should set to zero high frequencies and tend to 1 near lowest. To be isotropic frequency response’s contour lines should be close to circle with the center at origin.

From these plots we can see that Prewitt filter doesn’t have noise suppression at all. Whereas Sobel has weak noise suppression and it is not isotropic.

I propose 2D differentiating filters which combine isotropic noise suppression and precise gradient estimation in the same time (analogous filters for 1D explained in smooth noise-robust differentiators article). Here are the masks for {{\partial f}/{\partial x}}:

<br />
\displaystyle{\frac{1}{32}}\left[\begin{matrix}<br />
-1&-2&0&2&1\\<br />
-2&-4&0&4&2\\<br />
-1&-2&0&2&1<br />
\end{matrix}\right]<br />

<br />
\displaystyle{\frac{1}{512}}<br />
\left[\begin{array}{ccccccc}<br />
-1&-4&-5&0&5&4&1     \\ \noalign{\medskip}<br />
-4&-16&-20&0&20&16&4 \\ \noalign{\medskip}<br />
-6&-24&-30&0&30&24&6 \\ \noalign{\medskip}<br />
-4&-16&-20&0&20&16&4 \\ \noalign{\medskip}<br />
-1&-4&-5&0&5&4&1<br />
\end{array}\right]<br />

To calculate {{\partial f}/{\partial y}} just rotate mask by 90 degrees. As you can see these filters have efficient computational structure – they fit perfectly for fixed point arithmetic. Frequency responses are plotted below.

5x3

NRIGO5x3
7x5

NRIGO7x5

Disclaimer

You can use materials from this site in any legal activity (research, teaching, engineering, etc.) freely on the basis of respecting my authorship by giving clear statement and reference to my site or particular page on it in your work. Brief description of your project is welcome in the comments below. One point though, if you use my materials in commercial project please consider supporting my site and me by donation.


1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 4.86)
Loading ... Loading ...
Print This Page Print This Page

8 Comments

  1. Audrius
    Posted October 2, 2009 at 4:15 am | Permalink

    Very interesting work. How would you extend this result to 3D?

  2. Alex
    Posted March 4, 2010 at 1:33 am | Permalink

    I don’t know how you derived your masks but it seems they don’t demonstrate good rotation invariantce. According to my experiments, your NRIGO5x3 are worse than the 3×3 Scharr masks.

  3. Dimitriy
    Posted June 6, 2010 at 6:14 pm | Permalink

    omg
    1
    std Sobel is (-1 0 1) * ( 2 )
    1
    1
    and your 5 x 3 is (-1 0 1) * ( 1 2 1 ) * ( 2 )
    1
    so you just did extra smoothing
    and “respecting my authorship” sounds ridiculous

    • Posted June 6, 2010 at 9:33 pm | Permalink

      You have made several obvious mistakes.

      #1
      You cannot get 3×5 matrix from multiplication of 3×3 matrices.

      #2
      You messed up with the order of matrices in you product.
      (multiplication of one row matrix by one column matrix is a number,
      not a matrix).

      Correct factorization of NRIGO5x3 is:

      <br />
\frac{1}{32}<br />
\begin{bmatrix}1 \\ 2 \\ 1 \end{bmatrix}<br />
\begin{bmatrix}-1 & -2 & 0 & 2 & 1\end{bmatrix}<br />

      where [-1 -2 0 2 1] is differentiator with noise suppression.
      So, NRIGO combines smoothing filter and smoothing differentiation in one operation.

      • Dimitriy
        Posted June 7, 2010 at 8:37 pm | Permalink

        oh, i didnt mean multiplication
        i ment a sequence of convolutions
        if u need more accurate notation i can rewrite my post in this way

        convolution with std Sobel kernel
        -1 0 1
        -2 0 2
        -1 0 1
        is equivalent to a sequence of convolutions
        1) with
        -1 0 1
        so we get dervtive w.r.t. x
        2) and then with
        1
        2
        1
        its spational smoothness

        convolution with ur
        -1 -2 0 2 1
        -2 -4 0 4 2
        -1 -2 0 2 1
        is equivalent to a sequence of convolutions
        1) with
        -1 0 1
        so we get dervtive w.r.t. x
        2) then with
        1 2 1
        3) and finally with
        1
        2
        1

        in other words convolution with
        -1 -2 0 2 1
        is equivalent to a sequence of convolutions
        1) with
        -1 0 1
        2) then with
        1 2 1

        SO, ur “NRIGO” just does extra smoothing
        nothing else

  4. Dimitriy
    Posted June 7, 2010 at 8:54 pm | Permalink

    no offense, Pavel
    i dont want to say, that this NRIGO is stupid or useless
    i just mean there is nothing unique

    and a few words about NRIGO’s pros and cons
    if u use it for very smooth regions, it will “combine isotropic noise suppression and precise gradient estimation”
    but for nonsmooth regions, e.g. regions with edges, such smoothing will result in loss of accuracy of gradient estimation

  5. ashraf
    Posted July 13, 2010 at 7:35 am | Permalink

    2D sobel Operator in x and y axis is

    -1 0 1 Horizontal Gradient Operator
    -2 0 2
    -1 0 1

    -1 -2 -1 Vertical Gradient Operator
    0 0 0
    1 2 1
    for the above operator, the equavalent equation is to calculate gradient–
    Gx(i, j)=Images(i+1,j-1)+2*Images(i+1,j)+Images(i+1,j+1)-(Images(i-1,j-1)+2*Images(i-1,j)+Images(i-1,j+1));
    Gy(i, j)=Images(i-1,j+1)+2*Images(i,j+1)+Images(i+1,j+1)-(Images(i-1, j-1)+2*Images(i,j-1)+Images(i+1,j-1));

    But my question is -
    what will be operator and equation for 3D images?

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting