1 | initial version |
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());