Skip to content

rajsolanki907/Edge-Contour-Detection-Machine-Learning-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Edge-Contour-Detection-Machine-Learning-

Edge & Contour Detection - Machine Learning using CV2

Description This Python project demonstrates basic image processing techniques using OpenCV to identify and count black squares in an image. It performs the following steps:

Image Loading: Loads an image containing black shapes.

Grayscale Conversion: Converts the image to grayscale for easier edge detection.

Canny Edge Detection: Applies the Canny edge detector to extract edges from the grayscale image.

Contour Finding: Identifies and isolates individual shapes (contours) within the image..

Counting Contours: Counts the number of detected contours, which correspond to the black squares in this specific case.

Visualization: Displays the original image with green outlines drawn around the identified squares.

Requirements

Instructions

  1. Install OpenCV: Open a terminal or command prompt and run:

Bash.

pip install opencv-python

  1. Download the Image: Download the image named pexels-pixabay-219906.jpg and place it in the same directory as this Python file (script.py).

  2. Run the Script: Open a terminal in the project directory and execute:

Bash

python script.py

Output

The script will display the original image with green outlines drawn around the detected black squares. It will also print the number of detected contours to the console.

Additional Notes

  • This code is a basic example and can be extended to handle different shapes, colors, or more complex scenarios.
  • Feel free to experiment with different image inputs and OpenCV functions to explore additional image processing capabilities.

About

Edge & Contour Detection - Machine Learning using CV2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published