How to Use K-Means Clustering for Image Segmentation using OpenCV in Python To run this: pip3 install -r requirements.txt If you want to perform image segmentation on the image image.jpg: python kmeans_segmentation.py image.jpg For live camera, consider using live_kmeans_segmentation.py.