Results
The complete system in operation with the Raspberry Pi and the camera is shown in the following image.
To run the program you must place the three files in one folder and with them create a folder called “video”, which will store all necessary temporary files.
In this case, run the program manually typing in console:
./pycamaraV3.py
At the moment it detects an internet connection stops recording at the end of the preset time working. Following this initiates the creation of the video in avi format. If the Internet connection and local network works transmits the file to the server. If the system can not transfer the file print a message error. In case there is no connection will continue recording the video and deleted half of it in the earliest frames.
If you want to close the program at any point is pressed on the keyboard:
control + C
This ends the process that is running at the time, but you take the time to end it and save the file correctly (if internet connection exists q) without generating unexpected errors in the process.
The resulting video quality is average but to recognize people and objects clearly, below is an example of a recording.
The Raspberry Pi has several hardware limitations, the maximum number of frames per second that was obtained is 8, a really slow capturing if we want to put the camera in a place with a lot of movement. So the code needs to be optimized for Raspbian in order to get the best performance from the Raspberry Pi. Other issue is the moment when the capturing is stopped to check the internet connection, this can be improved by using threads for separate the capturing process and the internet checking process into two parallel processes, so the video capturing can be continuous until an internet connection is detected.
Presentation day: