Overwatch Webcam Setup

Forums:

Download V1 Overwatch is the Raspberry Pi python script that will perform face recognition using Python OpenCV, which you can upload to your web server to be displayed on a console page. It will use the hostname for the image name. Run it on multiple Pi's with either a pi std camera, pi noir camera or USB Camera. What's New in V1
*** Remove sudo from the first line of overwatch.sh so it is only cd /home/pi/overwatch. Silly mistake, you cannot sudo cd.. it will not launch of you do not remove it (if using the overwatch.sh in crontab)
Renamed from vidtrack.py to overwatch.py Included some additional files in zip i500.py - you can use this to squose down images to 500x500 pics. (use as needed) overwatch.py - replaces vidtrack.py (why not for consistency?) overwatchcheck.sh - util to display if python is running. chk.sh - run in crontab will check for python running and restart if no python (add to crontab) Added a few args to overwatch.py (in code) slptime=60 - sets the default it snoozes to take a pic. def 60 seconds. oUser="picup" - user account used to save and upload pics from. (def /home/picup) oAllPics=True - True: only capture if face recognized, False: Capture any. 0PicLimit=20 - Save a pic history. Increments on each pass. If =0 then no pic history. Overwatch.py Updates Pics are now named as machine host name - i.e. mypi.jpg or for history as mypi_1.jpg, mypi_2.jpg, etc color flop for datestamp - (change to adjust for your daylight/darkness (white vs black text) if (curhour < 6 or curhour > 18): #change for start/stop on white v black Processing from crontab Everything processes from crontab. The initial fire is a 30 second pause then run the overwatch.sh file. overwatch.sh first switches to the overwatch directory (required) and then runs python under sudo. This is required for permissions to the directory containing the images to upload. You can also grant the permissions directly. chk.sh looks for python running and if not, reruns overwatch.sh *All of this will be based on where your overwatch files are. crontab -e @reboot sleep 30 && /home/pi/bin/overwatch/overwatch.sh %CURLSTRING% 0 * * * * python3 /home/pi/bin/picurl.py 15 * * * * sudo /home/pi/bin/overwatch/chk.sh */5 * * * * /home/pi/bin/overwatch/hstry.sh > /home/pi/bin/overwatch/hst.txt
There are a few variables required to push the image using crontab via curl. I have replaced each wrapped in %item% to explain what each is, which you will have to replace with your own settings. %picuser% is the fictitious user account created where the images are stored %picpw% is that fictitious user's password. %pichomepath% is that users /home/user directory %webserver% is the pi apache web server that processes the pictures to the overwatch web view. The picuser on the web server can be the same account as on the image upload pi.. or different, but you will have to update the password. Since it is running sudo then the local user pw does not matter, this is for the remote curl push access. %hostname% This variable should be the host name of your camera pi. When overwatch.py runs, it names the image(s) using the hostname of the pi. Image upload cron %CURLSTRING% * * * * * curl --insecure --user %picuser:%picpassd% -T %pichomepath%/%hostname%.png sftp://%webserver%/%picuser%
PiCamera >>Pi Web Server >>Browser Interface
Files: 
AttachmentSize
Package icon overwatchv1.zip612.29 KB