Some faces not detection

asked 2018-03-03 06:53:29 -0600

sandiplovv gravatar image

Hello members, This is my first question on this forum. Just, I started project on openCV. By using java file I am uploading image after uploading it detect faces and make rectangle to face. In my image there are 14 faces and its detecting 12 faces.

this is code

      String file ="C:/EXAMPLES/OpenCV/group12.jpg";
      Mat src = Imgcodecs.imread(file);

      // Instantiating the CascadeClassifier
      String xmlFile = "C:/EXAMPLES/facedetect/lbpcascade_frontalface.xml";
      CascadeClassifier classifier = new CascadeClassifier(xmlFile);

      // Detecting the face in the snap
      MatOfRect faceDetections = new MatOfRect();
      classifier.detectMultiScale(src, faceDetections);
      System.out.println(String.format("Detected %s faces", 
         faceDetections.toArray().length));

      // Drawing boxes
      for (Rect rect : faceDetections.toArray()) {
         Imgproc.rectangle(
            src,                                               // where to draw the box
            new Point(rect.x, rect.y),                            // bottom left
            new Point(rect.x + rect.width, rect.y + rect.height), // top right
            new Scalar(0, 0, 255),
            3                                                     // RGB colour
         ); 
      }

image description

edit retag flag offensive close merge delete

Comments

try another cascade (e.g. one with glasses)

(the guy on the right -- that's uncureable, he's looking away from the cam, no full face visible)

berak gravatar imageberak ( 2018-03-03 09:15:42 -0600 )edit

ok one guy looking down, but red shirt guy also not recognized, other person also has glass

sandiplovv gravatar imagesandiplovv ( 2018-03-04 23:20:31 -0600 )edit

@berak , i am waiting for ur reply

sandiplovv gravatar imagesandiplovv ( 2018-03-06 00:16:54 -0600 )edit

what do you want, or even expect ? try some things, live with the outcome.

(i don't think, there's much we can do here)

berak gravatar imageberak ( 2018-03-06 01:35:01 -0600 )edit