眼睛识别.docx

上传人:b****5 文档编号:7250233 上传时间:2023-01-22 格式:DOCX 页数:16 大小:80.75KB
下载 相关 举报
眼睛识别.docx_第1页
第1页 / 共16页
眼睛识别.docx_第2页
第2页 / 共16页
眼睛识别.docx_第3页
第3页 / 共16页
眼睛识别.docx_第4页
第4页 / 共16页
眼睛识别.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

眼睛识别.docx

《眼睛识别.docx》由会员分享,可在线阅读,更多相关《眼睛识别.docx(16页珍藏版)》请在冰豆网上搜索。

眼睛识别.docx

眼睛识别

AbouttheAuthor

zafersavas

Engineer

ASELSANA.S.

 Turkey

Member

ZaferisanelectronicsengineerlivinginAnkara/TurkeyandworkingforASELSANA.S./TMM. 

Hehasbeencodingforabout12years,andcan'tthinkalifewithoutC/C++.

 

Helikes

-MSVisualC++6.0andMFC

-.NETC#

-Allkindsofelectronicsstuff

-MachineVisionprojects

 

Alsoheenjoys 

-Listeningto"TheCranberries"&"TheGloriousDolores"

-Travelling

 

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:

 CV_RGB2GRAY

∙SelectSimplethresholdingandenter100asthe“Thresholdvalue”

∙Click“SaveSettings”andthenclick“Close”

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 EigenEye 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;

#ifdefWIN32

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);

}

SampleCodeforCamShiftAlgorithm

 Collapse | CopyCode

//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

 Collapse | CopyCode

//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);

//Nameofthetemplateforlefteye

fileName.Format("%s\\eye%d.jpg",settings->params->DBdirectory,1);

IplImage*eyeImage_Right=cvLoadImage(fileName,-1);

IplImage*tempTemplateImg_Left;IplImage*tempTemplateImg_Right;

IplImage*templa

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 高等教育 > 研究生入学考试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1