Skip to content

rini-7/Color_Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Color Detection using OpenCV

This project performs real-time color detection using a webcam. It detects blue, green, and red objects in the frame, removes noise, and draws bounding boxes with labels. Output2 Output3 Output4 Output7

Features

  • Real-time webcam capture
  • HSV-based color segmentation
  • Noise removal using morphological operations
  • Contour detection with bounding boxes
  • Supports multiple colors simultaneously

Tech Stack

  • Python
  • OpenCV (cv2)
  • NumPy

How It Works

  1. Capture video from webcam
  2. Convert frame from BGR to HSV
  3. Create masks for:
    • Blue
    • Green
    • Red (two ranges for HSV wrap-around)
  4. Apply noise removal:
    • Morphological Opening
    • Morphological Closing
  5. Detect contours
  6. Draw bounding boxes and labels on detected objects
  7. Display:
    • Original frame
    • Mask
    • Result (masked output)

Noise Removal

  • Kernel: 5x5
  • Operations:
    • Opening (removes small noise)
    • Closing (fills gaps)

Usage

Install dependencies

pip install opencv-python numpy

About

This project performs real-time color detection using a webcam. It detects blue, green, and red objects in the frame, removes noise, and draws bounding boxes with labels.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages