Android OpenCV detect corner of each eyes

asked 2013-03-03 04:33:56 -0500

Kate gravatar image

updated 2013-03-04 03:30:25 -0500

Andrey Pavlenko gravatar image

Hello. I am working with OpenCV eye tracking in android. Currently the code which I have, detect the face, two eyes and the pupil of each eyes. Now I want to detect two corner of each eyes by white color detection. As I am new to opencv could you please guide me that how should I do this and suggest me an android sample code? This is the part of the code which I have:

for (int i = 0; i < facesArray.length; i++){     
  Rect r = facesArray[i];     
  Core.rectangle(mGray, r.tl(), r.br(), new Scalar(0, 255, 0, 255), 3);       
  Core.rectangle(mRgba, r.tl(), r.br(), new Scalar(0, 255, 0, 255), 3);       

  eyearea = new Rect(r.x +r.width/8,(int)(r.y + (r.height/4.5)),
                     r.width - 2*r.width/8,(int)( r.height/3.0));         
  Core.rectangle(mRgba,eyearea.tl(),eyearea.br() , new Scalar(255,0, 0, 255), 2);       
  Rect eyearea_right = new Rect(r.x +r.width/16,(int)(r.y + (r.height/4.5)),
                                (r.width - 2*r.width/16)/2,(int)( r.height/3.0));       
  Rect eyearea_left = new Rect(r.x +r.width/16 +(r.width - 2*r.width/16)/2,
                               (int)(r.y + (r.height/4.5)),(r.width - 2*r.width/16)/2,
                               (int)( r.height/3.0));            
  Core.rectangle(mGray,eyearea_left.tl(),eyearea_left.br() , new Scalar(255,0, 0, 255), 2);             
  Core.rectangle(mRgba,eyearea_right.tl(),eyearea_right.br() , new Scalar(255, 0, 0, 255), 2);       
  if(learn_frames<5){       
    //This part detect the pupil of the eyes      
    teplateR = get_template(mCascadeER,eyearea_right,20);     
    teplateL = get_template(mCascadeEL,eyearea_left,20);      
    learn_frames++;      
  }else{      
    match_value = match_eye(eyearea_right,teplateR,FdActivity.method);      
    match_value = match_eye(eyearea_left,teplateL,FdActivity.method);      
  }     
  Imgproc.resize(mRgba.submat(eyearea_left), mZoomWindow2, mZoomWindow2.size());        
  Imgproc.resize(mRgba.submat(eyearea_right), mZoomWindow, mZoomWindow.size());      
}
edit retag flag offensive close merge delete