-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFindTwoPupilCircles.cpp
More file actions
44 lines (38 loc) · 1.3 KB
/
Copy pathFindTwoPupilCircles.cpp
File metadata and controls
44 lines (38 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "FindPupilCircleNew.h"
#include "ImageUtility.h"
#include <vector>
#include <algorithm>
void FindPupilCircleNew::doDetectTwoPupils(IplImage* img,
int rPupilMax,
const int space,
double ratio4Circle,
int closeItr,
int openItr,
int speed_m,
int alpha,
double norm,
float nScale,
int* circle1,
int* circle2)
{
// Make a copy of the given image
IplImage* grayImg = NULL;
grayImg = cvCloneImage(img);
//for the right eye
int wd1 = grayImg->width/2-space;
IplImage* rImg = NULL;
rImg = ImageUtility::setROIImage(grayImg,0,0, wd1, grayImg->height);
doDetect(rImg, rPupilMax, ratio4Circle, closeItr, openItr, speed_m, alpha, norm, nScale, circle1);
cvReleaseImage(&rImg);
//for the left eye
int startX = grayImg->width/2+space;
int wd2 = grayImg->width-(grayImg->width/2+space);
IplImage* lImg = NULL;
lImg =ImageUtility::setROIImage(grayImg,startX, 0, wd2, grayImg->height);
doDetect(lImg, rPupilMax, ratio4Circle, closeItr, openItr, speed_m, alpha, norm, nScale, circle2);
circle2[0] = ImageUtility::getValue(circle2[0]+startX, grayImg->width-1);
if(circle2[0] == 1)
circle2[0] = startX + 1;
cvReleaseImage(&lImg);
cvReleaseImage(&grayImg);
}