Image thresholding is a simple, yet effective, way of partitioning an image into a foreground and background. This image analysis technique is a type of image segmentation that isolates objects by converting grayscale images into binary images. Image thresholding is most effective in images with high levels of contrast.
Common image thresholding algorithms include histogram and multi-level thresholding.
Image thresholding using multi-level thresholding
Image thresholding using a set level
For more detail, see Image Processing Toolbox.