Eye and Mouth detection from face using haar-cascades

后端 未结 2 1784
梦毁少年i
梦毁少年i 2021-01-17 01:50

I have extracted eyes and mouth from the face, but want to extract emotions from eyes and mouth.. However, mouth is not detected properly.. This is my code..



        
2条回答
  •  悲&欢浪女
    2021-01-17 02:20

    i have divided face area in 2 rectangles top and bottom..and applied bottom rectangle to gray.ROI. and it works.. this is the code for both rectangles..

     int halfheight = facesnap.Height/2;
                        int start = facesnap.X;
                        int start1 = facesnap.Y;
    
                        Rectangle top = new Rectangle(start,start1,facesnap.Width,halfheight);
                        int start2 = top.Bottom;
    
                        Rectangle bottom = new Rectangle(start, start2, facesnap.Width, halfheight);
                        nextFrame.Draw(bottom, new Bgr(Color.Yellow), 2);
                        //Set the region of interest on the faces
                        gray.ROI = bottom;
                        MCvAvgComp[][] mouthsDetected = gray.DetectHaarCascade(mouth,
                                                        1.1, 10,
                                                      Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
                                                        new Size(20, 20));
    

提交回复
热议问题