Capturing objects in a video stream

Has anyone ever written a program to detect a face from a video, or something like that? I'm interested in what is better to write on, maybe you can suggest some resources where there is information.

Author: Nicolas Chabanovsky, 2011-03-17

3 answers

The Viola Jones algorithm and the so-called HaarCascades, OpenCV has everything for this. The code for face recognition is available in OpenCV samples. For example, for Python: [OpenCV]/samples/python/facedetect.py. Here is a simple code for detecting faces on the video from the camera:

import cv
cascadePath = r"c:\OpenCV2.2\data\haarcascades\haarcascade_frontalface_default.xml"
cascade = cv.Load(cascadePath)
memstorage = cv.CreateMemStorage()
capture = cv.CaptureFromCAM(0)
outimage = None
name = 'window'
cv.NamedWindow(name)
while True:
    frame = cv.QueryFrame(capture)
    key = cv.WaitKey(10)
    if(key != -1):
        break
    if not frame:
        break
    if outimage is None or cv.GetSize(frame) != cv.GetSize(outimage):
        outimage = cv.CreateImage(cv.GetSize(frame), 8, 3)
    cv.Flip(frame, outimage, 1)
    faces = cv.HaarDetectObjects(outimage, cascade, memstorage)
    for rect, n in faces:
        cv.Rectangle(outimage, (rect[0], rect[1]), (rect[0] + rect[2], rect[1] + rect[3]), (255, 0, 0) )        
    cv.ShowImage(name, outimage)
 3
Author: yapycoder, 2011-03-23 08:29:02

A series of articles about car license plate recognition. This is the closest I've seen. http://habrahabr.ru/blogs/image_processing/114529/

 0
Author: Сергей, 2011-03-17 08:57:48

It is best to start with the theoretical or applied literature on pattern recognition to have a general understanding of the subject. Usually it all comes down to varieties of neural networks.

Since the recognition task is not new, there are already many ready-made libraries. Personally, I have encountered AForge.NET in C# , a decent library. Still have OpenCV (wiki) with support for C / C++, Python.

 0
Author: stanislav, 2011-03-17 09:08:53