Ask Your Question

lourish's profile - activity

2014-03-23 00:49:44 -0600 received badge  Necromancer (source)
2014-02-19 10:01:18 -0600 answered a question libpng warning: Image width is zero in IHDR

The problem is with URL paths and file paths. While on unix the URL path might work as an absolute file path on windows it is not the same thing. Probably the most reliable way to get the file path is to create a file object:

    final URI xmlUri = getClass().getResource("/lbpcascade_frontalface.xml").toURI();
    final CascadeClassifier faceDetector =
            new CascadeClassifier(new File(xmlUri).getAbsolutePath());
    final URI imageUri = getClass().getResource("/lena.png").toURI();
    final Mat image = Highgui.imread(new File(imageUri).getAbsolutePath());