Segmenting images
The segmentation of images is the process of dividing images into many sections or parts, also known as segments. This process is carried out using particular criteria. The simplest way in which we can divide images into segments is through thresholding. We have already learned about and demonstrated the techniques of thresholding in Chapter 6, Colorspaces, Transformations, and Thresholding. We will demonstrate two more methods of segmentation in this chapter. Those methods are the Mean Shift algorithm and k-means clustering.
Mean shift algorithm segmentation
Bogdan Georgescu and Chris M. Christoudias developed the mean shift algorithm and implemented it in C++. The Python implementation of the same algorithm is known as PyMeanShift. PyMeanShift uses ndarrays and NumPy for storing and processing images. That is why it is compatible with NumPy-based image processing libraries such as OpenCV, Mahotas, and scikit-image.
Note
You can find out more about this...