Project integrate video capture and face detection with OpenCV and MTCNN.
With the producer comsumer framework, video capture in one thread and process in another thread using OpenCV library which drive the usbcamera with v4l2 in Linux.
MTCNN face detection method is a implementation of "Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Neural Networks". We use the code edited by the foreverYoungGitHub and integrate the detection code into comsumer thread. The average time of face detection is 19.7ms/frame.
You can Download th Pre-Trained model in this. Uncpmpress the model into the model fodel.
The addition library of the project is OpenCV and caffe. You must compile the libraries with cmake and add their path into the option.
You can compile code following the step:
- cd in the code folder.
- Copy the downloaded model into model folder and unzip it.
- cd build && cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=. -DCaffe_DIR:PATH=/your/path/of/caffe -DOpenCV_DIR:PATH=/your/path/of/OpenCV
- make -j 8
- make install
- cd install && ./videocapture