眼睛识别Word文件下载.docx
《眼睛识别Word文件下载.docx》由会员分享,可在线阅读,更多相关《眼睛识别Word文件下载.docx(16页珍藏版)》请在冰豆网上搜索。
E-mail:
zafersavas@
Introduction
Eyesarethemostimportantfeaturesofthehumanface.Soeffectiveusageofeyemovementsasacommunicationtechniqueinuser-to-computerinterfacescanfindplaceinvariousapplicationareas.
Eyetrackingandtheinformationprovidedbytheeyefeatureshavethepotentialtobecomeaninterestingwayofcommunicatingwithacomputerinahuman-computerinteraction(HCI)system.Sowiththismotivation,designingareal-timeeyefeaturetrackingsoftwareistheaimofthisproject.
Thepurposeoftheprojectistoimplementareal-timeeye-featuretrackerwiththefollowingcapabilities:
∙RealTimefacetrackingwithscaleandrotationinvariance
∙Trackingtheeyeareasindividually
∙Trackingeyefeatures
∙Eyegazedirectionfinding
∙Remotecontrollingusingeyemovements
InstructionstoRunandRebuildTrackEye
InstallationInstructions
1.Extract
TrackEye_Executable.zip
file.Beforerunning
TrackEye_636.exe,copythetwofiles
SampleHUE.jpg
andSampleEye.jpg
tothe
C:
\
folder.ThesetwofilesareusedforCAMSHIFTandTemplate-Matchingalgorithms.
2.Therearenootherstepstobefollowedbytheusertorunthesoftware.TherearenoDLLdependenciesasthesoftwarewasbuiltwiththeDLLsstaticallyincluded.
SettingstobeDonetoPerformaGoodTracking
SettingsforFace&
EyeDetection
UnderTrackEyeMenu-->
TrackerSettings
∙InputSource:
video
∙ClickonSelectfileandselect
..\Avis\Sample.avi
∙FaceDetectionAlgorithm:
HaarFaceDetectionAlgorithm
∙Check“TrackalsoEyes”checkBox
∙EyeDetectionAlgorithm:
AdaptivePCA
∙Uncheck“VarianceCheck”
∙NumberofDatabaseImages:
8
∙NumberofEigenEyes:
5
∙Maximumallowabledistancefromeyespace:
1200
∙Facewidth/eyetemplatewidthratio:
0.3
∙ColorSpace
typetouseduringPCA:
CV_RGB2GRAY
SettingsforPupilDetection
Check“Trackeyesindetails”andthencheck“Detectalsoeyepupils”.Click“AdjustParameters”button:
∙Enter“120”asthe“ThresholdValue”
∙Click“SaveSettings”andthenclick“Close”
SettingsforSnake
Check“Indicateeyeboundaryusingactivesnakes”.Click“Settingsforsnake”button:
∙Select
ColorSpace
touse:
∙SelectSimplethresholdingandenter100asthe“Thresholdvalue”
Background
Sofartherehasbeenalotofworkoneyedetectionandbeforetheproject,thepreviousmethodswerecarefullystudiedtodeterminetheimplementedmethod.Wecanclassifystudiesrelatedtoeyeintotwomaincategoriesaslistedbelow:
SpecialEquipmentBasedApproaches
Thesetypeofstudiesusethenecessaryequipmentwhichwillgiveasignalofsomesortwhichisproportionaltothepositionoftheeyeintheorbit.VariousmethodsthatarecurrentinuseareElectrooculography,Infra-RedOculography,Scleralsearchcoils.Thesemethodsarecompletelyoutofourproject.
ImageBasedApproaches
Imagebasedapproachesperformeyedetectionsontheimages.Mostoftheimagebasedmethodstrytodetecttheeyesusingthefeaturesoftheeyes.Methodsusedsofarareknowledge-basedmethods,feature-basedmethods(color,gradient),simpletemplatematching,appearancemethods.Anotherinterestingmethodis“Deformabletemplatematching”whichisbasedonmatchingageometricaleyetemplateonaneyeimagebyminimizingtheenergyofthegeometricalmodel.
ImplementationofTrackEye
Theimplementedprojectisonthreecomponents:
1.Facedetection:
Performsscaleinvariantfacedetection
2.Eyedetection:
Botheyesaredetectedasaresultofthisstep
3.Eyefeatureextraction:
Featuresofeyesareextractedattheendofthisstep
FaceDetection
Twodifferentmethodswereimplementedintheproject.Theyare:
1.ContinuouslyAdaptiveMeans-ShiftAlgorithm
2.HaarFaceDetectionmethod
ContinuouslyAdaptiveMean-ShiftAlgorithm
AdaptiveMeanShiftalgorithmisusedfortrackinghumanfacesandisbasedonrobustnon-parametrictechniqueforclimbingdensitygradientstofindthemode(peak)ofprobabilitydistributionscalledthemeanshiftalgorithm.Asfacesaretrackedinvideosequences,meanshiftalgorithmismodifiedtodealwiththeproblemofdynamicallychangingcolorprobabilitydistributions.Theblockdiagramofthealgorithmisgivenbelow:
Haar-FaceDetectionMethod
ThesecondfacedetectionalgorithmisbasedonaclassifierworkingwithHaar-Likefeatures(namelyacascadeofboostedclassifiersworkingwithHaar-likefeatures).Firstofallitistrainedwithafewhundredsofsampleviewsofaface.Afteraclassifieristrained,itcanbeappliedtoaregionofinterestinaninputimage.Theclassifieroutputsa"
1"
iftheregionislikelytoshowfaceand"
0"
otherwise.Tosearchfortheobjectinthewholeimage,onecanmovethesearchwindowacrosstheimageandcheckeverylocationusingtheclassifier.Theclassifierisdesignedsothatitcanbeeasily"
resized"
inordertobeabletofindtheobjectsofinterestatdifferentsizes,whichismoreefficientthanresizingtheimageitself.
EyeDetection
Twodifferentmethodswereimplementedintheproject:
1.Template-Matching
2.Adaptive
EigenEye
Method
Template-Matching
Template-Matchingisawell-knownmethodforobjectdetection.Inourtemplatematchingmethod,astandardeyepatterniscreatedmanuallyandgivenaninputimage,thecorrelationvalueswiththestandardpatternsarecomputedfortheeyes.Theexistenceofaneyeisdeterminedbasedonthecorrelationvalues.Thisapproachhastheadvantageofbeingsimpletoimplement.However,itmaysometimesbeinadequateforeyedetectionsinceitcannoteffectivelydealwithvariationinscale,poseandshape.
AdaptiveEigenEyeMethod
Adaptive
Methodisbasedonthewell-knownmethod
EigenFaces.Howeverasthemethodisusedforeyedetectionwenameditas“EigenEye
Method”.Themainideaistodecomposeeyeimagesintoasmallsetofcharacteristicsfeatureimagescalledeigeneyes,whichmaybethoughtofastheprincipalcomponentsoftheoriginalimages.Theseeigeneyesfunctionastheorthogonalbasisvectorsofasubspacecalledeyespace.Howeverweknowthatthe
eigenface
methodisnotscaleinvariant.Toprovidethescaleinvariancewecanresizetheeye-databaseoncewiththeinformationgatheredbythefacedetectionalgorithm(EyeWidth/FaceWidth?
0.35),wecanprovidescale-invariantdetectionusingonlyonedatabase.
OpenCVFunctionsforObjectTrackingandDetection
OpenCV
Libraryoffersalotofimageprocessingandobjecttracking&
detectionlibraries.Themainfunctionusedintheseprojectsandtheirusagearegivenbelow:
SampleCodeforHaar-FaceTracking
Collapse
|
CopyCode
voidCTrackEyeDlg:
:
HaarFaceDetect(IplImage*img,CvBox2D*faceBox)
{
intscale=2;
IplImage*temp=cvCreateImage(cvSize(img->
width/2,img->
height/2),8,3);
CvPointpt1,pt2;
inti;
cvPyrDown(img,temp,CV_GAUSSIAN_5x5);
#ifdefWIN32
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;
pt1.y=img->
height-r->
y*scale;
pt2.y=img->
height-(r->
y+r->
height)*scale;
#else
pt1.y=r->
pt2.y=(r->
faceBox->
center.x=(float)(pt1.x+pt2.x)/2.0;
center.y=(float)(pt1.y+pt2.y)/2;
size.width=(float)(pt2.x-pt1.x);
size.height=(float)(pt1.y-pt2.y);
}
cvShowImage("
Tracking"
img);
cvReleaseImage(&
temp);
}
SampleCodeforCamShiftAlgorithm
//InputsforCamShiftalgorithm
IplImage*HUE=cvCreateImage(cvGetSize(SampleForHUE),IPL_DEPTH_8U,1);
extractHUE(SampleForHUE,HUE);
//**ExtractHUEinformation
inthist_size=20;
floatranges[]={0,180};
float*pranges[]={ranges};
hist=cvCreateHist(1,&
hist_size,CV_HIST_ARRAY,pranges,1);
cvCalcHist(&
HUE,hist);
//CalculatehistogramofHUEpart
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);
//Probabilityisformed
//cvShowImage("
Tester2"
backProject);
cvCamShift(backProject,searchWin,cvTermCriteria(CV_TERMCRIT_EPS|
CV_TERMCRIT_ITER,15,0.1),&
comp,&
faceBox);
searchWin=comp.rect;
SampleCodeTemplateMatching
//TemplateMatchingforEyedetection
voidFace:
findEyes_TM(IplImage*faceImage,TrackingSettings*settings)
CvSizefaceSize;
faceSize=cvGetSize(faceImage);
//LoadTemplatefromtheeyedatabase
CStringfileName;
//Nameofthetemplateforlefteye
fileName.Format("
%s\\eye%d.jpg"
settings->
params->
DBdirectory,0);
IplImage*eyeImage_Left=cvLoadImage(fileName,-1);
DBdirectory,1);
IplImage*eyeImage_Right=cvLoadImage(fileName,-1);
IplImage*tempTemplateImg_Left;
IplImage*tempTemplateImg_Right;
IplImage*templa