#camera-webservice
Here is a Python webservice called webservice.py written for this event. Google won't help you with any information specifically about the script, but you will find lots of information about the libraries used in the script. Proceed in steps.
- Install required prerequisites:
- OS Package dependencies (hint: use
apt-get
):python-pip fswebcam git
- Python module dependencies (hint: use
pip
):flask flask-restful boto3 elasticsearch
- On Windows: Additionally the Python module
pillow
and the CommandCam photo software placed in same directory aswebservice.py
- OS Package dependencies (hint: use
- Take a photo with
fswebcam
orcommandcam.exe
, transfer this to your laptop (scp
, and maybewinscp
are your friends), and verify the camera focus is good. Repeat as necessary :-)
- Clone the repo from github (hint: use
git
) - Copy the camera-webserivce
config.json.example
toconfig.json
- Update all parameters to meet your needs
- For the
camera_command
parameter these might be helpful:- Example linux USB camera:
fswebcam -r 1280x720 --jpeg 85 --no-banner -S 20
- Example native raspberry camera module:
raspistill -o
- Example windows usb camera:
CommandCam.exe /quiet /filename
- Example linux USB camera:
- Start it up with
python webservice.py
. Do you see any errors? Troubleshoot and fix them. - Use your browser to load
http://ip_address:8080
Does it report that everything is ok? If not, troubleshoot and fix them.
- Use your browser to call the API:
http://ip_address:8080/take_photo
- Does it report that everything is ok? Can you view your photo? If not, troubleshoot and fix.
- Use curl to call the API:
curl http://ip_address:8080/take_photo