Shapes Detection OpenCV Python With Source Code

The Shapes Detection OpenCV Python is a computer vision project that refers to modules that identify and detect shapes of areas of an image that differ in brightness, color, or texture.

It is an important aspect of Image Processing.

Importance of Shapes Detection

For detecting and recognizing items, shape is critical. It can withstand changes in lighting and color.

Shape-based item detection and recognition approaches have been popular for many years because humans can distinguish objects only based on their shapes.

Project Details and Technology

Project Name:Shapes Detection Project In Python With Source Code
AbstractShape detection Python OpenCV refers to modules that identify and detect shapes of areas of an image
Language/s Used:Python Deep Learning
Python version (Recommended):3.8/3.9
Database:None
Type:Desktop Application
Developer:Source Code Hero
Updates:0
Shapes Detection Project In Python – Project Information

Shapes Detection OpenCV Python: About the project

This Shapes Detection OpenCV Python project was created with Python OpenCV. In this Shape Detection OpenCV Python project, I am taking an image with shapes such as triangle, square, rectangle, and circle. The cvtColor() function is then used to convert the image to grayscale.

The THRESH BINARY Method is then used to Threshold the Grayscaled image. After that, the Thresholded image is taken, and contours are found on it.

The edges of the contours acquired are then tallied using the approxPolyDP() function, which accepts each contour. The Contour’s edges are then drawn on the image using the drawContours() function.

This Shapes Detection In Python also includes a downloadable Python Project With Source Code for free, just find the downloadable source code below and click to start downloading.

To start executing a Shapes Detection OpenCV Python With Source Code, make sure that you have installed Python on your computer.

Steps on how to run the project

Time needed: 5 minutes

These are the steps on how to run Shapes Detection OpenCV Python With Source Code

  • Step 1: Download Source Code

    First, download the provided source code below.

  • Step 2: Extract File

    Next, after the download is finished extract the zip file.

  • Step 3: Import the project to your PyCharm IDE.

    Next, import the source code you’ve download to your PyCharm IDE.
    shapes detection open project

  • Step 4: Install all Libraries.

    Next, install all libraries given below.
    shapes detection import libraries

  • Step 5: Open cmd.

    Next, click the folder directory of the project and type cmd.
    shapes detection open cmd

  • Step 6: Run Project.

    Lastly, run the project with the command “py main.py”
    shapes detection run project

Download the Source Code below

Summary

In today’s article, we learned how to perform shape detection with OpenCV and Python.

To accomplish this, we leveraged contour approximation, the process of reducing the number of points on a curve to a more simple approximated version.

Then, based on this contour approximation, we examined the number of vertices each shape has. Given the vertex count, we were able to accurately label each of the shapes.

Related Articles

Inquiries

If you have any questions or suggestions about Shapes Detection OpenCV Python With Source Code, please feel free to leave a comment below.

Leave a Comment