Defining the costs
p
q
c
c
can be computed using a cross-correlation filter
assume it is centered at
p
Also typically scale
c
by its length
set
c
= (max-|filter response|) * length(
c
)
where max = maximum |filter response| over all pixels in the image