Search code examples
eclipsemacosjavacv

JavaCV - Running Examples


I'm a bit of an amateur developer and I'm currently messing around with JavaCV and Eclipse on my Mac.

I'm trying to get the FaceRecorgnition to work but I don't really know how to install this into Eclipse properly.

I've created a new Java Project, and I've imported the 'JavaCPP', 'JavaCV-Mac', and 'JavaCV' libraries.

I then created a package and called it 'mvn', then created a class and C/P the 'FaceRecorgnition' java into that class and then try and run it. I then get this error:

Oct 24, 2012 10:17:22 PM mvn.FaceRecognition learn
INFO: ===========================================
Oct 24, 2012 10:17:22 PM mvn.FaceRecognition learn
INFO: Loading the training images in data/all10.txt
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: data/all10.txt (No such file or directory)
    at mvn.FaceRecognition.loadFaceImgArray(FaceRecognition.java:317)
    at mvn.FaceRecognition.learn(FaceRecognition.java:97)
    at mvn.FaceRecognition.main(FaceRecognition.java:789)
Caused by: java.io.FileNotFoundException: data/all10.txt (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at java.io.FileInputStream.<init>(FileInputStream.java:79)
    at java.io.FileReader.<init>(FileReader.java:41)
    at mvn.FaceRecognition.loadFaceImgArray(FaceRecognition.java:244)
    ... 2 more

I don't fully understand imports and SDKs fully yet, so be easy.

Thanks.


Solution

  • This is not about missing libraries, but a missing .txt file. It seems like the all10.txt file is not included in the JavaCV download.

    Check out http://www.shervinemami.info/faceRecognition.html under the heading "How to use the offline cmd-based FaceRec system:"

    You find the all10.txt file in his zip facerecExample_ORL.zip and the faces needed in the zip Cambridge_FaceDB.zip

    Create a data folder where FaceRecognition.java is. Put the .txt files in that folder as well as the Cambridge_FaceDB folder:

    samples/
      FaceRecognition.java  
      data/
        all10.txt
        Cambridge_FaceDB/