Application
The interface also allows to change the detection settings (video cropping, Face HitBox size, etc..) These parameters are directly in the GUI so it is easy to find the right settings. I will maybe add a save/load feature for the parameters later if needed. But for now you can tune these parameters in real-time, then change their default values in the code.
The output coordinates (on UART and socket) as the following format : <%+0.3d|%+0.3d>. This means, that from the above screenshot, the output value is : <+034|-021>
This application is based on Python 2.7 and OpenCV 3. To use it you need to install the following packages : PIL, tkinter, PySerial and numpy. For now I’m working on windows, so I didn’t tried it on the Pi yet… this means I can’t help you for packages installation… However, I suggest you to install PIP to install packages, this would be much easier. Do not forget to place haarcascade_frontalface_default.xml in the same folder as the Python file.
Of course I will not use this application for the Pi as it would be too heavy to process smoothly, I will make a lighter version without GUI and without video feedback and only focus on the algorithm and UART output.
Below you can find the application’s code. Please be indulgent as I’m still learning Python… I’m sure it can be greatly improved (if you have corrections/suggestions, please tell me ) but at least it is as clear as possible and it works fine ! The code contains enough comments to understand it if you know how to program.
>>> Source code available here <<<