A collection of OpenCV-based tools for color-based image and video segmentation.
img_segment.py
: Interactive image segmentation using HSV color space- Real-time trackbars for adjusting lower/upper HSV thresholds
- Displays original image, mask, and segmented result
palette.py
: RGB color palette generator- Interactive trackbars for color mixing
- Visual feedback of selected color
segment.py
: Video segmentation tool- Processes video frames with adjustable HSV thresholds
- Shows original video, mask, and segmented output
- Python 3.x
- OpenCV (
pip install opencv-python
) - NumPy (
pip install numpy
)
- Clone the repository:
git clone https://github.com/GauravKarakoti/color-segmentation.git
cd color-segmentation
- Install dependencies:
pip install -r requirements.txt
python img_segment.py
- Adjust trackbars to set HSV thresholds
- Press ESC to exit
- Ensure
image1.webp
exists in project directory or modify filename
python palette.py
- Use RGB trackbars to mix colors
- Displays resulting color in window
python segment.py
- Adjust trackbars for real-time video processing
- Ensure
video1.mp4
exists or modify video path - Press ESC to exit
Contributions are welcome! Please see Contributing.md for guidelines.