Sunteți pe pagina 1din 11

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

11,823,646 members (26,958 online) S i g n i n Gm

11,823,646 members (26,958 online)

Sign in

11,823,646 members (26,958 online) S i g n i n Gm ailfor W ork Look m

Gm ailfor W ork

Look m ore professionalw ith custom G m ailfrom G oogle

Start free tria

Search for articles, questions, tips

Search for articles, questions, tips

home

articles

quick answers

discussions

features

community

help

Articles » Languages » C / C++ Language » General

help Articles » Languages » C / C++ Language » General zafersavas, 12 Jun 2008 CPOL
zafersavas, 12 Jun 2008 CPOL 770.4K 61.9K 351 Rate this: 4.95 (112 votes)
zafersavas, 12 Jun 2008
CPOL
770.4K
61.9K
351
Rate this:
4.95 (112 votes)

Real-Time Tracking of Human Eyes in video sequences for Human-Computer Interaction using a webcam

Download executable - 2.51 MB

Download source code - 199.24 KB

executable - 2.51 MB Download source code - 199.24 KB Special Offers. Powered by Shopper-Pro Eyes
Special Offers. Powered by Shopper-Pro
Special Offers.
Powered by Shopper-Pro
code - 199.24 KB Special Offers. Powered by Shopper-Pro Eyes are the most important features of

Eyes are the most important features of the human face. So effective usage of eye movements as a communication technique in user-to- computer interfaces can find place in various application areas.

Eye tracking and the information provided by the eye features have the potential to become an interesting way of communicating with a computer in a human-computer interaction (HCI) system. So with this motivation, designing a real-time eye feature tracking software is the aim of this project.

The purpose of the project is to implement a real-time eye-feature tracker with the following capabilities:

RealTime face tracking with scale and rotation invarianceeye-feature tracker with the following capabilities: Tracking the eye areas individually Tracking eye features

Tracking the eye areas individuallyRealTime face tracking with scale and rotation invariance Tracking eye features Eye gaze direction finding Remote

Tracking eye featuresand rotation invariance Tracking the eye areas individually Eye gaze direction finding Remote controlling using eye

Eye gaze direction findingTracking the eye areas individually Tracking eye features Remote controlling using eye movements 1 of 11

Remote controlling using eye movementsTracking the eye areas individually Tracking eye features Eye gaze direction finding 1 of 11 10/17/2015

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

Installation Instructions 1. Extract

Installation Instructions

1. Extract TrackEye_Executable.zip file. Before running TrackEye_636.exe , copy the two files SampleHUE.jpg and SampleEye.jpg to the C:\ folder. These two files are used for CAMSHIFT and Template-Matching algorithms.

2. There are no other steps to be followed by the user to run the software. There are no DLL dependencies as the software was built with the DLLs statically included.

Settings to be Done to Perform a Good Tracking

Settings for Face & Eye Detection

Under TrackEye Menu --> Tracker Settings

Input Source: videoEye Detection Under TrackEye Menu --> Tracker Settings Click on Select file and select Face Detection

Click on Select file and selectTrackEye Menu --> Tracker Settings Input Source: video Face Detection Algorithm: Haar Face Detection Algorithm

Face Detection Algorithm: Haar Face Detection AlgorithmSettings Input Source: video Click on Select file and select Check “Track also Eyes” checkBox Eye

Check “Track also Eyes” checkBoxFace Detection Algorithm: Haar Face Detection Algorithm Eye Detection Algorithm: Adaptive PCA Uncheck “Variance

Eye Detection Algorithm: Adaptive PCADetection Algorithm Check “Track also Eyes” checkBox Uncheck “Variance Check” Number of Database Images: 8

Uncheck “Variance Check”also Eyes” checkBox Eye Detection Algorithm: Adaptive PCA Number of Database Images: 8 Number of EigenEyes:

Number of Database Images: 8Algorithm: Adaptive PCA Uncheck “Variance Check” Number of EigenEyes: 5 Maximum allowable distance from

Number of EigenEyes: 5Uncheck “Variance Check” Number of Database Images: 8 Maximum allowable distance from eyespace: 1200 Face

Maximum allowable distance from eyespace: 1200Check” Number of Database Images: 8 Number of EigenEyes: 5 Face width/eye template width ratio: 0.3

Face width/eye template width ratio: 0.3EigenEyes: 5 Maximum allowable distance from eyespace: 1200 ColorSpace type to use during PCA: CV_RGB2GRAY

ColorSpace type to use during PCA: CV_RGB2GRAY type to use during PCA: CV_RGB2GRAY

\Avis\Sample.avi

Settings for Pupil Detection

Check “Track eyes in details” and then check “Detect also eye pupils”. Click “Adjust Parameters” button:

