This repository contains program to perform image segmentation i.e. dividing the image into user-defined number of classes using k-means algorithm. The algorithm has been implemented from scratch without using any inbuilt cv2 function. The below image of "traffic signal" has been divided into 4 classes.
- Python 2.0 or above
- OpenCV
- NumPy
python k_means.py
Fig. 1 - Original image Fig. 2 - Segmented image