Project : Image Segmentation into foreground and background using Python
Language used: Python
Algorithm:
- Compute the histogram of pixel intensities vs the number of pixels
- Loop through the grayscale intensities from 0 to 255, setting each as a threshold
- Compute the weighted mean, and the variance from the function
- Compute the function value at that point
- Update minimum variance and then update the threshold
Example implementation
The input image is:-
The histogram for the given image is:-
The output of the binarization is:-