Enter “120” as the “Threshold Value”also eye pupils”. Click “Adjust Parameters” button: Click “Save Settings” and then click “Close”

Click “Save Settings” and then click “Close”button: Enter “120” as the “Threshold Value” Settings for Snake Check “Indicate eye boundary using

Settings for Snake

Check “Indicate eye boundary using active snakes”. Click “Settings for snake” button:

Select ColorSpace to use: CV_RGB2GRAY ColorSpace to use: CV_RGB2GRAY

Select Simple thresholding and enter 100 as the “Threshold value”snake” button: Select ColorSpace to use: CV_RGB2GRAY Click “Save Settings” and then click “Close” So far

Click “Save Settings” and then click “Close”thresholding and enter 100 as the “Threshold value” So far there has been a lot of

Click “Save Settings” and then click “Close” So far there has been a lot of work

So far there has been a lot of work on eye detection and before the project, the previous methods were carefully studied to determine the implemented method. We can classify studies related to eye into two main categories as listed below:

Special Equipment Based Approaches

Special Offers. Powered by Shopper-Pro

These type of studies use the necessary equipment which will give a signal of some sort which is proportional to the position of the eye in the orbit. Various methods that are current in use are Electrooculography, Infra-Red Oculography, Scleral search coils. These methods are completely out of our project.

Image Based Approaches

Image based approaches perform eye detections on the images. Most of the image based methods try to detect the eyes using the features of the eyes. Methods used so far are knowledge-based methods, feature-based methods (color, gradient), simple template matching, appearance methods. Another interesting method is “Deformable template matching” which is based on matching a geometrical eye template on an eye image by minimizing the energy of the geometrical model.

a geometrical eye template on an eye image by minimizing the energy of the geometrical model.

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

The implemented project is on three components:

1. Face detection: Performs scale invariant face detection

2. Eye detection: Both eyes are detected as a result of this step

3. Eye feature extraction: Features of eyes are extracted at the end of this step

Face Detection

Two different methods were implemented in the project. They are:

1. Continuously Adaptive Means-Shift Algorithm

2. Haar Face Detection method

Continuously Adaptive Mean-Shift Algorithm

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

Adaptive Mean Shift algorithm is used for tracking human faces and is based on robust non-parametric technique for climbing density gradients to find the mode (peak) of probability distributions called the mean shift algorithm. As faces are tracked in video sequences, mean shift algorithm is modified to deal with the problem of dynamically changing color probability distributions. The block diagram of the algorithm is given below:

The block diagram of the algorithm is given below: Haar-Face Detection Method The second face detection

Haar-Face Detection Method

The second face detection algorithm is based on a classifier working with Haar-Like features (namely a cascade of boosted classifiers working with Haar-like features). First of all it is trained with a few hundreds of sample views of a face. After a classifier is trained, it can be applied to a region of interest in an input image. The classifier outputs a "1" if the region is likely to show face and "0" otherwise. To search for the object in the whole image, one can move the search window across the image and check every location using the classifier. The classifier is designed so that it can be easily "resized" in order to be able to find the objects of interest at different sizes, which is more efficient than resizing the image itself.

Eye Detection

Two different methods were implemented in the project:

1. Template-Matching

2. Adaptive EigenEye Method

Template-Matching

Special Offers. Powered by Shopper-Pro

Template-Matching is a well-known method for object detection. In our template matching method, a standard eye pattern is created manually and given an input image, the correlation values with the standard patterns are computed for the eyes. The existence of an eye is determined based on the correlation values. This approach has the advantage of being simple to implement. However, it may sometimes be inadequate for eye detection since it cannot effectively deal with variation in scale, pose and shape.

Adaptive EigenEye Method

Adaptive EigenEye Method is based on the well-known method EigenFaces. However as the method is used for eye detection we named it as “ EigenEye Method”. The main idea is to decompose eye images into a small set of characteristics feature images called eigeneyes, which may be thought of as the principal components of the original images. These eigeneyes function as the orthogonal basis vectors of a subspace called eyespace. However we know that the eigenface method is not scale invariant. To provide the scale

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

invariance we can resize the eye-database once with the information gathered by the face detection algorithm (EyeWidth / FaceWidth ? 0.35), we can provide scale-invariant detection using only one database.

provide scale-invariant detection using only one database. OpenCV Library offers a lot of image processing and

OpenCV Library offers a lot of image processing and object tracking & detection libraries. The main function used in these projects and their usage are given below:

Sample Code for Haar-Face Tracking

Hide Shrink Copy Code void CTrackEyeDlg::HaarFaceDetect( IplImage* img, CvBox2D* faceBox) { int scale = 2
Hide
Shrink
Copy Code
void CTrackEyeDlg::HaarFaceDetect( IplImage* img, CvBox2D* faceBox)
{
int scale = 2 ;
IplImage* temp = cvCreateImage( cvSize(img‐ >width/2,img ‐ >height/2), 8 , 3 );
CvPoint pt1, pt2;
int i;
cvPyrDown( img, temp, CV_GAUSSIAN_5x5 );
#ifdef WIN32
cvFlip( temp, temp, 0 );
#endif
cvClearMemStorage( storage );
if ( hid_cascade )
{
CvSeq* faces = cvHaarDetectObjects( temp, hid_cascade, storage, 1 . 2 , 2 ,
CV_HAAR_DO_CANNY_PRUNING );
NumOfHaarFaces = faces ‐ >total;
if (NumOfHaarFaces > 0 )
{
CvRect* r = (CvRect*)cvGetSeqElem( faces, 0 , 0 );
pt1.x = r ‐ >x*scale;
pt2.x = (r ‐ >x+r ‐ >width)*scale;
#ifdef WIN32
pt1.y = img ‐ >height ‐ r ‐ >y*scale;
pt2.y = img ‐ >height ‐ (r ‐ >y+r ‐ >height)*scale;
#else
pt1.y = r ‐ >y*scale;
pt2.y = (r ‐ >y+r ‐ >height)*scale;
#endif
faceBox ‐ >center.x = ( float )(pt1.x+pt2.x)/2. 0 ;
faceBox ‐ >center.y = ( float )(pt1.y+pt2.y)/2;
faceBox ‐ >size.width = ( float )(pt2.x ‐ pt1.x);
faceBox ‐ >size.height = ( float )(pt1.y ‐ pt2.y);
}
}
cvShowImage( "Tracking", img );
cvReleaseImage( &temp );
}
Sample Code for CamShift Algorithm
Special Offers.
Copy Powered Code by Shopper-Pro
Hide
// Inputs for CamShift algorithm
IplImage* HUE = cvCreateImage(cvGetSize(SampleForHUE), IPL_DEPTH_8U, 1 );
extractHUE(SampleForHUE, HUE);
//
**
Extract HUE information
int hist_size
float ranges[]
= 20 ;
= { 0 , 180 };
float * pranges[] = {ranges};
hist = cvCreateHist( 1 , &hist_size, CV_HIST_ARRAY, pranges, 1 );
cvCalcHist(&HUE, hist);
// Calculate histogram of HUE part
hueFrame = cvCreateImage(cvGetSize(CameraFrame), IPL_DEPTH_8U, 1 );
backProject = cvCreateImage(cvGetSize(CameraFrame), IPL_DEPTH_8U, 1 );
extractHUE(CameraFrame, hueFrame);
while (trackControl != 0 )
{
extractHUE( CameraFrame, hueFrame );
cvCalcBackProject( &hueFrame, backProject, hist ); // Probability is formed

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

//cvShowImage("Tester2", backProject); cvCamShift( backProject, searchWin, cvTermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 15 , 0 . 1 ), &comp, &faceBox ); searchWin = comp.rect;

}

Sample Code Template Matching

Hide

Shrink

= comp.rect; } Sample Code Template Matching Hide Shrink Copy Code // Template Matching for Eye

Copy Code

// Template Matching for Eye detection void Face::findEyes_TM(IplImage* faceImage, TrackingSettings* settings)

   

{

 

CvSize faceSize; faceSize = cvGetSize(faceImage);

 

// Load Template from the eye database CString fileName; // Name of the template for left eye fileName.Format( "%s\\eye%d.jpg" , settings >params>DBdirectory, 0 ); IplImage* eyeImage_Left = cvLoadImage(fileName, 1 ); // Name of the template for left eye fileName.Format( "%s\\eye%d.jpg" , settings >params>DBdirectory, 1 );

IplImage* eyeImage_Right = cvLoadImage(fileName, 1 );

IplImage* tempTemplateImg_Left; IplImage* tempTemplateImg_Right; IplImage* templateImg_Left; IplImage* templateImg_Right;

if (eyeImage_Left == NULL || eyeImage_Right == NULL)

{

 

MessageBox(NULL, "Templates can not be loaded.\n Please check your eye database folder", "Error" , MB_OK||MB_ICONSTOP); exit( 1 );

 
 

}

else

{

 

//

Change color space according to the settings entered by the user

tempTemplateImg_Left = cvCreateImage(cvGetSize(eyeImage_Left), IPL_DEPTH_8U, 1 );

changeColorSpace(settings, eyeImage_Left, tempTemplateImg_Left); tempTemplateImg_Right = cvCreateImage(cvGetSize(eyeImage_Right), IPL_DEPTH_8U, 1 ); changeColorSpace(settings, eyeImage_Right, tempTemplateImg_Right);

 

float idealWidth = faceSize.width * settings >params >ratio; float conversionRatio = idealWidth/( float )tempTemplateImg_Left >width;

CvSize newSize; newSize.width = ( int )idealWidth; newSize.height = ( int )(tempTemplateImg_Left >height*conversionRatio);

templateImg_Left = cvCreateImage(newSize, IPL_DEPTH_8U, 1 ); cvResize(tempTemplateImg_Left, templateImg_Left, CV_INTER_LINEAR); // was NN cvReleaseImage(&eyeImage_Left); cvReleaseImage(&tempTemplateImg_Left);

templateImg_Right = cvCreateImage(newSize, IPL_DEPTH_8U, 1 ); cvResize(tempTemplateImg_Right, templateImg_Right, CV_INTER_LINEAR); // was NN cvReleaseImage(&eyeImage_Right); cvReleaseImage(&tempTemplateImg_Right);

 

}

// *************************************************************

 

//

************Search faceImage for eyes************************

Special Offers. Powered by Shopper-Pro

 

// ************************************************************* IplImage* GRAYfaceImage = cvCreateImage(faceSize, IPL_DEPTH_8U, 1 );

   

changeColorSpace(settings, faceImage, GRAYfaceImage); //cvCvtColor( faceImage, GRAYfaceImage, CV_RGB2GRAY); //GRAYfaceImage>origin = 1; **

//

Warning at this point image origin is bottom left corner.

//

**

Eye1 search area

int x_left = 0 ; int y_left = 0 ; int width_left = ( int )(( float )(faceSize.width/2. 0 )); int height_left = ( int )(( float )(faceSize.height)); CvRect rect_Eye1 = cvRect(x_left, y_left, width_left, height_left);

 

CvMat* Eye1Image = cvCreateMat(width_left, height_left, CV_8UC1); cvGetSubRect(GRAYfaceImage, Eye1Image, rect_Eye1 ); cvFlip( Eye1Image, Eye1Image, 0 );

//

**

Eye2 search area

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

int x_right= ( int )(( float )(faceSize.width/2. 0 )); int y_right = 0 ; int width_right = ( int )(( float )(faceSize.width/2.0 )); int height_right = ( int )(( float )(faceSize.height)); CvRect rect_Eye2 = cvRect(x_right, y_right, width_right, height_right);

CvMat* Eye2Image = cvCreateMat(width_right, height_right, CV_8UC1); cvGetSubRect(GRAYfaceImage, Eye2Image, rect_Eye2 ); cvFlip( Eye2Image, Eye2Image, 0 );

// OpenCV says that size of the result must be the following:

CvSize size; size.height= Eye1Image >height templateImg_Left>height + 1 ; size.width = Eye1Image >width templateImg_Left >width + 1 ; IplImage* result1 = cvCreateImage( size,IPL_DEPTH_32F, 1 ); IplImage* result2 = cvCreateImage( size,IPL_DEPTH_32F, 1 );

// Left Eye cvMatchTemplate( Eye1Image, templateImg_Left, result1, settings >params >tempMatch); // Right Eye cvMatchTemplate( Eye2Image, templateImg_Right, result2, settings>params>tempMatch);

// find the best match location LEFT EYE double minValue1, maxValue1; CvPoint minLoc1, maxLoc1; cvMinMaxLoc( result1, &minValue1, &maxValue1, &minLoc1, &maxLoc1 ); cvCircle( result1, maxLoc1, 5 , settings >programColors.colors[ 2 ], 1 ); // transform point back to original image maxLoc1.x += templateImg_Left >width / 2 ; maxLoc1.y += templateImg_Left >height / 2 ; settings>params >eye1.coords.x = maxLoc1.x; settings>params >eye1.coords.y = maxLoc1.y; settings>params >eye1.RectSize.width = templateImg_Left >width; settings>params >eye1.RectSize.height = templateImg_Left>height; settings>params >eye1.eyefound = true ;

// find the best match location RIGHT EYE double minValue2, maxValue2; CvPoint minLoc2, maxLoc2; cvMinMaxLoc( result2, &minValue2, &maxValue2, &minLoc2, &maxLoc2 ); cvCircle( result2, maxLoc2, 5 , settings >programColors.colors[ 2 ], 1 ); // transform point back to original image maxLoc2.x += templateImg_Left >width / 2 ; maxLoc2.y += templateImg_Left >height / 2 ; settings>params >eye2.coords.x = maxLoc2.x+( int )faceSize.width/2; settings>params >eye2.coords.y = maxLoc2.y; settings>params >eye2.RectSize.width = templateImg_Left >width; settings>params >eye2.RectSize.height = templateImg_Left>height; settings>params >eye2.eyefound = true ;

cvCircle( Eye1Image, maxLoc1, 5 , settings >programColors.colors[2 ], 1 ); cvCircle( Eye2Image, maxLoc2, 5 , settings >programColors.colors[2 ], 1 );

}

Sample Code Adaptive EigenEye Method

Hide

Shrink

1 ); } Sample Code Adaptive EigenEye Method Hide Shrink Copy Code void Face::findEyes(IplImage* faceImage,

Copy Code

void Face::findEyes(IplImage* faceImage, TrackingSettings* settings)

{

IplImage** images = (IplImage**)malloc( sizeof (IplImage*)*numOfImages); IplImage** eigens = (IplImage**)malloc( sizeof (IplImage*)*numOfImages);

 

Special Offers. Powered by Shopper-Pro

IplImage* averageImage; IplImage* projection;

CvSize faceSize; faceSize = cvGetSize(faceImage); eigenSize newEigenSize;

newEigenSize.width = faceSize.width * settings>params >ratio;

newEigenSize.conversion = (( float )newEigenSize.width) / (( float )database[ 0 ] >width); newEigenSize.height = (( float )database[ 0 ] >height) * newEigenSize.conversion;

CvSize newSize; newSize.width = ( int )newEigenSize.width; newSize.height = ( int )newEigenSize.height;

IplImage* tempImg = cvCreateImage( newSize, IPL_DEPTH_8U, 1 ); // **********Initializations********** for ( int i= 0 ; i<settings />params>nImages; i++)

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

{

Special Offers. Powered by Shopper-Pro

S p e c i a l O f f e r s . Powered by
S p e c i a l O f f e r s . Powered by
S p e c i a l O f f e r s . Powered by

images[i] = cvCreateImage(newSize, IPL_DEPTH_8U, 1 ); cvResize(database[i], images[i], CV_INTER_LINEAR); // was NN

Create space for EigenFaces

}

cvShowImage("Eigen", images[ 0 ]);

cvReleaseImage(&tempImg);

//

for (i= 0 ; i<settings />params>nImages; i++) eigens[i] = cvCreateImage(cvGetSize(images[ 0 ]), IPL_DEPTH_32F, 1 );

averageImage = cvCreateImage(cvGetSize(images[0 ]), IPL_DEPTH_32F, 1 ); projection = cvCreateImage(cvGetSize(images[ 0 ]), IPL_DEPTH_8U, 1 );

// *************************************************************

//

// ************************************************************* CvTermCriteria criteria;

criteria.type = CV_TERMCRIT_ITER|CV_TERMCRIT_EPS; criteria.maxIter = 13 ; criteria.epsilon = 0 . 1 ;

************Calculate EigenVectors & EigenValues*************

//

cvCalcEigenObjects( settings >params >nImages, images, eigens,

**

n was present instead of numOfImages

0 , 0 , 0 , &criteria, averageImage, vals );

// *************************************************************

//

// *************************************************************

IplImage* GRAYfaceImage = cvCreateImage(faceSize, IPL_DEPTH_8U, 1 ); changeColorSpace(settings,faceImage, GRAYfaceImage); //cvCvtColor( faceImage, GRAYfaceImage, CV_RGB2GRAY);

//

GRAYfaceImage >origin = 1 ;

************Search faceImage for eyes************************

** Warning at this point image origin is bottom left corner.

int MARGIN = settings >params >MaxError; double minimum = MARGIN; double distance = MARGIN;

**

Eye1 search Space

//

settings>params >eye1.xlimitLeft = 0 ; settings>params >eye1.xlimitRight = faceSize.width/2. 0 images[ 0 ] >width 1 ; settings>params >eye1.ylimitUp = ( int )( (( float )faceSize.height)* 0 . 75 images[ 0 ] >height 1 ); settings>params >eye1.ylimitDown = faceSize.height/2;

//

settings>params >eye2.xlimitLeft = faceSize.width/2.0 ; settings>params >eye2.xlimitRight = faceSize.width images[0 ] >width 1 ; settings>params >eye2.ylimitUp =

( int )( (( float )faceSize.height)* 0 . 75 images[ 0 ] >height 1 ); settings>params >eye2.ylimitDown = faceSize.height/2;

**

Eye2 search Space

settings

>params >eye1.initializeEyeParameters();

settings

>params >eye2.initializeEyeParameters();

settings>params >eye1.RectSize.width = images[ 0 ] >width; settings>params >eye1.RectSize.height = images[ 0 ] >height; settings>params >eye2.RectSize.width = images[ 0 ] >width; settings>params >eye2.RectSize.height = images[ 0 ] >height;

Search left eye i.e eye1

cvSetImageROI(GRAYfaceImage, cvRect (x, y, images[0 ] >width, images[ 0 ] >height)); if (settings >params >varianceCheck == 1 )

{

cvResetImageROI(GRAYfaceImage); continue ;

}

Decide whether it is an eye or not

IplImage* Image2Comp = cvCreateImage(cvGetSize(images[ 0 ]), IPL_DEPTH_8U, 1 ); int x,y; **

//

for (y=settings>params>eye1.ylimitDown; y<settings />params >eye1.ylimitUp; y+= 2 )

{

for (x=settings>params>eye1.xlimitLeft; x<settings />params >eye1.xlimitRight; x+= 2 )

{

if (calculateSTD(GRAYfaceImage) <= ( double )(settings>params>variance))

{

}

cvFlip( GRAYfaceImage, Image2Comp, 0 ); cvResetImageROI(GRAYfaceImage);

//

cvEigenDecomposite( Image2Comp, settings >params >nEigens, eigens, 0 , 0 , averageImage, weights ); cvEigenProjection( eigens, settings >params >nEigens,

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

CV_EIGOBJ_NO_CALLBACK, 0 , weights, averageImage, projection ); distance = cvNorm(Image2Comp, projection, CV_L2, 0 ); if
CV_EIGOBJ_NO_CALLBACK, 0 , weights, averageImage, projection );
distance = cvNorm(Image2Comp, projection, CV_L2, 0 );
if (distance < minimum && distance > 0 )
{
settings ‐ >params ‐ >eye1.eyefound = true ;
minimum = distance;
settings ‐ >params ‐ >eye1.distance = distance;
settings ‐ >params ‐ >eye1.coords.x = x;
settings ‐ >params ‐ >eye1.coords.y = y;
}
}
}
minimum = MARGIN; distance = MARGIN;
//
**
Search right eye i.e eye2
for (y=settings‐ >params‐ >eye2.ylimitDown; y<settings ‐ />params ‐ >eye2.ylimitUp; y+= 2 )
{
for (x=settings‐ >params‐ >eye2.xlimitLeft; x<settings ‐ />params ‐ >eye2.xlimitRight; x+= 2 )
{
cvSetImageROI(GRAYfaceImage,
cvRect(x, y, images[0 ] ‐ >width, images[ 0 ] ‐ >height));
if (settings ‐ >params ‐ >varianceCheck == 1 )
{
if (calculateSTD(GRAYfaceImage) <= ( double )(settings‐ >params‐ >variance))
{
cvResetImageROI(GRAYfaceImage);
continue ;
}
}
//
cvFlip( GRAYfaceImage, Image2Comp, 0 );
cvResetImageROI(GRAYfaceImage);
**
Decide whether it is an eye or not
cvEigenDecomposite( Image2Comp, settings ‐ >params ‐ >nEigens,
eigens, 0 , 0 , averageImage, weights );
cvEigenProjection( eigens, settings ‐ >params ‐ >nEigens,
0 , 0 , weights, averageImage, projection );
distance = cvNorm(Image2Comp, projection, CV_L2, 0 );
if (distance < minimum && distance > 0 )
{
settings ‐ >params ‐ >eye2.eyefound = true ;
minimum = distance;
settings ‐ >params ‐ >eye2.distance = distance;
settings ‐ >params ‐ >eye2.coords.x = x;
settings ‐ >params ‐ >eye2.coords.y = y;
}
}
}
cvReleaseImage(&Image2Comp);
//
**
Cleanup
cvReleaseImage(&GRAYfaceImage);
for (i= 0 ; i<settings ‐ />params‐ >nImages; i++)
cvReleaseImage(&images[i]);
for (i= 0 ; i<settings ‐ />params‐ >nImages; i++)
cvReleaseImage(&eigens[i]);
cvReleaseImage(&averageImage);
cvReleaseImage(&projection);
Special Offers. Powered by Shopper-Pro
free(images);
free(eigens);
}
Powered by Shopper-Pro free(images); free(eigens); } 1.0 : First version of TrackEye 2.0 : Second version

1.0 : First version of TrackEye TrackEye

2.0 : Second version of TrackEye TrackEye

v

v

version of TrackEye 2.0 : Second version of TrackEye v v TrackEye v2.0 now supports: Two

TrackEye v2.0 now supports:

Two different face detection algorithms:Second version of TrackEye v v TrackEye v2.0 now supports: 1. Haar Face Tracking 2. CAMSHIFT

1. Haar Face Tracking

2. CAMSHIFT

Two different eye detection algorithms:now supports: Two different face detection algorithms: 1. Haar Face Tracking 2. CAMSHIFT 8 of 11

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

1. Adaptive Principal Components Analysis

2. Template matching

Tracking algorithms can be selected by the user at the beginning of the process via GUI.Adaptive Principal Components Analysis 2. Template matching Selectable input source: 1. Webcam 2. Video file *

Selectable input source:by the user at the beginning of the process via GUI. 1. Webcam 2. Video file

1. Webcam

2. Video file

* Please note that TrackEye was written with OpenCV Library v3.1, so make sure to use it during rebuild.

OpenCV Library v3.1, so make sure to use it during rebuild. This article, along with any

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

EMAIL TWITTER
EMAIL
TWITTER
under The Code Project Open License (CPOL) EMAIL TWITTER zafersavas Engineer ASELSAN A.S. Turkey Zafer is
under The Code Project Open License (CPOL) EMAIL TWITTER zafersavas Engineer ASELSAN A.S. Turkey Zafer is

zafersavas

Engineer ASELSAN A.S.

Turkey

EMAIL TWITTER zafersavas Engineer ASELSAN A.S. Turkey Zafer is an electronics engineer living in Ankara/Turkey and

Zafer is an electronics engineer living in Ankara/Turkey and working for ASELSAN A.S./TMM. He has been coding for about 12 years, and can't think a life without C/C++.

He likes

- MS Visual C++ 6.0 and MFC

- .NET C#

- All kinds of electronics stuff

- Machine Vision projects

Also he enjoys

- Listening to "The Cranberries" & "The Glorious Dolores"

- Travelling

E-mail : zafersavas@yahoo.com

Dolores" - Travelling E-mail : zafersavas@yahoo.com S p e c i a l O f f

Special Offers. Powered by Shopper-Pro

Realtime Webcam Sudoku Solver c i a l O f f e r s . Powered by Shopper-Pro Eye of

Eye of the Drone s . Powered by Shopper-Pro Realtime Webcam Sudoku Solver Embedding Analytics into a Database Using JMSL

Embedding Analytics into a Database Using JMSL  

SAPrefs - Netscape-like Preferences DialogSolver Eye of the Drone Embedding Analytics into a Database Using JMSL  9 of 11

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

'enRoute': Real-time NY City Bus Tracking Web App

'enRoute': Real-time NY City Bus Tracking Web App

XNA Snooker Club 'enRoute': Real-time NY City Bus Tracking Web App You must Sign In to use this message

Real-time NY City Bus Tracking Web App XNA Snooker Club You must Sign In to use

You must Sign In to use this message board.

   
 

Search Comments

 

Go

 
  Profile popups Spacing Relaxed Layout Normal Per page 25   Update

Profile popups

Spacing

Relaxed

Layout

Normal

Per page

25

 

Update

 

First

Prev Next

cvaux error  Member 10986621   13-Sep-15 22:49

cvaux error
 

Member 10986621cvaux error     13-Sep-15 22:49

 

13-Sep-15 22:49

errorMember 11781477   5-Jul-15 1:45

error Member 11781477   5-Jul-15 1:45

Member 11781477error   5-Jul-15 1:45

 

5-Jul-15 1:45

göz bebeğ i takibi ği takibi

göz bebe ğ i takibi Member 11430809   5-Feb-15 10:16

Member 11430809göz bebe ğ i takibi   5-Feb-15 10:16

 

5-Feb-15 10:16

BravoMember 7906215   14-Oct-14 5:07

Bravo Member 7906215   14-Oct-14 5:07

Member 7906215Bravo   14-Oct-14 5:07

 

14-Oct-14 5:07

Re: Bravo   junof   14-Oct-14 20:20

Re: Bravo

Re: Bravo
 

junofRe: Bravo     14-Oct-14 20:20

 

14-Oct-14 20:20

currently do combine OPENCV the implementation of the eye-tracking, you can see the effect, tracking rate of 82.5%junof

junofcurrently do combine OPENCV the implementation of the eye-tracking, you can see the effect, tracking rate

 

12-Oct-14 19:14

-98%

-98%

thank the selfless dedicationjunof   7-Sep-14 7:43

thank the selfless dedication junof   7-Sep-14 7:43

junofthank the selfless dedication   7-Sep-14 7:43

 

7-Sep-14 7:43

Re: thank the selfless dedication Charles Song   15-Sep-14 14:06

Re: thank the selfless dedication

Re: thank the selfless dedication Charles Song   15-Sep-14 14:06

Charles SongRe: thank the selfless dedication   15-Sep-14 14:06

 

15-Sep-14 14:06

 

Re: thank the selfless dedication  junof   22-Sep-14 15:01

  Re: thank the selfless dedication junof   22-Sep-14 15:01

junof  Re: thank the selfless dedication   22-Sep-14 15:01

 

22-Sep-14 15:01

 

Re: thank the selfless dedication  junof   12-Oct-14 19:12

  Re: thank the selfless dedication junof   12-Oct-14 19:12

junof  Re: thank the selfless dedication   12-Oct-14 19:12

 

12-Oct-14 19:12

 
  Re: thank the selfless dedication   Member 11769744   23-Jul-15 2:26

Re: thank the selfless dedication

