This project demonstrates real-time shape detection using Python and OpenCV. By leveraging the webcam feed, the program identifies the largest geometric shape in the frame and classifies it based on its contours. The detected shape is outlined, and its name is displayed on the video feed, making it an interactive and educational computer vision tool.
- Real-time detection and classification of shapes.
- Classifies common geometric shapes:
- Triangle
- Rectangle
- Pentagon
- Circle
- Line
- Visual feedback with contours and text labels.
- Simple and intuitive implementation using OpenCV.
- Python
- OpenCV
-
Clone the repository:
git clone https://github.com/Volcano-Dragon/Shape-Detection-Open-CV.git cd shape-detection-opencv -
Install dependencies:
Ensure Python 3.x and OpenCV are installed. Install OpenCV via pip:pip install opencv-python
-
Run the project:
python shape_detection.py
-
Quit the program:
Press the 'q' key to stop the program.
- Captures video feed from the webcam.
- Converts each frame to grayscale and applies Gaussian Blur for noise reduction.
- Uses the Canny Edge Detection algorithm to identify edges in the frame.
- Finds contours of objects and approximates their shapes.
- Detects the largest object's shape and displays its name on the video.


