is to do invariant filtering within each patch.
Typically, we apply a filter, say , in each patch.
The composite operator, filtering in patches,
,is given by
![]() |
(2) |
rabdomain
Figure 4 Domain of inputs and outputs of a two-dimensional prediction-error filter. | ![]() |
rabtent
Figure 5 Placement of tent-like weighting function in the space of filter inputs and outputs. | ![]() |
We need a weighting function that vanishes where the filter
has no outputs.
The amplitude of the weighting function is not very important
because we have learned how to put signals back together
properly for arbitrary weighting functions.
We can use any pyramidal or tent-like shape
that drops to zero outside the domain of the filter output.
The job is done by subroutine tent2().
When you are studying these diagrams and comparing
Figure 4 to internal filtering
with subroutine icaf2() ,
it helps to remember that when the filter index b1
equals lag1,
then the output 1-axis pointer y1
matches the input pointer x1 (and likewise for the 2-axis).
# triangle tent weights for 2-D convolution
#
subroutine tent2( a1,a2, lag1,lag2, windwt, w1,w2)
integer a1,a2, lag1,lag2, w1,w2
real windwt( w1,w2)
integer i1,i2, s1,s2, e1,e2
real mid1,mid2, wide1,wide2, x,y
call null( windwt, w1*w2)
s1= 1+a1-lag1; e1= w1-lag1+1; mid1=(e1+s1)/2.; wide1=(e1-s1+1.)/2.
s2= 1+a2-lag2; e2= w2-lag2+1; mid2=(e2+s2)/2.; wide2=(e2-s2+1.)/2.
#
do i2= s2, e2 { y = abs((i2-mid2)/wide2)
do i1= s1, e1 { x = abs((i1-mid1)/wide1)
# Cheop windwt(i1,i2) = amax1( 0., 2. - abs(x+y) - abs(x-y) )
windwt(i1,i2) = amax1( 0., 1. - abs(x)) * amax1( 0., 1. - abs(y))
}}
return; end
In applications where triangle weights are needed on the inputs (or where we can work on a patch without having interference with edges), we can get ``triangle tent'' weights from tent2() if we set filter dimensions and lags to unity, as shown in Figure 6.
windwt
Figure 6 Window weights from tent2() with w1=61, w2=19 a1=1, a2=1, lag1=1, lag2=1 . | ![]() |
Triangle weighting functions
can sum to a constant
if the spacing is such that the midpoint of one triangle
is at the beginning of the next.
I imagined in two dimensions that something similar would happen
with shapes like Egyptian pyramids of Cheops, 2-|x-y|+|x+y|.
Instead,
the equation (1-|x|)(1-|y|)
which has the tent-like shape shown
in Figure 6
adds up to the constant flat top shown in Figure 7.
(To add interest to Figure 7,
I separated the windows by a little more than the precise matching distance.)
In practice we may chose window shapes and overlaps for
reasons other than the constancy of the sum of weights,
because mkwallwt2() accounts for that.
wallwt
Figure 7 (Inverse) wall weights with n1=100, w1=61, k1=2, n2=30, w2=19, k2=2 | ![]() |
Finally is an example of filtering a plane of uniform constants with an impulse function. The impulse function is surrounded by zeros, so the filter output patches are smaller than the input patches back in Figure 3. Here in Figure 8, both axes need more window density.
cinloip
Figure 8 Filtering in patches with the same parameters as in Figures 2 and 3. Additionally, the filter parameters are a1=11 a2=5 lag1=6 lag2=1 . Thus, windows are centered on the 1-axis and pushed back out the 2-axis. | ![]() |