Real-Time Smile Detection OpenCV Python With Source Code

Real-Time Smile Detection OpenCV Python With Source Code

The Real-Time Smile Detection OpenCV Python was developed using Python OpenCV, In this article, we are going to build a smile detector using OpenCV which takes in live feed from webcam. The smile/happiness detector that we are going to implement would be a raw one, there exist many better ways to implement it.

A Smile Detection OpenCV Python face data is stored as tuples of coordinates. Here, x and y define the coordinate of the upper-left corner of the face frame, w and h define the width and height of the frame.

The cv2.rectangle function takes in the arguments frame, upper-left coordinates of the face, lower right coordinates, the RGB code for the rectangle (that would contain within it the detected face) and the thickness of the rectangle. The roi_gray defines the region of interest of the face and roi_color does the same for the original frame.

Watch the video here to see the full running source code of Real-Time Smile Detection OpenCV Python with Source Code

In this Real-Time Smile Detection OpenCV also includes a downloadable Project With Source Code for free, just find the downloadable source code below and click to start downloading.

By the way if you are new to python programming and you don’t know what would be the the Python IDE to use, I have here a list of Best Python IDE for Windows, Linux, Mac OS that will suit for you. I also have here How to Download and Install Latest Version of Python on Windows.

To start executing Real-Time Smile Detection OpenCV Python With Source Code, make sure that you have installed Python 3.9 and PyCharm in your computer.

Real-Time Smile Detection OpenCV Python With Source Code : Steps on how to run the project

Time needed: 5 minutes.

These are the steps on how to run Real-Time Smile Detection OpenCV Python With Source Code

  • Step 1: Download the given source code below.

    First, download the given source code below and unzip the source code.
    smile Detection download source code

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

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

  • Step 3: Run the project.

    last, run the project with the command “py main.py”
    smile Detection run project

Installed Libraries

Complete Source Code

Output

Run Quick Virus Scan for secure Download

Run Quick Scan for secure Download

Download Source Code below

Summary

Emotion detectors are used in many industries, one being the media industry where it is important for the companies to determine the public reaction to their products. In this article, we are going to build a smile detector using OpenCV which takes in live feed from webcam. The smile/happiness detector that we are going to implement would be a raw one, there exist many better ways to implement it.

Related Articles

Inquiries

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

Leave a Comment