Adaptive Thresholding of Images
Adaptive Thresholding of Images
An adaptive threshold binarizes a grayscale image based on the local character of the image (which you can select from any of the photos in the Wolfram image library).
In this implementation, the adaptive method finds the mean value in each neighborhood. If the pixel value is greater than a threshold multiplied by this mean, the pixel is set to "1" (white), and otherwise is set to "0" (black). This changes a grayscale image to black and white. When applied to the three RGB channels of a color image, the result is a combination of an edge detection and a posterization; regions are outlined in bright colors.
With the infill option, the value of the central pixel is set to "0" (black), or it is left at the original value. This provides a dark halo around the edges of grayscale objects and sets a black outline around objects in a colored image.