title: OpenCV face detection can not find any
body: <p>I have followed online tutorials and managed to write a simple class like this:</p>
  
  <pre><code>public class FaceDetector
  {
  
      public static void detect(String imageFile) {
  
          System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
          System.out.println("\nRunning FaceDetector");
  
          CascadeClassifier faceDetector = new CascadeClassifier(FaceDetector.class.getResource("haarcascade_frontalface_alt.xml").getPath());
          Mat image = Highgui.imread(imageFile);
  
          MatOfRect faceDetections = new MatOfRect();
          faceDetector.detectMultiScale(image, faceDetections);
  
          int faceCount = faceDetections.toArray().length;
          System.out.println(String.format("Detected %s faces", faceCount));
  
          for (Rect rect : faceDetections.toArray()) {
              Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height),
                      new Scalar(0, 255, 0));
          }
  
          String filename = imageFile+"_output.png";
          System.out.println(String.format("Writing %s", filename));
          Highgui.imwrite(filename, image);
      }
  }
  </code></pre>
  
  <p>However I have tried this with over 200 profile pictures and it could not detect a single one. Since it rewrites the image file untouched, I know it reads image correctly. It is not giving any errors so. What should I do now? Any redirections? Where should I read? what am I missing?</p>