Thresholds an image using a moving rectangular window.
Usage
thresh(x, w=5, h=5, offset=0.01)
Arguments
x
An Image object or an array.
w, h
Width and height of the moving rectangular window.
offset
Thresholding offset from the averaged value.
Value
An Image object or an array, containing the transformed version
of x.
Details
This function returns the binary image resulting from the comparison
between an image and its filtered version with a rectangular window.
It is equivalent of doing {f = matrix(1, nc=2*w+1, nr=2*h+1) ; f=f/sum(f) ; x>(filter2(x, f)+offset)}
but slightly faster. The function filter2 provides hence more
flexibility than thresh.