====== Face recognition, pedestrian detection | openCV & RPi camera ====== \\ In the following, we'll run severall face detection algorithms using lastest openCV you've just installed [ [[rpi:opencv_install|latest openCV install]] ].\\ ===== Face detection @ RPi ===== \\ Basically, we'll experience two algorithms:\\ * LBP, * Haar cascade. //to be continued ;)// \\ ===== Offloading openCV processing from RPi to cloud! ===== \\ Having openCV running on our Raspberry Pi to process pictures from the attached camera will generally result in a poor framerate ... especially with algorithms like [[http://docs.opencv.org/trunk/doc/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html|haar cascade]]! \\ To solve this issue, we'll make use of our powerful cloud platform [[http://cloudmip.univ-tlse3.fr|CloudMIP]].\\ Being out-of-scope, you just have to know that the used VM features 2 physical CPU, 4GB RAM and latest openCV version.\\ ==== RPi side ==== Basically, we'll turn the RPi+attached camera as a mere IP camera exporting video stream through the RTSP protocol:\\ * v4l2 control setup # set framerate to 10 v4l2-ctl --set-parm=10 //Note: we set framerate through ''v4l2-ctl'' command since it it not yet supported in current vlc version (2.03 / Raspbian Wheezy).// * launch h264 stream export through RTSP protocol # switch to pi user and launch h264 stream export su -l pi cvlc -vvv v4l2:///dev/video0 --v4l2-width 640 --v4l2-height 480 --v4l2-fps 10 --v4l2-chroma h264 --sout '#rtp{sdp=rtsp://:8554/}' \\ Being PULL based, RTSP won't consume any network bandwidth as long as nobody access it.\\ H264 encoding being handled at the RPi's GPU level, RTSP streaming keeps RPi's CPU usage very low (~2%).\\ \\ ==== VM side ==== As a first step, you may launch ''vlc'' to check that you have access to the RTSP strem:\\ vlc rtsp://:8554/ //Note: pay attention to the trailing '/' of the rtsp address.// Now, you just have to launch the following code:\\ //to be continued ;)// ====== [advanced] openCV FaceRecognition ====== \\ http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html