Skip to content

Instantly share code, notes, and snippets.

@godber
Last active April 8, 2019 13:55
Show Gist options
  • Save godber/436b76f5ec248c05eee9a580b16df5d5 to your computer and use it in GitHub Desktop.
Save godber/436b76f5ec248c05eee9a580b16df5d5 to your computer and use it in GitHub Desktop.
Raspberry Pi All Sky Camera with Raspicam

Here's what I do after image acquisition.

  • Capture images with capture-loop.sh on Raspberry Pi
    • The raspberry pi is connected to my home network and is uncerimoniously thrown on the roof
    • It NFS mounts a disk inside, which is where the script lives and images get saved, so if an eagle flies off with it, I still have the data.
  • Convert the images to grayscale
  • Stretch them
  • Remove the bright ones at the beginning and end0
ls o*.jpg > r.txt
vim r.txt 
for i in $(cat r.txt); do rm $i; done
  • Convert remaining images to video.
#!/usr/bin/env bash
while true
do
dir="allskycam-mk1-$(date -I)"
mkdir -p ${dir}
raspistill -ex night -ss 10000000 -o ${dir}/img-$(date +%s).jpg
sleep 10
done
#!/usr/bin/env bash
# Convert color images to grayscale
for i in img-1*.jpg; do convert $i -colorspace Gray gray/$i; done
#!/usr/bin/env bash
# Stretch the images so the stars are visible
# Uses: http://www.fmwconcepts.com/imagemagick/levels/index.php
for i in *.jpg; do ~/Downloads/levels -i 0,15 ${i} o${i}; done
#!/usr/bin/env bash
# convert to video and gif
ffmpeg -r 10 -i oimg-%*.jpg -s 1280x1024 out.mp4
ffmpeg -r 10 -i oimg-%*.jpg -s 800x600 out.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment