Click here to Skip to main content
15,896,606 members
Articles / Desktop Programming / MFC

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

Rate me:
Please Sign up or sign in to vote.
4.95/5 (117 votes)
12 Jun 2008CPOL6 min read 1.2M   78K   367  
Real-Time Tracking of Human Eyes in video sequences for Human-Computer Interaction using a webcam
#include "cv.h"
#include "highgui.h"


//	Function prototypes
void extractHUE(IplImage* source, IplImage* dest);
void drawFaceBox(IplImage* img, CvBox2D faceBox);


void extractHUE(IplImage* source, IplImage* hue)
{
	IplImage* HSV = cvCreateImage(cvGetSize(source), IPL_DEPTH_8U, 3);

	// convert HSV color space
	cvCvtColor(source, HSV, CV_RGB2HSV);
	cvCvtPixToPlane(HSV, hue, NULL, NULL, NULL);
	
	cvReleaseImage(&HSV);
}

void drawFaceBox(IplImage* img, CvBox2D faceBox, double color)
{
	// top-left corner
	CvPoint pt1; 
	pt1.x = (int)(faceBox.center.x - (faceBox.size.width/2.0)); 
	pt1.y = (int)(faceBox.center.y - (faceBox.size.height/2.0));
	
	// bottom-right corner
	CvPoint pt2; 
	pt2.x = (int)(faceBox.center.x + (faceBox.size.width/2.0)); 
	pt2.y = (int)(faceBox.center.y + (faceBox.size.height/2.0));

	cvRectangle( img, pt1, pt2, color, 2 );
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Engineer ASELSAN A.S.
Turkey Turkey
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

Comments and Discussions