Re: thank the selfless dedication
 

Member 11769744  Re: thank the selfless dedication     23-Jul-15 2:26

 

23-Jul-15 2:26

Can't open the ZIP files! (corrupted archives?)Tristano Ajmone   24-Aug-14 11:49

Can't open the ZIP files! (corrupted archives?) Tristano Ajmone   24-Aug-14 11:49

Tristano AjmoneCan't open the ZIP files! (corrupted archives?)   24-Aug-14 11:49

 

24-Aug-14 11:49

Head trajectory causes program crash  Peter Minev   23-Mar-14 22:56

Head trajectory causes program crash
 

Peter MinevHead trajectory causes program crash     23-Mar-14 22:56

 

23-Mar-14 22:56

zafersavas  Member 10207419   3-Sep-13 5:50

zafersavas
 

Member 10207419zafersavas     3-Sep-13 5:50

 

3-Sep-13 5:50

Error: Can not initialize capture!  Member 10110835   15-Jun-13 17:44

Error: Can not initialize capture!
 

Member 10110835Error: Can not initialize capture!     15-Jun-13 17:44

 

15-Jun-13 17:44

OpenCV V3.1  Special Offers. Member 9498760 27-Mar-13 2:26 Powered by Shopper-Pro

OpenCV V3.1
 

Special Offers.Member 9498760

Member 9498760

27-Mar-13 2:26

Powered by Shopper-Pro

OpenCV Vb3.1  mperevilla   28-Jan-13 15:14  

OpenCV Vb3.1
 

mperevillaOpenCV Vb3.1     28-Jan-13 15:14  

 

28-Jan-13 15:14

 

It sais cannot inialze capture plz helpMember 9740318   8-Jan-13 13:03

It sais cannot inialze capture plz help Member 9740318   8-Jan-13 13:03

Member 9740318It sais cannot inialze capture plz help   8-Jan-13 13:03

 

8-Jan-13 13:03

Re: It sais cannot inialze capture plz help Member 10110835   15-Jun-13 17:47

Re: It sais cannot inialze capture plz help

Re: It sais cannot inialze capture plz help Member 10110835   15-Jun-13 17:47

Member 10110835Re: It sais cannot inialze capture plz help   15-Jun-13 17:47

 

15-Jun-13 17:47

 
  Re: It sais cannot inialze capture plz help   Member 10511312   12-Jan-14 7:13

Re: It sais cannot inialze capture plz help

Re: It sais cannot inialze capture plz help
 

Member 10511312  Re: It sais cannot inialze capture plz help     12-Jan-14 7:13

 

12-Jan-14 7:13

TrackEye on Androidloulou69   19-Dec-12 4:12

TrackEye on Android loulou69   19-Dec-12 4:12

loulou69TrackEye on Android   19-Dec-12 4:12

 

19-Dec-12 4:12

My vote of 5  jinujo   12-Oct-12 23:10

My vote of 5
 

jinujoMy vote of 5     12-Oct-12 23:10

 

12-Oct-12 23:10

link Broken  minto5050   16-Sep-12 23:33

link Broken
 

minto5050link Broken     16-Sep-12 23:33

 

16-Sep-12 23:33

TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam - CodeP

http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracki

OpenCV GUI problemOktay_Ger 3-Jul-12 8:13

OpenCV GUI problem Oktay_Ger 3-Jul-12 8:13

Oktay_GerOpenCV GUI problem 3-Jul-12 8:13

3-Jul-12 8:13

what about outputelgareb2008 27-Jun-12 11:24

what about output elgareb2008 27-Jun-12 11:24

elgareb2008what about output 27-Jun-12 11:24

27-Jun-12 11:24

Last Visit: 31-Dec-99 18:00

Last Update: 16-Oct-15 22:54

Refresh

1

2

3

4

5

6

7

8

9

10

Next »

General1 2 3 4 5 6 7 8 9 10 Next » News Suggestion Question Bug

3 4 5 6 7 8 9 10 Next » General News Suggestion Question Bug Answer

News

4 5 6 7 8 9 10 Next » General News Suggestion Question Bug Answer Joke

Suggestion

6 7 8 9 10 Next » General News Suggestion Question Bug Answer Joke Rant Admin

Question

8 9 10 Next » General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right

Bug

8 9 10 Next » General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right

Answer

Joke10 Next » General News Suggestion Question Bug Answer Rant Admin Use Ctrl+Left/Right to switch messages,

Next » General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right to switch messages,

Rant

» General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down

Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile Web04 | 2.8.151002.1 | Last Updated 12 Jun 2008

Select Language

Layout: fixed | fluid

Article Copyright 2008 by zafersavas Everything else Copyright © CodeProject, 1999-2015

Special Offers. Powered by Shopper-Pro