Image Processing using OpenCV:
- face detection&recognition
- TODO: motion detection
- etc.
Done entirely with OpenCV with additional Face module from OpenCV-contrib repository.
I've reused some code and followed the tutorials provided by Luigi De Russis. Other relevant sources are mentioned below.
The main problem of all the face recognition tutorials or code samples I've found is that they were all based on OpenCV version 2.4 or used external libraries like JavaCV. My code is based on the latest version of OpenCV 3.1.0. In this version some of the methods are different from the previous versions, for instance method MatVector is not available anymore (and most of the code samples I've found depended on it). I also didn't want to use external libraries to keep it clean and neat.
Application requires a training set of images to train the face recognition. The model is trained automatically every time the application is started. If it's a first start and no training set is available comment the trainModel();
line in init method of FXController's code. After that run the application, select the Classifier, select 'New User' checkbox, enter your name and click Submit button. Then click the Start Camera button. Application will take 50 pictures of your face and put them in the training set directory. After few seconds you may close the application, uncomment the trainModel();
line and start the application again. The model will be re-trained and now your face should be recognized.
Face recognition is sensitive to lightning in the room so it's recommended to use the training set of images taken not from one point. For example, just by holding your laptop in your hand and turning around with it while collecting the training set gives pretty good results.
The opencv jar file used in this project might not work on your architecture (mostly likely will not). You will need to compile it on the system you're going to run face recognition code at. This is not difficult and I've wrote a simple step-by-step instructions for this purpose. Refer to https://github.com/zavalyshyn/ImageProcessing/commit/0f481d4bb526fbbf5ce2f39e7a03f6262cfd1e76#commitcomment-18412442