Internet
Fact-checked

At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What Is OpenCV Face Detection?

Alex Newth
Alex Newth

Open Source Computer Vision Library (OpenCV) is a program that comes with many modules and scripts for advanced video techniques on a computer. One of the scripts is OpenCV face detection, which uses a webcam to detect faces. As of 2011, many programmers are working on a way to expand this module to recognize a particular face instead of just recognizing whether a face is captured. This system works by recognizing common facial attributes, such as eyes and mouth, to determine whether a real face is being displayed.

In the OpenCV program library, there is a script called Haar Cascade. This module provides a facial detection system, but the detection has limited capabilities. The OpenCV face detection, without modification, can only detect if a face is displayed. This is done by accessing the computer’s webcam and checking the video that returns. If common facial attributes such as eyes and mouth are detected, then the OpenCV facial detection system will say a face is present.

Making use of creative coding, OpenCV can offer a framework to developers of performance-optimized vision-based code in a C++ interface.
Making use of creative coding, OpenCV can offer a framework to developers of performance-optimized vision-based code in a C++ interface.

New OpenCV users may have difficulty finding the facial recognition script. Like many other scripts, this is stored in the “Samples” section. By accessing the script, OpenCV can automatically use the recognition system without the programmer having to install the script manually.

Many programmers are working on the OpenCV open-source interface to improve the OpenCV face detection system. Instead of just recognizing whether a face is displayed by the webcam, the modified system is expected to recognize specific faces. This is primarily done by taking an image of someone’s face, showing that person on the webcam, and then comparing the two images. If the images are similar, then the facial detection will say the person is the same as in the stored image.

OpenCV face detection uses a webcam to detect faces.
OpenCV face detection uses a webcam to detect faces.

Some problems are apparent in the OpenCV face detection system, mostly with how effective the detection is. These problems come mostly from facial coordinates, such as where the eyes are. If the eyes or other facial elements are not where OpenCV expects them to be, then it will say a face is not present, even if one is. This requires programmers to manually enter the coordinates by hand each time the facial interface is used.

OpenCV face detection has a few uses beyond just being fun and giving programmers a way to enhance their skills. Facial detection can be used for security, especially when modified to recognize specific faces. This can also be used to easily store facial images from a webcam, instead of accidentally capturing other images.

Discussion Comments

Mammmood

@NathanG - For security purposes, I think you could combine a face detection algorithm with a motion detection algorithm.

Motion detection works by looking for shifting images in a frame of video – those shifting images are classified as motion. The detection of motion is done by comparing one frame to the next to see if any pixels changed.

If you combine this with the facial recognition algorithm, you not only know that someone moved, but you can get a close up on who it is. That would provide the ultimate security and deterrence in the end.

NathanG

@Charred - I agree. I don’t think that eye detection should be all that hard. Let’s remember that this is open source software however. There may be commercial products that do the job better.

For example, I have a facial animation program. What it does is takes a facial image, like from a still photo or clip art, and then animates it and lip syncs it according to whatever audio track you provide.

The program automatically detects the location of the eyes and the mouth, although you can tweak the coordinates just like the OpenCV face detection software does.

Charred

@everetra - I don’t understand why the face detection algorithm would have a hard time determining where the eyes are. It seems to me that this is the most prominent part of the facial features.

After all, you have two ovals with mostly white, and then different pigmentation in the center depending on the color of the eye. If I were writing the application the first thing that I’d have the program do is to zero in on the eyes, and then work itself out from there. That approach seems like it should work most of the time.

everetra

I would think that pattern recognition is the key concept behind this kind of software. I read a book on image enhancement algorithms once and it showed how you could use computer code to apply different effects to an image.

There was a lot of smart technology in the code, where it used pattern recognition to determine certain sets of features and stuff. I think the concept would apply here.

The OpenCV library looks at patterns of pixels to determine what part of the image is a “face” and what part is a background. I would think it would look at color values too, like darker, reddish colors for the pigmentation of the skin.

I don’t think that it would be foolproof but it should deliver positive results most of the time.

Post your comments
Login:
Forgot password?
Register:
    • Making use of creative coding, OpenCV can offer a framework to developers of performance-optimized vision-based code in a C++ interface.
      By: ビッグアップジャパン
      Making use of creative coding, OpenCV can offer a framework to developers of performance-optimized vision-based code in a C++ interface.
    • OpenCV face detection uses a webcam to detect faces.
      By: carlosseller
      OpenCV face detection uses a webcam to detect faces.