1

我有一个代码可以检测面部,双眼,然后是每只眼睛的瞳孔。现在我想通过使用白色检测来检测每只眼睛的角落。由于我是opencv的新手,请您指导我应该如何执行此操作并为我提供android示例代码?这是我拥有的代码的一部分:

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());      
                        }      
4

1 回答 1

0

你需要像 Flandmark 这样的东西来检测角落。见:http ://cmp.felk.cvut.cz/~uricamic/flandmark/

于 2013-12-21T14:11:14.407 回答