getGaborKernel
is a convenience function to create Gabor
kernels that can be used to filter images with filter2D
.
Usage
getGaborKernel(
width = 31,
height = 31,
sigma = 5,
theta = pi,
lambda = 31,
gamma = 5,
psi = 0
)
Arguments
- width
The width in pixels of the kernel (default: 31).
- height
The height in pixels of the kernel (default: 31).
- sigma
The standard deviation of the Gaussian envelope (default: 5).
- theta
The orientation of the normal to the parallel stripes of a Gabor function (default:
pi
).- lambda
The wavelength of the sinusoidal factor (default: 31).
- gamma
The spatial aspect ratio (default: 5).
- psi
A phase offset (default: 0).
Note
For more details about Gabor filter equations and parameters, see: Gabor filter.
Author
Simon Garnier, garnier@njit.edu
Examples
getGaborKernel()
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [2,] -2.802597e-45 -5.605194e-45 -8.407791e-45 -1.121039e-44 -1.541428e-44
#> [3,] -2.215936e-39 -3.795715e-39 -5.968766e-39 -8.539876e-39 -1.091315e-38
#> [4,] -5.946182e-34 -1.018532e-33 -1.601642e-33 -2.291567e-33 -2.928406e-33
#> [5,] -5.869819e-29 -1.005452e-28 -1.581074e-28 -2.262138e-28 -2.890798e-28
#> [6,] -2.131654e-24 -3.651349e-24 -5.741749e-24 -8.215068e-24 -1.049808e-23
#> [7,] -2.847832e-20 -4.878102e-20 -7.670819e-20 -1.097511e-19 -1.402515e-19
#> [8,] -1.399644e-16 -2.397474e-16 -3.770031e-16 -5.394011e-16 -6.893036e-16
#> [9,] -2.530615e-13 -4.334735e-13 -6.816375e-13 -9.752600e-13 -1.246290e-12
#> [10,] -1.683217e-10 -2.883213e-10 -4.533855e-10 -6.486860e-10 -8.289595e-10
#> [11,] -4.118697e-08 -7.054989e-08 -1.109398e-07 -1.587282e-07 -2.028397e-07
#> [12,] -3.707533e-06 -6.350699e-06 -9.986480e-06 -1.428826e-05 -1.825905e-05
#> [13,] -1.227766e-04 -2.103063e-04 -3.307068e-04 -4.731622e-04 -6.046566e-04
#> [14,] -1.495725e-03 -2.562055e-03 -4.028833e-03 -5.764296e-03 -7.366226e-03
#> [15,] -6.703377e-03 -1.148233e-02 -1.805598e-02 -2.583378e-02 -3.301313e-02
#> [16,] -1.105200e-02 -1.893117e-02 -2.976928e-02 -4.259271e-02 -5.442945e-02
#> [17,] -6.703377e-03 -1.148233e-02 -1.805598e-02 -2.583378e-02 -3.301313e-02
#> [18,] -1.495725e-03 -2.562055e-03 -4.028833e-03 -5.764296e-03 -7.366226e-03
#> [19,] -1.227766e-04 -2.103063e-04 -3.307068e-04 -4.731622e-04 -6.046566e-04
#> [20,] -3.707533e-06 -6.350699e-06 -9.986480e-06 -1.428826e-05 -1.825905e-05
#> [21,] -4.118697e-08 -7.054989e-08 -1.109398e-07 -1.587282e-07 -2.028397e-07
#> [22,] -1.683217e-10 -2.883213e-10 -4.533855e-10 -6.486860e-10 -8.289595e-10
#> [23,] -2.530615e-13 -4.334735e-13 -6.816375e-13 -9.752600e-13 -1.246290e-12
#> [24,] -1.399644e-16 -2.397474e-16 -3.770031e-16 -5.394011e-16 -6.893036e-16
#> [25,] -2.847832e-20 -4.878102e-20 -7.670819e-20 -1.097511e-19 -1.402515e-19
#> [26,] -2.131654e-24 -3.651349e-24 -5.741749e-24 -8.215068e-24 -1.049808e-23
#> [27,] -5.869819e-29 -1.005452e-28 -1.581074e-28 -2.262138e-28 -2.890798e-28
#> [28,] -5.946182e-34 -1.018532e-33 -1.601642e-33 -2.291567e-33 -2.928406e-33
#> [29,] -2.215936e-39 -3.795715e-39 -5.968766e-39 -8.539876e-39 -1.091315e-38
#> [30,] -2.802597e-45 -5.605194e-45 -8.407791e-45 -1.121039e-44 -1.541428e-44
#> [31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [,6] [,7] [,8] [,9] [,10]
#> [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [2,] -1.681558e-44 -1.401298e-44 -4.203895e-45 1.541428e-44 4.624285e-44
#> [3,] -1.195003e-38 -9.945608e-39 -2.823525e-39 1.139497e-38 3.389500e-38
#> [4,] -3.206638e-33 -2.668777e-33 -7.576571e-34 3.057696e-33 9.095291e-33
#> [5,] -3.165457e-28 -2.634504e-28 -7.479270e-29 3.018428e-28 8.978487e-28
#> [6,] -1.149552e-23 -9.567334e-24 -2.716135e-24 1.096157e-23 3.260583e-23
#> [7,] -1.535770e-19 -1.278170e-19 -3.628682e-20 1.464436e-19 4.356049e-19
#> [8,] -7.547952e-16 -6.281909e-16 -1.783413e-16 7.197365e-16 2.140898e-15
#> [9,] -1.364702e-12 -1.135796e-12 -3.224487e-13 1.301314e-12 3.870834e-12
#> [10,] -9.077200e-10 -7.554650e-10 -2.144740e-10 8.655582e-10 2.574653e-09
#> [11,] -2.221118e-07 -1.848562e-07 -5.248006e-08 2.117951e-07 6.299967e-07
#> [12,] -1.999386e-05 -1.664022e-05 -4.724105e-06 1.906519e-05 5.671050e-05
#> [13,] -6.621059e-04 -5.510485e-04 -1.564409e-04 6.313523e-04 1.877994e-03
#> [14,] -8.066100e-03 -6.713146e-03 -1.905840e-03 7.691446e-03 2.287865e-02
#> [15,] -3.614976e-02 -3.008623e-02 -8.541382e-03 3.447067e-02 1.025350e-01
#> [16,] -5.960087e-02 -4.960381e-02 -1.408236e-02 5.683253e-02 1.690516e-01
#> [17,] -3.614976e-02 -3.008623e-02 -8.541382e-03 3.447067e-02 1.025350e-01
#> [18,] -8.066100e-03 -6.713146e-03 -1.905840e-03 7.691446e-03 2.287865e-02
#> [19,] -6.621059e-04 -5.510485e-04 -1.564409e-04 6.313523e-04 1.877994e-03
#> [20,] -1.999386e-05 -1.664022e-05 -4.724105e-06 1.906519e-05 5.671050e-05
#> [21,] -2.221118e-07 -1.848562e-07 -5.248006e-08 2.117951e-07 6.299967e-07
#> [22,] -9.077200e-10 -7.554650e-10 -2.144740e-10 8.655582e-10 2.574653e-09
#> [23,] -1.364702e-12 -1.135796e-12 -3.224487e-13 1.301314e-12 3.870834e-12
#> [24,] -7.547952e-16 -6.281909e-16 -1.783413e-16 7.197365e-16 2.140898e-15
#> [25,] -1.535770e-19 -1.278170e-19 -3.628682e-20 1.464436e-19 4.356049e-19
#> [26,] -1.149552e-23 -9.567334e-24 -2.716135e-24 1.096157e-23 3.260583e-23
#> [27,] -3.165457e-28 -2.634504e-28 -7.479270e-29 3.018428e-28 8.978487e-28
#> [28,] -3.206638e-33 -2.668777e-33 -7.576571e-34 3.057696e-33 9.095291e-33
#> [29,] -1.195003e-38 -9.945608e-39 -2.823525e-39 1.139497e-38 3.389500e-38
#> [30,] -1.681558e-44 -1.401298e-44 -4.203895e-45 1.541428e-44 4.624285e-44
#> [31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [,11] [,12] [,13] [,14] [,15]
#> [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [2,] 8.828180e-44 1.373272e-43 1.877740e-43 2.326155e-43 2.634441e-43
#> [3,] 6.432728e-38 1.003091e-37 1.374552e-37 1.700859e-37 1.925077e-37
#> [4,] 1.726141e-32 2.691668e-32 3.688436e-32 4.564039e-32 5.165699e-32
#> [5,] 1.703973e-27 2.657101e-27 3.641068e-27 4.505426e-27 5.099360e-27
#> [6,] 6.188064e-23 9.649394e-23 1.322272e-22 1.636168e-22 1.851858e-22
#> [7,] 8.267084e-19 1.289133e-18 1.766520e-18 2.185876e-18 2.474032e-18
#> [8,] 4.063081e-15 6.335789e-15 8.682036e-15 1.074307e-14 1.215930e-14
#> [9,] 7.346223e-12 1.145538e-11 1.569749e-11 1.942393e-11 2.198452e-11
#> [10,] 4.886278e-09 7.619447e-09 1.044105e-08 1.291967e-08 1.462282e-08
#> [11,] 1.195633e-06 1.864417e-06 2.554842e-06 3.161338e-06 3.578086e-06
#> [12,] 1.076274e-04 1.678295e-04 2.299795e-04 2.845746e-04 3.220891e-04
#> [13,] 3.564131e-03 5.557749e-03 7.615875e-03 9.423818e-03 1.066612e-02
#> [14,] 4.342001e-02 6.770725e-02 9.278036e-02 1.148056e-01 1.299400e-01
#> [15,] 1.945950e-01 3.034428e-01 4.158127e-01 5.145230e-01 5.823507e-01
#> [16,] 3.208329e-01 5.002927e-01 6.855593e-01 8.483050e-01 9.601340e-01
#> [17,] 1.945950e-01 3.034428e-01 4.158127e-01 5.145230e-01 5.823507e-01
#> [18,] 4.342001e-02 6.770725e-02 9.278036e-02 1.148056e-01 1.299400e-01
#> [19,] 3.564131e-03 5.557749e-03 7.615875e-03 9.423818e-03 1.066612e-02
#> [20,] 1.076274e-04 1.678295e-04 2.299795e-04 2.845746e-04 3.220891e-04
#> [21,] 1.195633e-06 1.864417e-06 2.554842e-06 3.161338e-06 3.578086e-06
#> [22,] 4.886278e-09 7.619447e-09 1.044105e-08 1.291967e-08 1.462282e-08
#> [23,] 7.346223e-12 1.145538e-11 1.569749e-11 1.942393e-11 2.198452e-11
#> [24,] 4.063081e-15 6.335789e-15 8.682036e-15 1.074307e-14 1.215930e-14
#> [25,] 8.267084e-19 1.289133e-18 1.766520e-18 2.185876e-18 2.474032e-18
#> [26,] 6.188064e-23 9.649394e-23 1.322272e-22 1.636168e-22 1.851858e-22
#> [27,] 1.703973e-27 2.657101e-27 3.641068e-27 4.505426e-27 5.099360e-27
#> [28,] 1.726141e-32 2.691668e-32 3.688436e-32 4.564039e-32 5.165699e-32
#> [29,] 6.432728e-38 1.003091e-37 1.374552e-37 1.700859e-37 1.925077e-37
#> [30,] 8.828180e-44 1.373272e-43 1.877740e-43 2.326155e-43 2.634441e-43
#> [31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [,16] [,17] [,18] [,19] [,20]
#> [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [2,] 2.746545e-43 2.634441e-43 2.326155e-43 1.877740e-43 1.373272e-43
#> [3,] 2.005009e-37 1.925077e-37 1.700859e-37 1.374552e-37 1.003091e-37
#> [4,] 5.380186e-32 5.165699e-32 4.564039e-32 3.688436e-32 2.691668e-32
#> [5,] 5.311092e-27 5.099360e-27 4.505426e-27 3.641068e-27 2.657101e-27
#> [6,] 1.928750e-22 1.851858e-22 1.636168e-22 1.322272e-22 9.649394e-23
#> [7,] 2.576757e-18 2.474032e-18 2.185876e-18 1.766520e-18 1.289133e-18
#> [8,] 1.266417e-14 1.215930e-14 1.074307e-14 8.682036e-15 6.335789e-15
#> [9,] 2.289735e-11 2.198452e-11 1.942393e-11 1.569749e-11 1.145538e-11
#> [10,] 1.522998e-08 1.462282e-08 1.291967e-08 1.044105e-08 7.619447e-09
#> [11,] 3.726653e-06 3.578086e-06 3.161338e-06 2.554842e-06 1.864417e-06
#> [12,] 3.354626e-04 3.220891e-04 2.845746e-04 2.299795e-04 1.678295e-04
#> [13,] 1.110900e-02 1.066612e-02 9.423818e-03 7.615875e-03 5.557749e-03
#> [14,] 1.353353e-01 1.299400e-01 1.148056e-01 9.278036e-02 6.770725e-02
#> [15,] 6.065307e-01 5.823507e-01 5.145230e-01 4.158127e-01 3.034428e-01
#> [16,] 1.000000e+00 9.601340e-01 8.483050e-01 6.855593e-01 5.002927e-01
#> [17,] 6.065307e-01 5.823507e-01 5.145230e-01 4.158127e-01 3.034428e-01
#> [18,] 1.353353e-01 1.299400e-01 1.148056e-01 9.278036e-02 6.770725e-02
#> [19,] 1.110900e-02 1.066612e-02 9.423818e-03 7.615875e-03 5.557749e-03
#> [20,] 3.354626e-04 3.220891e-04 2.845746e-04 2.299795e-04 1.678295e-04
#> [21,] 3.726653e-06 3.578086e-06 3.161338e-06 2.554842e-06 1.864417e-06
#> [22,] 1.522998e-08 1.462282e-08 1.291967e-08 1.044105e-08 7.619447e-09
#> [23,] 2.289735e-11 2.198452e-11 1.942393e-11 1.569749e-11 1.145538e-11
#> [24,] 1.266417e-14 1.215930e-14 1.074307e-14 8.682036e-15 6.335789e-15
#> [25,] 2.576757e-18 2.474032e-18 2.185876e-18 1.766520e-18 1.289133e-18
#> [26,] 1.928750e-22 1.851858e-22 1.636168e-22 1.322272e-22 9.649394e-23
#> [27,] 5.311092e-27 5.099360e-27 4.505426e-27 3.641068e-27 2.657101e-27
#> [28,] 5.380186e-32 5.165699e-32 4.564039e-32 3.688436e-32 2.691668e-32
#> [29,] 2.005009e-37 1.925077e-37 1.700859e-37 1.374552e-37 1.003091e-37
#> [30,] 2.746545e-43 2.634441e-43 2.326155e-43 1.877740e-43 1.373272e-43
#> [31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [,21] [,22] [,23] [,24] [,25]
#> [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [2,] 8.828180e-44 4.624285e-44 1.541428e-44 -4.203895e-45 -1.401298e-44
#> [3,] 6.432728e-38 3.389500e-38 1.139497e-38 -2.823525e-39 -9.945608e-39
#> [4,] 1.726141e-32 9.095291e-33 3.057696e-33 -7.576571e-34 -2.668777e-33
#> [5,] 1.703973e-27 8.978487e-28 3.018428e-28 -7.479270e-29 -2.634504e-28
#> [6,] 6.188064e-23 3.260583e-23 1.096157e-23 -2.716135e-24 -9.567334e-24
#> [7,] 8.267084e-19 4.356049e-19 1.464436e-19 -3.628682e-20 -1.278170e-19
#> [8,] 4.063081e-15 2.140898e-15 7.197365e-16 -1.783413e-16 -6.281909e-16
#> [9,] 7.346223e-12 3.870834e-12 1.301314e-12 -3.224487e-13 -1.135796e-12
#> [10,] 4.886278e-09 2.574653e-09 8.655582e-10 -2.144740e-10 -7.554650e-10
#> [11,] 1.195633e-06 6.299967e-07 2.117951e-07 -5.248006e-08 -1.848562e-07
#> [12,] 1.076274e-04 5.671050e-05 1.906519e-05 -4.724105e-06 -1.664022e-05
#> [13,] 3.564131e-03 1.877994e-03 6.313523e-04 -1.564409e-04 -5.510485e-04
#> [14,] 4.342001e-02 2.287865e-02 7.691446e-03 -1.905840e-03 -6.713146e-03
#> [15,] 1.945950e-01 1.025350e-01 3.447067e-02 -8.541382e-03 -3.008623e-02
#> [16,] 3.208329e-01 1.690516e-01 5.683253e-02 -1.408236e-02 -4.960381e-02
#> [17,] 1.945950e-01 1.025350e-01 3.447067e-02 -8.541382e-03 -3.008623e-02
#> [18,] 4.342001e-02 2.287865e-02 7.691446e-03 -1.905840e-03 -6.713146e-03
#> [19,] 3.564131e-03 1.877994e-03 6.313523e-04 -1.564409e-04 -5.510485e-04
#> [20,] 1.076274e-04 5.671050e-05 1.906519e-05 -4.724105e-06 -1.664022e-05
#> [21,] 1.195633e-06 6.299967e-07 2.117951e-07 -5.248006e-08 -1.848562e-07
#> [22,] 4.886278e-09 2.574653e-09 8.655582e-10 -2.144740e-10 -7.554650e-10
#> [23,] 7.346223e-12 3.870834e-12 1.301314e-12 -3.224487e-13 -1.135796e-12
#> [24,] 4.063081e-15 2.140898e-15 7.197365e-16 -1.783413e-16 -6.281909e-16
#> [25,] 8.267084e-19 4.356049e-19 1.464436e-19 -3.628682e-20 -1.278170e-19
#> [26,] 6.188064e-23 3.260583e-23 1.096157e-23 -2.716135e-24 -9.567334e-24
#> [27,] 1.703973e-27 8.978487e-28 3.018428e-28 -7.479270e-29 -2.634504e-28
#> [28,] 1.726141e-32 9.095291e-33 3.057696e-33 -7.576571e-34 -2.668777e-33
#> [29,] 6.432728e-38 3.389500e-38 1.139497e-38 -2.823525e-39 -9.945608e-39
#> [30,] 8.828180e-44 4.624285e-44 1.541428e-44 -4.203895e-45 -1.401298e-44
#> [31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [,26] [,27] [,28] [,29] [,30]
#> [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [2,] -1.681558e-44 -1.541428e-44 -1.121039e-44 -8.407791e-45 -5.605194e-45
#> [3,] -1.195003e-38 -1.091315e-38 -8.539876e-39 -5.968766e-39 -3.795715e-39
#> [4,] -3.206638e-33 -2.928406e-33 -2.291567e-33 -1.601642e-33 -1.018532e-33
#> [5,] -3.165457e-28 -2.890798e-28 -2.262138e-28 -1.581074e-28 -1.005452e-28
#> [6,] -1.149552e-23 -1.049808e-23 -8.215068e-24 -5.741749e-24 -3.651349e-24
#> [7,] -1.535770e-19 -1.402515e-19 -1.097511e-19 -7.670819e-20 -4.878102e-20
#> [8,] -7.547952e-16 -6.893036e-16 -5.394011e-16 -3.770031e-16 -2.397474e-16
#> [9,] -1.364702e-12 -1.246290e-12 -9.752600e-13 -6.816375e-13 -4.334735e-13
#> [10,] -9.077200e-10 -8.289595e-10 -6.486860e-10 -4.533855e-10 -2.883213e-10
#> [11,] -2.221118e-07 -2.028397e-07 -1.587282e-07 -1.109398e-07 -7.054989e-08
#> [12,] -1.999386e-05 -1.825905e-05 -1.428826e-05 -9.986480e-06 -6.350699e-06
#> [13,] -6.621059e-04 -6.046566e-04 -4.731622e-04 -3.307068e-04 -2.103063e-04
#> [14,] -8.066100e-03 -7.366226e-03 -5.764296e-03 -4.028833e-03 -2.562055e-03
#> [15,] -3.614976e-02 -3.301313e-02 -2.583378e-02 -1.805598e-02 -1.148233e-02
#> [16,] -5.960087e-02 -5.442945e-02 -4.259271e-02 -2.976928e-02 -1.893117e-02
#> [17,] -3.614976e-02 -3.301313e-02 -2.583378e-02 -1.805598e-02 -1.148233e-02
#> [18,] -8.066100e-03 -7.366226e-03 -5.764296e-03 -4.028833e-03 -2.562055e-03
#> [19,] -6.621059e-04 -6.046566e-04 -4.731622e-04 -3.307068e-04 -2.103063e-04
#> [20,] -1.999386e-05 -1.825905e-05 -1.428826e-05 -9.986480e-06 -6.350699e-06
#> [21,] -2.221118e-07 -2.028397e-07 -1.587282e-07 -1.109398e-07 -7.054989e-08
#> [22,] -9.077200e-10 -8.289595e-10 -6.486860e-10 -4.533855e-10 -2.883213e-10
#> [23,] -1.364702e-12 -1.246290e-12 -9.752600e-13 -6.816375e-13 -4.334735e-13
#> [24,] -7.547952e-16 -6.893036e-16 -5.394011e-16 -3.770031e-16 -2.397474e-16
#> [25,] -1.535770e-19 -1.402515e-19 -1.097511e-19 -7.670819e-20 -4.878102e-20
#> [26,] -1.149552e-23 -1.049808e-23 -8.215068e-24 -5.741749e-24 -3.651349e-24
#> [27,] -3.165457e-28 -2.890798e-28 -2.262138e-28 -1.581074e-28 -1.005452e-28
#> [28,] -3.206638e-33 -2.928406e-33 -2.291567e-33 -1.601642e-33 -1.018532e-33
#> [29,] -1.195003e-38 -1.091315e-38 -8.539876e-39 -5.968766e-39 -3.795715e-39
#> [30,] -1.681558e-44 -1.541428e-44 -1.121039e-44 -8.407791e-45 -5.605194e-45
#> [31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> [,31]
#> [1,] 0.000000e+00
#> [2,] -2.802597e-45
#> [3,] -2.215936e-39
#> [4,] -5.946182e-34
#> [5,] -5.869819e-29
#> [6,] -2.131654e-24
#> [7,] -2.847832e-20
#> [8,] -1.399644e-16
#> [9,] -2.530615e-13
#> [10,] -1.683217e-10
#> [11,] -4.118697e-08
#> [12,] -3.707533e-06
#> [13,] -1.227766e-04
#> [14,] -1.495725e-03
#> [15,] -6.703377e-03
#> [16,] -1.105200e-02
#> [17,] -6.703377e-03
#> [18,] -1.495725e-03
#> [19,] -1.227766e-04
#> [20,] -3.707533e-06
#> [21,] -4.118697e-08
#> [22,] -1.683217e-10
#> [23,] -2.530615e-13
#> [24,] -1.399644e-16
#> [25,] -2.847832e-20
#> [26,] -2.131654e-24
#> [27,] -5.869819e-29
#> [28,] -5.946182e-34
#> [29,] -2.215936e-39
#> [30,] -2.802597e-45
#> [31,] 0.000000e+00