Ask Your Question
0

Java: Example app not detecting faces

asked 2013-06-23 10:20:14 -0500

Hi recently i started writing an app, wchich was supposed to detect faces on image from webcam. Everything worked except: the app hasn't been detecting faces. I was looking for errors, but in the meanwhile I decided to run app from opencv java examples: http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html but it doesn't detect faces! Doesn't even display any errors, just writing the input picture as output one. What am I doing wrong? Everything compiles without errors, also I haven't changed any line of code.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-06-23 16:00:15 -0500

berak gravatar image

updated 2013-06-23 16:01:16 -0500

i bet, it did not find the cascadefile.

that sample assumes, that lbpcascade_frontalface.xml and lena.png were in the same place, when your resources got compiled. check that.

alternatively, try an absolute path for resources(images, cascades, etc) like:

CascadeClassifier faceDetector = new CascadeClassifier("/home/opencv/data/lbpcascade_frontalface.xml");

or:

 Mat image = Highgui.imread("c:/folder/lena.png"); // yes, forward slashes, please !
edit flag offensive delete link more

Comments

i had the same issue. i am running on linux mint and the way i solved it was by changing the code to:

CascadeClassifier faceDetector = new CascadeClassifier("../resources/lbpcascade_frontalface.xml");

Mat image = Highgui.imread("../resources/lena.png");

for whatever reason, when i attempted to use the absolute path, it didnt work but this ended up working. i am basically just labelling the relative path to the png and xml file.( .. means go back a directory)

habahnow gravatar imagehabahnow ( 2015-01-29 22:21:52 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-06-23 10:20:14 -0500

Seen: 500 times

Last updated: Jun 23 '13