Sobel filter kernel of large size

后端 未结 9 788
渐次进展
渐次进展 2020-12-02 08:38

I am using a sobel filter of size 3x3 to calculate the image derivative. Looking at some articles on the internet, it seems that kernels for sobel filter for size 5x5 and 7x

9条回答
  •  爱一瞬间的悲伤
    2020-12-02 09:21

    UPDATE 23-Apr-2018: it seems that the kernels defined in the link below are not true Sobel kernels (for 5x5 and above) - they may do a reasonable job of edge detection, but they should not be called Sobel kernels. See Daniel’s answer for a more accurate and comprehensive summary. (I will leave this answer here as (a) it is linked to from various places and (b) accepted answers can not easily be deleted.)

    Google seems to turn up plenty of results, e.g. http://rsbweb.nih.gov/nih-image/download/user-macros/slowsobel.macro suggests the following kernels for 3x3, 5x5, 7x7 and 9x9:

    3x3:

    1   0   -1
    2   0   -2
    1   0   -1
    

    5x5:

    2   1   0   -1  -2
    3   2   0   -2  -3
    4   3   0   -3  -4
    3   2   0   -2  -3
    2   1   0   -1  -2
    

    7x7:

    3   2   1   0   -1  -2  -3
    4   3   2   0   -2  -3  -4
    5   4   3   0   -3  -4  -5
    6   5   4   0   -4  -5  -6
    5   4   3   0   -3  -4  -5
    4   3   2   0   -2  -3  -4
    3   2   1   0   -1  -2  -3
    

    9x9:

    4   3   2   1   0   -1  -2  -3  -4
    5   4   3   2   0   -2  -3  -4  -5
    6   5   4   3   0   -3  -4  -5  -6
    7   6   5   4   0   -4  -5  -6  -7
    8   7   6   5   0   -5  -6  -7  -8
    7   6   5   4   0   -4  -5  -6  -7
    6   5   4   3   0   -3  -4  -5  -6
    5   4   3   2   0   -2  -3  -4  -5
    4   3   2   1   0   -1  -2  -3  -4
    

提交回复
热议问题