Image segmentation
For many steps in image analysis, it is important to split the image into two separate (non-overlapping) components. These components are usually labeled as background and foreground. Generally speaking, the background is the part of the image we are not directly interested in when we analyze the image. We normally restrict our analysis to parts of the image that are deemed as the foreground. This splitting into two components is called segmentation and is primarily based on pixel intensity. This is important if you wish to count and measure a number of unique objects of a specific type or measure the intensity of a single complex object while excluding the background from the measurement.
Image thresholding
To achieve the split of an image into background and foreground, we will set a threshold value. Values below this threshold will be classified as one group, while pixels with higher or equal values will be classified as another group. In general, the background in...