Lastly, local adaptive thresholding is applied to the directionally filtered image,
which produces the final enhanced binary image. This involves calculating
the average of the grey-level values within an image window at each pixel, and if
the average is greater than the threshold, then the pixel value is set to a binary
value of one; otherwise, it is set to zero. The grey-level image is converted to a
binary image, as there are only two levels of interest, the foreground ridges and
the background valleys