Image Processing Reference
In-Depth Information
for increasing template, or window, size. The coefficients of smoothing within the Sobel
operator, Figure
4.10
, are those for a window size of 3. In Mathcad, by specifying the size
of the smoothing window as
winsize
, then the template coefficients
smooth
x_win
can
be calculated at each window point
x_win
according to Code
4.3
.
1
0
-1
1
2
1
2
0
-2
0
0
0
-1
-2
-1
1
0
-1
(a) Mx
(b) My
Figure 4.10
Templates for Sobel operator
(winsize-1)!
(winsize-1-x_win)! x_win!
smooth
:=
x_win
Code 4.3
Smoothing function
The differencing coefficients are given by Pascal's triangle for subtraction:
Window size
2
1
-1
3
1
0
-1
4
1
1
-1
-1
5
1
2
0
-2
-1
This can be implemented by subtracting the templates derived from two adjacent expansions
for a smaller window size. Accordingly, we require an operator which can provide the
coefficients of Pascal's triangle for arguments which are a window size
n
and a position
k
.
The operator is the
Pascal(k,n)
operator in Code
4.4
.
n!
(n-k)!k!
if (k 0)(k n)
Pascal (k,n:=
0
otherwise
Code 4.4
Pascal's triangle
The differencing template,
diff
x_win
, is then given by the difference between two
Pascal expansions, as given in Code
4.5
.
These give the coefficients of optimal differencing and optimal smoothing. This
general
form of the Sobel operator combines optimal smoothing along one axis, with optimal
differencing along the other. This general form of the Sobel operator is then given in Code